diff --git a/Gopkg.lock b/Gopkg.lock index b311418a7a..bf93b6d4e0 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -182,12 +182,6 @@ packages = ["."] revision = "316fb6d3f031ae8f4d457c6c5186b9e3ded70435" -[[projects]] - branch = "master" - name = "github.com/google/go-querystring" - packages = ["query"] - revision = "53e6ce116135b80d037921a7fdd5138cf32d7a8a" - [[projects]] branch = "master" name = "github.com/google/gofuzz" @@ -333,10 +327,14 @@ version = "v1.0.0-rc1" [[projects]] - branch = "master" - name = "github.com/oracle/bmcs-go-sdk" - packages = ["."] - revision = "1461ec54db86b0cbec11b2730d0ae31a26a7e73d" + name = "github.com/oracle/oci-go-sdk" + packages = [ + "common", + "core", + "loadbalancer" + ] + revision = "8090aeb474ad994446b2db294725e3d6c0d95327" + version = "v1.0.0" [[projects]] name = "github.com/pborman/uuid" @@ -356,6 +354,12 @@ revision = "5f041e8faa004a95c88a202771f4cc3e991971e6" version = "v2.0.1" +[[projects]] + name = "github.com/pkg/errors" + packages = ["."] + revision = "645ef00459ed84a119197bfb8d8205042c6df63d" + version = "v0.8.0" + [[projects]] name = "github.com/prometheus/client_golang" packages = ["prometheus"] @@ -952,6 +956,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "a361296a244bf9eea35f52b4b1a51f4dc08ab30b4a98dc2d25b68cb9827603c7" + inputs-digest = "43614e55350ef4681fd37c3406397db5ba7aa2ad5587f5ac691b6497df3937bd" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 350e1ba74f..7aa10bef3d 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -28,10 +28,6 @@ branch = "master" name = "github.com/golang/glog" -[[constraint]] - branch = "master" - name = "github.com/oracle/bmcs-go-sdk" - [[constraint]] name = "github.com/spf13/pflag" version = "1.0.0" @@ -68,6 +64,10 @@ name = "github.com/onsi/gomega" version = "1.3.0" +[[constraint]] + name = "github.com/oracle/oci-go-sdk" + version = "1.0.0" + [prune] non-go = true diff --git a/pkg/oci/ccm.go b/pkg/oci/ccm.go index c2e132c987..8c4e1d3eff 100644 --- a/pkg/oci/ccm.go +++ b/pkg/oci/ccm.go @@ -25,16 +25,16 @@ import ( "github.com/golang/glog" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/client-go/informers" + wait "k8s.io/apimachinery/pkg/util/wait" + informers "k8s.io/client-go/informers" clientset "k8s.io/client-go/kubernetes" - "k8s.io/client-go/tools/cache" - "k8s.io/kubernetes/pkg/cloudprovider" - "k8s.io/kubernetes/pkg/controller" + listersv1 "k8s.io/client-go/listers/core/v1" + cache "k8s.io/client-go/tools/cache" + cloudprovider "k8s.io/kubernetes/pkg/cloudprovider" + controller "k8s.io/kubernetes/pkg/controller" "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" "github.com/oracle/oci-cloud-controller-manager/pkg/oci/util" - listersv1 "k8s.io/client-go/listers/core/v1" ) // ProviderName uniquely identifies the Oracle Bare Metal Cloud Services (OCI) @@ -61,19 +61,13 @@ type CloudProvider struct { // interface. var _ cloudprovider.Interface = &CloudProvider{} -// NewCloudProvider creates a new baremetal.CloudProvider. +// NewCloudProvider creates a new oci.CloudProvider. func NewCloudProvider(cfg *client.Config) (cloudprovider.Interface, error) { c, err := client.New(cfg) if err != nil { return nil, err } - err = c.Validate() - if err != nil { - glog.Errorf("cloudprovider.Validate() failed to communicate with OCI: %v", err) - return nil, err - } - return &CloudProvider{ client: c, config: cfg, diff --git a/pkg/oci/client/client.go b/pkg/oci/client/client.go index ce00a1fdb9..b135f57af0 100644 --- a/pkg/oci/client/client.go +++ b/pkg/oci/client/client.go @@ -1,4 +1,4 @@ -// Copyright 2017 Oracle and/or its affiliates. All rights reserved. +// Copyright 2018 Oracle and/or its affiliates. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,788 +15,94 @@ package client import ( - "crypto/tls" - "crypto/x509" - "fmt" - "io/ioutil" - "net" - "net/http" - "net/url" - "os" - "sort" - "strings" + "context" "time" - "github.com/golang/glog" - api "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/tools/cache" - baremetal "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/instancemeta" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/util" -) - -const ( - // DefaultLoadBalancerPolicy is the default load balancing algorithm when - // creating a BackendSet. - DefaultLoadBalancerPolicy = "ROUND_ROBIN" + "github.com/golang/glog" + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/core" + "github.com/oracle/oci-go-sdk/loadbalancer" + "github.com/pkg/errors" ) -// Interface abstracts the OCI SDK and application specific convenience methods -// for interacting with the OCI API. +// Interface of consumed OCI API functionality. type Interface interface { - BaremetalInterface - - // GetInstanceByNodeName retrieves the baremetal.Instance corresponding or - // a SearchError if no instance matching the node name is found. - GetInstanceByNodeName(name string) (*baremetal.Instance, error) - // GetNodeAddressesForInstance gets the node addresses of an instance based - // on the given instance OCID. - GetNodeAddressesForInstance(id string) ([]api.NodeAddress, error) - // GetAttachedVnicsForInstance returns a slice of AVAILABLE Vnics for a - // given instance ocid. - GetAttachedVnicsForInstance(id string) ([]*baremetal.Vnic, error) - // CreateAndAwaitLoadBalancer creates a load balancer and blocks until data - // is available or timeout is reached. - CreateAndAwaitLoadBalancer(name, shape string, subnets []string, internal bool) (*baremetal.LoadBalancer, error) - // GetLoadBalancerByName gets a load balancer by its DisplayName. - GetLoadBalancerByName(name string) (*baremetal.LoadBalancer, error) - // GetCertificateByName gets a certificate by its name. - GetCertificateByName(loadBalancerID string, name string) (*baremetal.Certificate, error) - // CreateAndAwaitBackendSet creates the given BackendSet for the given - // LoadBalancer. - CreateAndAwaitBackendSet(lb *baremetal.LoadBalancer, bs baremetal.BackendSet) (*baremetal.BackendSet, error) - // CreateAndAwaitListener creates the given Listener for the given - // LoadBalancer. - CreateAndAwaitListener(lb *baremetal.LoadBalancer, listener baremetal.Listener) error - // CreateAndAwaitCertificate creates a certificate for the given - // LoadBalancer. - CreateAndAwaitCertificate(lb *baremetal.LoadBalancer, name string, certificate string, key string) error - // AwaitWorkRequest blocks until the work request succeeds, fails or if it - // timesout after exponential backoff. - AwaitWorkRequest(id string) (*baremetal.WorkRequest, error) - // GetSubnetsForNodes returns the deduplicated subnets in which the - // given internal IP addresses reside. - GetSubnetsForNodes([]*api.Node) ([]*baremetal.Subnet, error) - // GetSubnets returns the subnets for the given ocids. - GetSubnets(ocids []string) ([]*baremetal.Subnet, error) - // GetDefaultSecurityList gets the default SecurityList for the given Subnet - // by assuming that the default SecurityList is always the oldest (as it is - // created automatically when the Subnet is created and cannot be deleted). - GetDefaultSecurityList(subnet *baremetal.Subnet) (*baremetal.SecurityList, error) -} - -// BaremetalInterface defines the subset of the baremetal API exposed by the -// client. It is composed into Interface. -type BaremetalInterface interface { - Validate() error - // LaunchInstance creates an instance - // THIS SHOULD ONLY BE USED FOR INTEGRATION TESTING - LaunchInstance( - availabilityDomain, - compartmentID, - image, - shape, - subnetID string, - opts *baremetal.LaunchInstanceOptions) (*baremetal.Instance, error) - // TerminateInstance terminates the given instance. - // THIS SHOULD ONLY BE USED FOR INTEGRATION TESTING - TerminateInstance(id string, opts *baremetal.IfMatchOptions) error - - GetInstance(id string) (*baremetal.Instance, error) - - GetSubnet(id string) (*baremetal.Subnet, error) - - UpdateSecurityList(id string, opts *baremetal.UpdateSecurityListOptions) (*baremetal.SecurityList, error) - - CreateBackendSet( - loadBalancerID string, - name string, - policy string, - backends []baremetal.Backend, - healthChecker *baremetal.HealthChecker, - sslConfig *baremetal.SSLConfiguration, - sessionPersistenceConfig *baremetal.SessionPersistenceConfiguration, - opts *baremetal.LoadBalancerOptions, - ) (workRequestID string, e error) - UpdateBackendSet(loadBalancerID string, backendSetName string, opts *baremetal.UpdateLoadBalancerBackendSetOptions) (workRequestID string, e error) - DeleteBackendSet(loadBalancerID string, backendSetName string, opts *baremetal.ClientRequestOptions) (string, error) - - CreateListener( - loadBalancerID string, - name string, - defaultBackendSetName string, - protocol string, - port int, - sslConfig *baremetal.SSLConfiguration, - opts *baremetal.LoadBalancerOptions, - ) (workRequestID string, e error) - UpdateListener(loadBalancerID string, listenerName string, opts *baremetal.UpdateLoadBalancerListenerOptions) (workRequestID string, e error) - DeleteListener(loadBalancerID string, listenerName string, opts *baremetal.ClientRequestOptions) (workRequestID string, e error) - - DeleteLoadBalancer(id string, opts *baremetal.ClientRequestOptions) (string, error) -} - -// New creates a new OCI API client. -func New(cfg *Config) (Interface, error) { - var opts = []baremetal.NewClientOptionsFunc{baremetal.PrivateKeyBytes([]byte(cfg.Auth.PrivateKey)), - baremetal.Region(cfg.Auth.Region), - // Kubernetes will handle retries. - // The current go client will retry requests that are not retryable. - baremetal.DisableAutoRetries(true)} - - if cfg.Auth.PrivateKeyPassphrase != "" { - opts = append(opts, baremetal.PrivateKeyPassword(cfg.Auth.PrivateKeyPassphrase)) - } - - // Handles the case where we want to talk to OCI via a proxy. - ociProxy := os.Getenv("OCI_PROXY") - trustedCACertPath := os.Getenv("TRUSTED_CA_CERT_PATH") - if ociProxy != "" || trustedCACertPath != "" { - transport := http.Transport{ - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - DualStack: true, - }).DialContext, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - } - - if ociProxy != "" { - glog.Infof("using OCI proxy server: %s", ociProxy) - proxyURL, err := url.Parse(ociProxy) - if err != nil { - return nil, fmt.Errorf("failed to parse OCI proxy url: %s, err: %v", ociProxy, err) - } - transport.Proxy = func(req *http.Request) (*url.URL, error) { - return proxyURL, nil - } - } - - if trustedCACertPath != "" { - glog.Infof("configuring OCI client with a new trusted ca: %s", trustedCACertPath) - trustedCACert, err := ioutil.ReadFile(trustedCACertPath) - if err != nil { - return nil, fmt.Errorf("failed to read root certificate: %s, err: %v", trustedCACertPath, err) - } - caCertPool := x509.NewCertPool() - ok := caCertPool.AppendCertsFromPEM(trustedCACert) - if !ok { - return nil, fmt.Errorf("failed to parse root certificate: %s", trustedCACertPath) - } - transport.TLSClientConfig = &tls.Config{RootCAs: caCertPool} - } - - opts = append(opts, func(o *baremetal.NewClientOptions) { - o.Transport = &transport - }) - } - - ociClient, err := baremetal.NewClient( - cfg.Auth.UserOCID, - cfg.Auth.TenancyOCID, - cfg.Auth.Fingerprint, - opts..., - ) - if err != nil { - return nil, err - } - - compartmentOCID := cfg.Auth.CompartmentOCID - if compartmentOCID == "" { - glog.Info("compartment not supplied in config: attempting to infer from instance metadata") - metadata, err := instancemeta.New().Get() - if err != nil { - return nil, err - } - compartmentOCID = metadata.CompartmentOCID - } - - vcnID := cfg.VCNID - if vcnID == "" { - glog.Infof("No vcn provided in cloud provider config. Falling back to looking up VCN via LB subnet.") - subnet, err := ociClient.GetSubnet(cfg.LoadBalancer.Subnet1) - if err != nil { - return nil, fmt.Errorf("failed to get load balancer subnet 1: %v", err) - } - vcnID = subnet.VcnID - } - - return &client{ - Client: ociClient, - compartmentID: compartmentOCID, - vcnID: vcnID, - subnetCache: cache.NewTTLStore(subnetCacheKeyFn, time.Duration(24)*time.Hour), - securityListCache: cache.NewTTLStore(securityListKeyFn, time.Duration(24)*time.Hour), - }, nil + Compute() ComputeInterface + LoadBalancer() LoadBalancerInterface + Networking() NetworkingInterface } -// client is a wrapped baremetal.Client with additional methods/props for -// convenience. type client struct { - *baremetal.Client - - compartmentID string // the OCID of the Compartment in which the cluster resides. - vcnID string // the OCID of the VCN in which the cluster resides. - - subnetCache cache.Store - securityListCache cache.Store -} - -// Just check we can talk to baremetal before doing anything else (failfast) -// Maybe do some more things like check the compartment we are give is valid.... -func (c *client) Validate() error { - _, err := c.Client.ListAvailabilityDomains(c.compartmentID) - return err -} - -// GetInstanceByNodeName gets the OCID of instance with a display name equal to -// the given node name. -func (c *client) GetInstanceByNodeName(nodeName string) (*baremetal.Instance, error) { - glog.V(4).Infof("GetInstanceByNodeName(%q) called", nodeName) - if nodeName == "" { - return nil, fmt.Errorf("blank nodeName passed to getInstanceByNodeName()") - } - - opts := &baremetal.ListInstancesOptions{ - DisplayNameListOptions: baremetal.DisplayNameListOptions{ - DisplayName: nodeName, - }, - } - - r, err := c.ListInstances(c.compartmentID, opts) - if err != nil { - return nil, err - } - - instances := getNonTerminalInstances(r.Instances) - count := len(instances) - - switch { - case count == 0: - // If we can't find an instance by display name fall back to the more - // expensive search method. - return c.findInstanceByNodeNameIsVnic(nodeName) - case count == 1: - glog.V(4).Infof("getInstanceByNodeName(%q): Got instance %s", nodeName, instances[0].ID) - return &instances[0], nil - default: - return nil, fmt.Errorf("expected one instance with display name '%s' but got %d", nodeName, count) - } -} - -// IsInstanceInTerminalState returns true if the instance is in a terminal state, false otherwise. -func IsInstanceInTerminalState(instance *baremetal.Instance) bool { - return instance.State == baremetal.ResourceTerminated || - instance.State == baremetal.ResourceTerminating || - instance.State == "UNKNOWN" -} - -func getNonTerminalInstances(instances []baremetal.Instance) []baremetal.Instance { - var result []baremetal.Instance - for _, instance := range instances { - if !IsInstanceInTerminalState(&instance) { - result = append(result, instance) - } - } - return result -} - -// findInstanceByNodeNameIsVnic tries to find the OCI Instance for a given node -// name. It makes the assumption that he node name is resolvable. -// See: https://kubernetes.io/docs/concepts/architecture/nodes/#management -func (c *client) findInstanceByNodeNameIsVnic(nodeName string) (*baremetal.Instance, error) { - var running []baremetal.Instance - opts := &baremetal.ListVnicAttachmentsOptions{} - for { - vnicAttachments, err := c.ListVnicAttachments(c.compartmentID, opts) - if err != nil { - return nil, err - } - for _, attachment := range vnicAttachments.Attachments { - if attachment.State != baremetal.ResourceAttached { - glog.Warningf("VNIC attachment `%s` for instance `%s` has a state of `%s`", attachment.ID, nodeName, attachment.State) - continue - } - vnic, err := c.GetVnic(attachment.VnicID) - if err != nil { - return nil, err - } - - // Skip VNICs that aren't attached to the cluster's VCN. - subnet, err := c.GetSubnet(vnic.SubnetID) - if err != nil { - return nil, err - } - if subnet.VcnID != c.vcnID { - continue - } - - if vnic.PublicIPAddress == nodeName || - (vnic.HostnameLabel != "" && strings.HasPrefix(nodeName, vnic.HostnameLabel)) { - instance, err := c.GetInstance(attachment.InstanceID) - if err != nil { - return nil, err - } - - if IsInstanceInTerminalState(instance) { - glog.Warningf("Instance %q is in state %q which is a terminal state", instance.ID, instance.State) - continue - } - - running = append(running, *instance) - } - } - if hasNextPage := SetNextPageOption(vnicAttachments.NextPage, &opts.ListOptions.PageListOptions); !hasNextPage { - break - } - } - - count := len(running) - switch { - case count == 0: - return nil, NewNotFoundError(fmt.Sprintf("could not find instance for node name %q", nodeName)) - case count > 1: - return nil, fmt.Errorf("expected one instance vnic ip/hostname %q but got %d", nodeName, count) - } - - return &running[0], nil -} - -// GetNodeAddressesForInstance gets the NodeAddress's of a given instance by -// OCID. -func (c *client) GetNodeAddressesForInstance(id string) ([]api.NodeAddress, error) { - glog.V(4).Infof("GetNodeAddressesForInstance(%q) called", id) - if id == "" { - return nil, fmt.Errorf("blank id passed to GetNodeAddressesForInstance()") - } - - vnics, err := c.GetAttachedVnicsForInstance(id) - if err != nil { - return nil, fmt.Errorf("get attached vnics for instance `%s`: %v", id, err) - } - - addresses := []api.NodeAddress{} - for _, vnic := range vnics { - addrs, err := extractNodeAddressesFromVNIC(vnic) - if err != nil { - return nil, err - } - addresses = append(addresses, addrs...) - } - - return addresses, nil -} - -// GetAttachedVnicsForInstance returns a slice of AVAILABLE VNICs for a given -// instance OCID. -func (c *client) GetAttachedVnicsForInstance(id string) ([]*baremetal.Vnic, error) { - glog.V(4).Infof("GetAttachedVnicsForInstance(%q) called", id) - if id == "" { - return nil, fmt.Errorf("blank instance id passed to GetAttachedVnicsForInstance()") - } - - opts := &baremetal.ListVnicAttachmentsOptions{ - InstanceIDListOptions: baremetal.InstanceIDListOptions{InstanceID: id}, - } - var vnics []*baremetal.Vnic - for { - r, err := c.ListVnicAttachments(c.compartmentID, opts) - if err != nil { - return nil, fmt.Errorf("list vnic attachments: %v", err) - } - - for _, att := range r.Attachments { - if att.State != baremetal.ResourceAttached { - glog.Warningf("instance `%s` vnic attachment `%s` is in state %s", id, att.ID, att.State) - continue - } - - v, err := c.GetVnic(att.VnicID) - if err != nil { - return nil, fmt.Errorf("get vnic %s: %v", att.VnicID, err) - } - - if v.State != baremetal.ResourceAvailable { - glog.Warningf("instance `%s` vnic `%s` is in state %s", id, att.VnicID, v.State) - continue - } - - vnics = append(vnics, v) - } - - if hasNexPage := SetNextPageOption(r.NextPage, &opts.ListOptions.PageListOptions); !hasNexPage { - break - } - } - return vnics, nil -} - -// f(n) = 1.25 * f(n - 1) | f(1) = 2 -var backoff = wait.Backoff{ - Steps: 15, - Duration: 2 * time.Second, - Factor: 1.25, - Jitter: 0.1, -} + config *Config -// AwaitWorkRequest keeps polling a OCI work request until it succeeds. If it -// does not succeeded after N retries then return an error. -func (c *client) AwaitWorkRequest(id string) (*baremetal.WorkRequest, error) { - glog.V(4).Infof("Polling WorkRequest %q...", id) + compute *core.ComputeClient + network *core.VirtualNetworkClient + loadbalancer *loadbalancer.LoadBalancerClient - var wr *baremetal.WorkRequest - opts := &baremetal.ClientRequestOptions{} - err := wait.ExponentialBackoff(backoff, func() (bool, error) { - twr, reqErr := c.GetWorkRequest(id, opts) - if reqErr != nil { - return false, reqErr - } - - glog.V(4).Infof("WorkRequest %q state: '%s'", id, twr.State) - - switch twr.State { - case baremetal.WorkRequestSucceeded: - wr = twr - return true, nil - case baremetal.WorkRequestFailed: - return false, fmt.Errorf("WorkRequest %q failed: %s", id, twr.Message) - default: - return false, nil - } - }) - return wr, err -} - -// CreateAndAwaitLoadBalancer creates a load balancer and blocks until data is -// available or timeout is reached. -func (c *client) CreateAndAwaitLoadBalancer(name, shape string, subnets []string, internal bool) (*baremetal.LoadBalancer, error) { - opts := &baremetal.CreateLoadBalancerOptions{ - DisplayNameOptions: baremetal.DisplayNameOptions{ - DisplayName: name, - }, - IsPrivate: internal, - } - - req, err := c.CreateLoadBalancer(nil, nil, c.compartmentID, nil, shape, subnets, opts) - if err != nil { - return nil, err - } - - result, err := c.AwaitWorkRequest(req) - if err != nil { - return nil, err - } - - return c.GetLoadBalancer(result.LoadBalancerID, &baremetal.ClientRequestOptions{}) -} - -// GetLoadBalancerByName fetches a load balancer by its DisplayName. -func (c *client) GetLoadBalancerByName(name string) (*baremetal.LoadBalancer, error) { - opts := &baremetal.ListOptions{} - for { - r, err := c.ListLoadBalancers(c.compartmentID, opts) - if err != nil { - return nil, err - } - for _, lb := range r.LoadBalancers { - if lb.DisplayName == name { - return &lb, nil - } - } - if hasNexPage := SetNextPageOption(r.NextPage, &opts.PageListOptions); !hasNexPage { - break - } - } - - return nil, NewNotFoundError(fmt.Sprintf("could not find load balancer with name '%s'", name)) -} - -// GetCertificateByName gets a certificate by its name. -func (c *client) GetCertificateByName(lbID, name string) (*baremetal.Certificate, error) { - opts := &baremetal.ClientRequestOptions{} - r, err := c.ListCertificates(lbID, opts) - if err != nil { - return nil, err - } - - for _, cert := range r.Certificates { - if cert.CertificateName == name { - return &cert, nil - } - } - - return nil, NewNotFoundError(fmt.Sprintf("certificate with name %q for load balancer %q not found", name, lbID)) -} - -// CreateAndAwaitBackendSet creates the given BackendSet for the given -// LoadBalancer. -func (c *client) CreateAndAwaitBackendSet(lb *baremetal.LoadBalancer, bs baremetal.BackendSet) (*baremetal.BackendSet, error) { - glog.V(2).Infof("Creating BackendSet `%s` for load balancer `%s`", bs.Name, lb.DisplayName) - wr, err := c.CreateBackendSet( - lb.ID, - bs.Name, - bs.Policy, - bs.Backends, - bs.HealthChecker, - bs.SSLConfig, - bs.SessionPersistenceConfig, - nil) - if err != nil { - return nil, err - } - - _, err = c.AwaitWorkRequest(wr) - if err != nil { - return nil, err - } - - return c.GetBackendSet(lb.ID, bs.Name, &baremetal.ClientRequestOptions{}) -} - -// CreateAndAwaitListener creates the given Listener for the given LoadBalancer. -func (c *client) CreateAndAwaitListener(lb *baremetal.LoadBalancer, listener baremetal.Listener) error { - glog.V(2).Infof("Creating Listener `%s` for load balancer `%s`", listener.Name, lb.DisplayName) - wr, err := c.CreateListener( - lb.ID, - listener.Name, - listener.DefaultBackendSetName, - listener.Protocol, - listener.Port, - listener.SSLConfig, - nil) - if err != nil { - return err - } - _, err = c.AwaitWorkRequest(wr) - if err != nil { - return err - } - return nil -} - -// CreateAndAwaitCertificate creates a certificate for the given LoadBalancer. -func (c *client) CreateAndAwaitCertificate(lb *baremetal.LoadBalancer, name string, certificate string, key string) error { - glog.V(4).Infof("Creating Certificate '%s' for load balancer '%s'", name, lb.DisplayName) - wr, err := c.CreateCertificate(lb.ID, name, "", key, "", certificate, nil) - if err != nil { - return err - } - _, err = c.AwaitWorkRequest(wr) - if err != nil { - return err - } - return nil -} - -// getSubnetFromCacheByIP checks to see if the given IP is contained by any subnet CIDR block in the subnet cache -// If no hits were found then no subnet and no error will be returned (nil, nil) -func (c *client) getSubnetFromCacheByIP(ip string) (*baremetal.Subnet, error) { - ipAddr := net.ParseIP(ip) - for _, subnetItem := range c.subnetCache.List() { - subnet := subnetItem.(*baremetal.Subnet) - _, cidr, err := net.ParseCIDR(subnet.CIDRBlock) - if err != nil { - // This should never actually error but just in case - return nil, fmt.Errorf("unable to parse CIDR block %q for subnet %q: %v", subnet.CIDRBlock, subnet.ID, err) - } - - if cidr.Contains(ipAddr) { - return subnet, nil - } - } - return nil, nil -} - -// GetSubnetsForNodes returns the deduplicated subnets in which the given -// internal IP addresses reside. -func (c *client) GetSubnetsForNodes(nodes []*api.Node) ([]*baremetal.Subnet, error) { - subnetOCIDs := sets.NewString() - var subnets []*baremetal.Subnet - - ipSet := sets.NewString() - for _, node := range nodes { - ipSet.Insert(util.NodeInternalIP(node)) - } - - for _, node := range nodes { - // First see if the ip of the node belongs to a subnet in the cache - ip := util.NodeInternalIP(node) - subnet, err := c.getSubnetFromCacheByIP(ip) - if err != nil { - return nil, err - } - if subnet != nil { - // cache hit - if !subnetOCIDs.Has(subnet.ID) { - subnetOCIDs.Insert(subnet.ID) - subnets = append(subnets, subnet) - } - // Since we got a cache hit we don't need to do the expensive query to find the subnet - continue - } + vcnID string - id := util.MapProviderIDToInstanceID(node.Spec.ProviderID) - vnics, err := c.GetAttachedVnicsForInstance(id) - if err != nil { - glog.Errorf("Unable to get vnics for instance %q: %v", id, err) - return nil, err - } - - for _, vnic := range vnics { - if vnic.PrivateIPAddress != "" && ipSet.Has(vnic.PrivateIPAddress) && - !subnetOCIDs.Has(vnic.SubnetID) { - subnet, err := c.GetSubnet(vnic.SubnetID) - if err != nil { - glog.Errorf("Unable to get subnet %q for instance %q: %v", vnic.SubnetID, id, err) - return nil, err - } - - subnets = append(subnets, subnet) - subnetOCIDs.Insert(vnic.SubnetID) - } - } - } - - return subnets, nil + subnetCache cache.Store } -// GetSubnet returns the subnet for the given ocid from either the cache -// or the API. If there is a cache miss the subnet will be added to the cache. -func (c *client) GetSubnet(id string) (*baremetal.Subnet, error) { - item, exists, err := c.subnetCache.GetByKey(id) +// New constructs an OCI API client. +func New(config *Config) (Interface, error) { + cp := common.NewRawConfigurationProvider( + config.Auth.TenancyOCID, + config.Auth.UserOCID, + config.Auth.Region, + config.Auth.Fingerprint, + config.Auth.PrivateKey, + &config.Auth.PrivateKeyPassphrase, + ) + compute, err := core.NewComputeClientWithConfigurationProvider(cp) if err != nil { - return nil, err - } - if exists { - return item.(*baremetal.Subnet), nil + return nil, errors.Wrap(err, "NewComputeClientWithConfigurationProvider") } - subnet, err := c.Client.GetSubnet(id) + network, err := core.NewVirtualNetworkClientWithConfigurationProvider(cp) if err != nil { - return nil, err - } - - c.subnetCache.Add(subnet) - return subnet, err -} - -// GetSubnets returns the Subnets corresponding to the given OCIDs. -func (c *client) GetSubnets(ocids []string) ([]*baremetal.Subnet, error) { - var subnets []*baremetal.Subnet - for _, ocid := range ocids { - subnet, err := c.GetSubnet(ocid) - if err != nil { - return nil, err - } - subnets = append(subnets, subnet) + return nil, errors.Wrap(err, "NewVirtualNetworkClientWithConfigurationProvider") } - return subnets, nil -} -// GetSecurityList returns the security list for the given ocid from either the cache -// or the API. If there is a cache miss the security list will be added to the cache. -func (c *client) GetSecurityList(id string) (*baremetal.SecurityList, error) { - // Since we do leader election, the CCM leader should be the only CCM updating the security list. - item, exists, err := c.securityListCache.GetByKey(id) + lb, err := loadbalancer.NewLoadBalancerClientWithConfigurationProvider(cp) if err != nil { - return nil, err - } - if exists { - secList := item.(*baremetal.SecurityList) - return secList, nil + return nil, errors.Wrap(err, "NewLoadBalancerClientWithConfigurationProvider") } - secList, err := c.Client.GetSecurityList(id) - if err != nil { - return nil, err - } + c := &client{ + config: config, - c.securityListCache.Add(secList) - return secList, err -} + compute: &compute, + network: &network, + loadbalancer: &lb, -func (c *client) UpdateSecurityList(id string, opts *baremetal.UpdateSecurityListOptions) (*baremetal.SecurityList, error) { - sl, err := c.Client.UpdateSecurityList(id, opts) - if IsConflict(err) { - secList, getErr := c.Client.GetSecurityList(id) - if getErr != nil { - return nil, fmt.Errorf("unable to get sec list %q after conflict: %v", id, getErr) - } - c.securityListCache.Add(secList) - return nil, err - } - if err != nil { - return nil, err + subnetCache: cache.NewTTLStore(subnetCacheKeyFn, time.Duration(24)*time.Hour), } - c.securityListCache.Add(sl) - return sl, nil -} - -// GetDefaultSecurityList gets the default SecurityList for the given Subnet by -// assuming that the default SecurityList is always the oldest (as it is created -// automatically when the Subnet is created and cannot be deleted). -func (c *client) GetDefaultSecurityList(subnet *baremetal.Subnet) (*baremetal.SecurityList, error) { - var lists []*baremetal.SecurityList - for _, id := range subnet.SecurityListIDs { - list, err := c.GetSecurityList(id) + vcnID := config.VCNID + if vcnID == "" { + glog.Infof("No vcn provided in cloud provider config. Falling back to looking up VCN via LB subnet.") + subnet, err := c.GetSubnet(context.Background(), config.LoadBalancer.Subnet1) if err != nil { - return nil, err + return nil, errors.Wrap(err, "get subnet for loadBalancer.subnet1") } - lists = append(lists, list) - } - - if len(lists) < 1 { - return nil, NewNotFoundError(fmt.Sprintf("no SecurityLists found for Subnet '%s'", subnet.ID)) + vcnID = *subnet.VcnId } + c.vcnID = vcnID - sort.Slice(lists, func(i, j int) bool { - return lists[i].TimeCreated.Before(lists[j].TimeCreated.Time) - }) - return lists[0], nil + return c, nil } -// extractNodeAddressesFromVNIC extracts Kuberenetes NodeAddresses from a given -// Vnic. -func extractNodeAddressesFromVNIC(vnic *baremetal.Vnic) ([]api.NodeAddress, error) { - glog.V(4).Infof("extractNodeAddressesFromVNIC() called for %q", vnic.ID) - if vnic == nil { - return nil, fmt.Errorf("nil VNIC passed to extractNodeAddressesFromVNIC()") - } - - addresses := []api.NodeAddress{} - - ip := net.ParseIP(vnic.PrivateIPAddress) - if vnic.PrivateIPAddress != "" { - if ip == nil { - return nil, fmt.Errorf("instance has invalid private address: %q", vnic.PrivateIPAddress) - } - addresses = append(addresses, api.NodeAddress{Type: api.NodeInternalIP, Address: ip.String()}) - } - - if vnic.PublicIPAddress != "" { - ip = net.ParseIP(vnic.PublicIPAddress) - if ip == nil { - return nil, fmt.Errorf("instance has invalid public address: %q", vnic.PublicIPAddress) - } - addresses = append(addresses, api.NodeAddress{Type: api.NodeExternalIP, Address: ip.String()}) - } - - glog.V(4).Infof("NodeAddresses: %+v ", addresses) - - return addresses, nil +func (c *client) LoadBalancer() LoadBalancerInterface { + return c } -func subnetCacheKeyFn(obj interface{}) (string, error) { - return obj.(*baremetal.Subnet).ID, nil +func (c *client) Networking() NetworkingInterface { + return c } -func securityListKeyFn(obj interface{}) (string, error) { - return obj.(*baremetal.SecurityList).ID, nil +func (c *client) Compute() ComputeInterface { + return c } diff --git a/pkg/oci/client/client_test.go b/pkg/oci/client/client_test.go index f7f56f5c14..34572def61 100644 --- a/pkg/oci/client/client_test.go +++ b/pkg/oci/client/client_test.go @@ -1,4 +1,4 @@ -// Copyright 2017 Oracle and/or its affiliates. All rights reserved. +// Copyright 2018 Oracle and/or its affiliates. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,46 +15,38 @@ package client import ( - "errors" - "reflect" "testing" - baremetal "github.com/oracle/bmcs-go-sdk" - - api "k8s.io/api/core/v1" + "github.com/oracle/oci-go-sdk/core" ) func TestInstanceTerminalState(t *testing.T) { testCases := map[string]struct { - state string + state core.InstanceLifecycleStateEnum expected bool }{ "not terminal - running": { - state: baremetal.ResourceRunning, + state: core.InstanceLifecycleStateRunning, expected: false, }, "not terminal - stopped": { - state: baremetal.ResourceStopped, + state: core.InstanceLifecycleStateStopped, expected: false, }, "is terminal - terminating": { - state: baremetal.ResourceTerminating, + state: core.InstanceLifecycleStateTerminating, expected: true, }, "is terminal - terminated": { - state: baremetal.ResourceTerminated, - expected: true, - }, - "is terminal - unknown": { - state: "UNKNOWN", + state: core.InstanceLifecycleStateTerminated, expected: true, }, } for name, tc := range testCases { t.Run(name, func(t *testing.T) { - result := IsInstanceInTerminalState(&baremetal.Instance{ - State: tc.state, + result := IsInstanceInTerminalState(&core.Instance{ + LifecycleState: tc.state, }) if result != tc.expected { t.Errorf("IsInstanceInTerminalState(%q) = %v ; wanted %v", tc.state, result, tc.expected) @@ -62,73 +54,3 @@ func TestInstanceTerminalState(t *testing.T) { }) } } - -func TestExtractNodeAddressesFromVNIC(t *testing.T) { - testCases := []struct { - name string - in *baremetal.Vnic - out []api.NodeAddress - err error - }{ - { - name: "basic-complete", - in: &baremetal.Vnic{ - PrivateIPAddress: "10.0.0.1", - PublicIPAddress: "0.0.0.1", - }, - out: []api.NodeAddress{ - api.NodeAddress{Type: api.NodeInternalIP, Address: "10.0.0.1"}, - api.NodeAddress{Type: api.NodeExternalIP, Address: "0.0.0.1"}, - }, - err: nil, - }, - { - name: "no-external-ip", - in: &baremetal.Vnic{ - PrivateIPAddress: "10.0.0.1", - }, - out: []api.NodeAddress{ - api.NodeAddress{Type: api.NodeInternalIP, Address: "10.0.0.1"}, - }, - err: nil, - }, - { - name: "no-internal-ip", - in: &baremetal.Vnic{ - PublicIPAddress: "0.0.0.1", - }, - out: []api.NodeAddress{ - api.NodeAddress{Type: api.NodeExternalIP, Address: "0.0.0.1"}, - }, - err: nil, - }, - { - name: "invalid-external-ip", - in: &baremetal.Vnic{ - PublicIPAddress: "0.0.0.", - }, - out: nil, - err: errors.New(`instance has invalid public address: "0.0.0."`), - }, - { - name: "invalid-external-ip", - in: &baremetal.Vnic{ - PrivateIPAddress: "10.0.0.", - }, - out: nil, - err: errors.New(`instance has invalid private address: "10.0.0."`), - }, - } - - for _, tt := range testCases { - t.Run(tt.name, func(t *testing.T) { - result, err := extractNodeAddressesFromVNIC(tt.in) - if err != nil && err.Error() != tt.err.Error() { - t.Errorf("extractNodeAddressesFromVNIC(%+v) got error %v, expected %v", tt.in, err, tt.err) - } - if !reflect.DeepEqual(result, tt.out) { - t.Errorf("extractNodeAddressesFromVNIC(%+v) => %+v, want %+v", tt.in, result, tt.out) - } - }) - } -} diff --git a/pkg/oci/client/compute.go b/pkg/oci/client/compute.go new file mode 100644 index 0000000000..2bbb936608 --- /dev/null +++ b/pkg/oci/client/compute.go @@ -0,0 +1,216 @@ +// Copyright 2018 Oracle and/or its affiliates. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + "strings" + + "github.com/golang/glog" + "github.com/oracle/oci-go-sdk/core" + "github.com/pkg/errors" +) + +// ComputeInterface defines the subset of the OCI compute API utilised by the CCM. +type ComputeInterface interface { + // GetInstance gets information about the specified instance. + GetInstance(ctx context.Context, id string) (*core.Instance, error) + // GetInstanceByNodeName gets the OCI instance corresponding to the given + // Kubernetes node name. + GetInstanceByNodeName(ctx context.Context, nodeName string) (*core.Instance, error) + + GetPrimaryVNICForInstance(ctx context.Context, instanceID string) (*core.Vnic, error) +} + +func (c *client) GetInstance(ctx context.Context, id string) (*core.Instance, error) { + resp, err := c.compute.GetInstance(ctx, core.GetInstanceRequest{ + InstanceId: &id, + }) + incRequestCounter(err, getVerb, instanceResource) + + if err != nil { + return nil, errors.WithStack(err) + } + + return &resp.Instance, nil +} + +func (c *client) getInstanceByDisplayName(ctx context.Context, displayName string) (*core.Instance, error) { + var ( + page *string + instances []core.Instance + ) + for { + resp, err := c.compute.ListInstances(ctx, core.ListInstancesRequest{ + CompartmentId: &c.config.Auth.CompartmentOCID, + DisplayName: &displayName, + Page: page, + }) + incRequestCounter(err, listVerb, instanceResource) + + if err != nil { + return nil, errors.WithStack(err) + } + + instances = append(instances, getNonTerminalInstances(resp.Items)...) + if page = resp.OpcNextPage; resp.OpcNextPage == nil { + break + } + + } + + if len(instances) == 0 { + return nil, errors.WithStack(errNotFound) + } + if len(instances) > 1 { + return nil, errors.Errorf("too many instances returned for display name %q: %d", displayName, len(instances)) + } + return &instances[0], nil +} + +func (c *client) listVNICAttachments(ctx context.Context, req core.ListVnicAttachmentsRequest) (core.ListVnicAttachmentsResponse, error) { + resp, err := c.compute.ListVnicAttachments(ctx, req) + incRequestCounter(err, listVerb, vnicAttachmentResource) + + if err != nil { + return resp, errors.WithStack(err) + } + + return resp, nil +} + +func (c *client) GetPrimaryVNICForInstance(ctx context.Context, instanceID string) (*core.Vnic, error) { + var page *string + for { + resp, err := c.listVNICAttachments(ctx, core.ListVnicAttachmentsRequest{ + InstanceId: &instanceID, + CompartmentId: &c.config.Auth.CompartmentOCID, + Page: page, + }) + + if err != nil { + return nil, err + } + + for _, attachment := range resp.Items { + if attachment.LifecycleState != core.VnicAttachmentLifecycleStateAttached { + glog.Infof("VNIC attachment %q for instance %q has a state of %q (not %q)", + *attachment.Id, instanceID, attachment.LifecycleState, core.VnicAttachmentLifecycleStateAttached) + continue + } + + // TODO(apryde): Cache map[instanceID]primaryVNICID. + vnic, err := c.getVNIC(ctx, *attachment.VnicId) + if err != nil { + return nil, err + } + if *vnic.IsPrimary { + return vnic, nil + } + } + + if page = resp.OpcNextPage; resp.OpcNextPage == nil { + break + } + } + + return nil, errors.WithStack(errNotFound) +} + +func (c *client) GetInstanceByNodeName(ctx context.Context, nodeName string) (*core.Instance, error) { + // First try lookup by display name. + instance, err := c.getInstanceByDisplayName(ctx, nodeName) + if err == nil { + return instance, nil + } + + // Otherwise fall back to looking up via VNiC properties (hostname or public IP). + var ( + page *string + instances []*core.Instance + ) + for { + resp, err := c.listVNICAttachments(ctx, core.ListVnicAttachmentsRequest{ + CompartmentId: &c.config.Auth.CompartmentOCID, + Page: page, + }) + if err != nil { + return nil, errors.WithStack(err) + } + + for _, attachment := range resp.Items { + if attachment.LifecycleState != core.VnicAttachmentLifecycleStateAttached { + glog.Infof("VNIC attachment %q for instance %q has a life cycle state of %q (not %q)", + *attachment.Id, nodeName, attachment.LifecycleState, core.VnicAttachmentLifecycleStateAttached) + continue + } + + vnic, err := c.getVNIC(ctx, *attachment.VnicId) + if err != nil { + return nil, err + } + + // Skip VNICs that aren't attached to the cluster's VCN. + subnet, err := c.GetSubnet(ctx, *vnic.SubnetId) + if err != nil { + return nil, err + } + if *subnet.VcnId != c.vcnID { + continue + } + + if *vnic.PublicIp == nodeName || (*vnic.HostnameLabel != "" && strings.HasPrefix(nodeName, *vnic.HostnameLabel)) { + instance, err := c.GetInstance(ctx, *attachment.InstanceId) + if err != nil { + return nil, err + } + + if IsInstanceInTerminalState(instance) { + glog.Warningf("Instance %q is in state %q which is a terminal state", instance.Id, instance.LifecycleState) + continue + } + + instances = append(instances, instance) + } + } + if page = resp.OpcNextPage; resp.OpcNextPage == nil { + break + } + } + + if len(instances) == 0 { + return nil, errors.WithStack(errNotFound) + } + if len(instances) > 1 { + return nil, errors.Errorf("too many instances returned for node name %q: %d", nodeName, len(instances)) + } + return instances[0], nil +} + +// IsInstanceInTerminalState returns true if the instance is in a terminal state, false otherwise. +func IsInstanceInTerminalState(instance *core.Instance) bool { + return instance.LifecycleState == core.InstanceLifecycleStateTerminated || + instance.LifecycleState == core.InstanceLifecycleStateTerminating +} + +func getNonTerminalInstances(instances []core.Instance) []core.Instance { + var result []core.Instance + for _, instance := range instances { + if !IsInstanceInTerminalState(&instance) { + result = append(result, instance) + } + } + return result +} diff --git a/pkg/oci/client/error.go b/pkg/oci/client/error.go deleted file mode 100644 index a9e4f3926c..0000000000 --- a/pkg/oci/client/error.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2017 Oracle and/or its affiliates. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import ( - baremetal "github.com/oracle/bmcs-go-sdk" -) - -const ( - notFoundStatus = "404" -) - -// NewNotFoundError creates a new baremetal error with the correct -// status and code. The message of the error is set to the message passed in. -func NewNotFoundError(msg string) error { - return &baremetal.Error{ - Status: notFoundStatus, - Code: baremetal.NotAuthorizedOrNotFound, - Message: msg, - } -} - -// IsConflict checks if the error is due to a conflict caused by etag mismatch. -func IsConflict(err error) bool { - // TODO(horwitz): This is supposed to be fixed soon. It's a bug in the OCI API that causes a 409 to - // be returned instead of a 412. - return IsError(err, "409", "Conflict") || IsError(err, "412", "NoEtagMatch") -} - -// IsNotFound checks if the error is the not found error returned from OCI. -func IsNotFound(err error) bool { - return IsStatus(err, notFoundStatus) -} - -// IsError checks that the error is an OCI error and that the status & code match. -// https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm -func IsError(err error, status string, code string) bool { - return IsStatus(err, status) && IsCode(err, code) -} - -// IsStatus is a helper function that ensures the error is an OCI -// client error and that the status is what is expected. -// https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm -func IsStatus(err error, status string) bool { - ociErr, ok := err.(*baremetal.Error) - return ok && ociErr.Status == status -} - -// IsCode ensures that the error is an OCI error and that the code matches. -// https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm -func IsCode(err error, code string) bool { - ociErr, ok := err.(*baremetal.Error) - return ok && ociErr.Code == code -} diff --git a/pkg/oci/client/error_test.go b/pkg/oci/client/error_test.go deleted file mode 100644 index 291da164a0..0000000000 --- a/pkg/oci/client/error_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2017 Oracle and/or its affiliates. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import ( - "errors" - "testing" - - baremetal "github.com/oracle/bmcs-go-sdk" -) - -func TestIsNotFound(t *testing.T) { - testCases := []struct { - name string - err error - expected bool - }{ - { - name: "api-not-found", - err: NewNotFoundError("it was not found :("), - expected: true, - }, - { - name: "random-api-error", - err: &baremetal.Error{ - Status: "500", - Code: "500", - Message: "unrelated internal server error", - }, - expected: false, - }, - { - name: "generic-error", - err: errors.New("something erroneous"), - expected: false, - }, - } - - for _, tt := range testCases { - t.Run(tt.name, func(t *testing.T) { - isNotFoundErr := IsNotFound(tt.err) - if isNotFoundErr != tt.expected { - t.Errorf("IsNotFound(%+v) => %t, wanted %t", tt.err, isNotFoundErr, tt.expected) - } - }) - } -} diff --git a/pkg/oci/client/errors.go b/pkg/oci/client/errors.go new file mode 100644 index 0000000000..c241f259b0 --- /dev/null +++ b/pkg/oci/client/errors.go @@ -0,0 +1,51 @@ +// Copyright 2018 Oracle and/or its affiliates. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "net/http" + + "github.com/oracle/oci-go-sdk/common" + "github.com/pkg/errors" +) + +var errNotFound = errors.New("not found") + +// IsNotFound returns true if the given error indicates that a resource could +// not be found. +func IsNotFound(err error) bool { + if err == nil { + return false + } + + err = errors.Cause(err) + if err == errNotFound { + return true + } + + serviceErr, ok := common.IsServiceError(err) + return ok && serviceErr.GetHTTPStatusCode() == http.StatusNotFound +} + +// IsRetryable returns true if the given error is retriable. +func IsRetryable(err error) bool { + if err == nil { + return false + } + + err = errors.Cause(err) + serviceErr, ok := common.IsServiceError(err) + return ok && serviceErr.GetHTTPStatusCode() == http.StatusTooManyRequests +} diff --git a/pkg/oci/client/fake.go b/pkg/oci/client/fake.go deleted file mode 100644 index 6df38724b7..0000000000 --- a/pkg/oci/client/fake.go +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2017 Oracle and/or its affiliates. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import ( - api "k8s.io/api/core/v1" - - baremetal "github.com/oracle/bmcs-go-sdk" -) - -var _ Interface = &FakeClient{} - -// FakeClient that should be used for testing. -type FakeClient struct { - Err error - Calls []string - DefaultSecurityLists map[string]*baremetal.SecurityList -} - -// NewFakeClient creates a new fake client for testing. -func NewFakeClient() *FakeClient { - return &FakeClient{ - Calls: []string{}, - DefaultSecurityLists: make(map[string]*baremetal.SecurityList), - } -} - -func (f *FakeClient) call(s string) { - f.Calls = append(f.Calls, s) -} - -// Compartment fake -func (f *FakeClient) Compartment(id string) Interface { - f.call("compartment") - return nil -} - -// LaunchInstance fake -func (f *FakeClient) LaunchInstance( - availabilityDomain, - compartmentID, - image, - shape, - subnetID string, - opts *baremetal.LaunchInstanceOptions) (*baremetal.Instance, error) { - f.call("launch-instance") - return nil, f.Err -} - -// TerminateInstance fake -func (f *FakeClient) TerminateInstance(id string, opts *baremetal.IfMatchOptions) error { - f.call("terminate-instance") - return f.Err -} - -// GetSubnets fake -func (f *FakeClient) GetSubnets(ids []string) ([]*baremetal.Subnet, error) { - f.call("get-subnets") - return nil, f.Err -} - -// GetInstanceByNodeName fake -func (f *FakeClient) GetInstanceByNodeName(name string) (*baremetal.Instance, error) { - f.call("get-instance-by-node-name") - return nil, f.Err -} - -// GetNodeAddressesForInstance fake -func (f *FakeClient) GetNodeAddressesForInstance(id string) ([]api.NodeAddress, error) { - f.call("get-node-addresses-for-instance") - return nil, f.Err -} - -// GetAttachedVnicsForInstance fake -func (f *FakeClient) GetAttachedVnicsForInstance(id string) ([]*baremetal.Vnic, error) { - f.call("get-attached-vnics-for-instance") - return nil, f.Err -} - -// CreateAndAwaitLoadBalancer fake -func (f *FakeClient) CreateAndAwaitLoadBalancer(name, shape string, subnets []string, internal bool) (*baremetal.LoadBalancer, error) { - f.call("create-and-await-load-balancer") - return nil, f.Err -} - -// GetLoadBalancerByName fake -func (f *FakeClient) GetLoadBalancerByName(name string) (*baremetal.LoadBalancer, error) { - f.call("get-load-balancer-by-name") - return nil, f.Err -} - -// GetCertificateByName fake -func (f *FakeClient) GetCertificateByName(loadBalancerID string, name string) (*baremetal.Certificate, error) { - f.call("get-certificate-by-name") - return nil, f.Err -} - -// CreateAndAwaitBackendSet fake -func (f *FakeClient) CreateAndAwaitBackendSet(lb *baremetal.LoadBalancer, bs baremetal.BackendSet) (*baremetal.BackendSet, error) { - f.call("create-and-await-backend-set") - return nil, f.Err -} - -// CreateAndAwaitListener fake -func (f *FakeClient) CreateAndAwaitListener(lb *baremetal.LoadBalancer, listener baremetal.Listener) error { - f.call("create-and-await-listener") - return f.Err -} - -// CreateAndAwaitCertificate fake -func (f *FakeClient) CreateAndAwaitCertificate(lb *baremetal.LoadBalancer, name string, certificate string, key string) error { - f.call("create-and-await-certificate") - return f.Err -} - -// AwaitWorkRequest fake -func (f *FakeClient) AwaitWorkRequest(id string) (*baremetal.WorkRequest, error) { - f.call("await-work-request") - return nil, f.Err -} - -// GetSubnetsForNodes fake -func (f *FakeClient) GetSubnetsForNodes(nodes []*api.Node) ([]*baremetal.Subnet, error) { - f.call("get-subnets-for-nodes") - return nil, f.Err -} - -// GetDefaultSecurityList fake -func (f *FakeClient) GetDefaultSecurityList(subnet *baremetal.Subnet) (*baremetal.SecurityList, error) { - f.call("get-default-security-list") - for _, id := range subnet.SecurityListIDs { - secList, ok := f.DefaultSecurityLists[id] - if ok { - return secList, nil - } - } - return nil, f.Err -} - -// Validate returns nil -func (f *FakeClient) Validate() error { - f.call("validate") - return f.Err -} - -// GetInstance fake -func (f *FakeClient) GetInstance(id string) (*baremetal.Instance, error) { - f.call("get-instance") - return nil, f.Err -} - -// GetSubnet fake -func (f *FakeClient) GetSubnet(ocid string) (*baremetal.Subnet, error) { - f.call("get-subnet") - return nil, f.Err -} - -// UpdateSecurityList fake -func (f *FakeClient) UpdateSecurityList(id string, opts *baremetal.UpdateSecurityListOptions) (*baremetal.SecurityList, error) { - f.call("update-security-list") - return nil, f.Err -} - -//CreateBackendSet fake -func (f *FakeClient) CreateBackendSet( - loadBalancerID string, - name string, - policy string, - backends []baremetal.Backend, - healthChecker *baremetal.HealthChecker, - sslConfig *baremetal.SSLConfiguration, - sessionPersistenceConfig *baremetal.SessionPersistenceConfiguration, - opts *baremetal.LoadBalancerOptions, -) (workRequestID string, e error) { - f.call("create-backend-set") - return "", f.Err -} - -// UpdateBackendSet fake -func (f *FakeClient) UpdateBackendSet(loadBalancerID string, backendSetName string, opts *baremetal.UpdateLoadBalancerBackendSetOptions) (workRequestID string, e error) { - f.call("update-backend-set") - return "", f.Err -} - -// DeleteBackendSet fake -func (f *FakeClient) DeleteBackendSet(loadBalancerID string, backendSetName string, opts *baremetal.ClientRequestOptions) (string, error) { - f.call("delete-backend-set") - return "", f.Err -} - -// CreateListener fake -func (f *FakeClient) CreateListener( - loadBalancerID string, - name string, - defaultBackendSetName string, - protocol string, - port int, - sslConfig *baremetal.SSLConfiguration, - opts *baremetal.LoadBalancerOptions, -) (workRequestID string, e error) { - f.call("create-listener") - return "", f.Err -} - -// UpdateListener fake -func (f *FakeClient) UpdateListener(loadBalancerID string, listenerName string, opts *baremetal.UpdateLoadBalancerListenerOptions) (workRequestID string, e error) { - f.call("update-listener") - return "", f.Err -} - -// DeleteListener fake -func (f *FakeClient) DeleteListener(loadBalancerID string, listenerName string, opts *baremetal.ClientRequestOptions) (workRequestID string, e error) { - f.call("delete-listener") - return "", f.Err -} - -// DeleteLoadBalancer fake -func (f *FakeClient) DeleteLoadBalancer(id string, opts *baremetal.ClientRequestOptions) (string, error) { - f.call("delete-load-balancer") - return "", f.Err -} diff --git a/pkg/oci/client/load_balancer.go b/pkg/oci/client/load_balancer.go new file mode 100644 index 0000000000..b636df5dc4 --- /dev/null +++ b/pkg/oci/client/load_balancer.go @@ -0,0 +1,295 @@ +// Copyright 2018 Oracle and/or its affiliates. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + "time" + + "k8s.io/apimachinery/pkg/util/wait" + + "github.com/oracle/oci-go-sdk/loadbalancer" + "github.com/pkg/errors" +) + +const workRequestPollInterval = 5 * time.Second + +// LoadBalancerInterface for consumed LB functionality. +type LoadBalancerInterface interface { + CreateLoadBalancer(ctx context.Context, details loadbalancer.CreateLoadBalancerDetails) (string, error) + GetLoadBalancer(ctx context.Context, id string) (*loadbalancer.LoadBalancer, error) + GetLoadBalancerByName(ctx context.Context, name string) (*loadbalancer.LoadBalancer, error) + DeleteLoadBalancer(ctx context.Context, id string) (string, error) + + GetCertificateByName(ctx context.Context, lbID, name string) (*loadbalancer.Certificate, error) + CreateCertificate(ctx context.Context, lbID, certificate, key string) (string, error) + + CreateBackendSet(ctx context.Context, lbID, name string, details loadbalancer.BackendSetDetails) (string, error) + UpdateBackendSet(ctx context.Context, lbID, name string, details loadbalancer.BackendSetDetails) (string, error) + DeleteBackendSet(ctx context.Context, lbID, name string) (string, error) + + UpdateListener(ctx context.Context, lbID, name string, details loadbalancer.ListenerDetails) (string, error) + CreateListener(ctx context.Context, lbID, name string, details loadbalancer.ListenerDetails) (string, error) + DeleteListener(ctx context.Context, lbID, name string) (string, error) + + AwaitWorkRequest(ctx context.Context, id string) (*loadbalancer.WorkRequest, error) +} + +func (c *client) GetLoadBalancer(ctx context.Context, id string) (*loadbalancer.LoadBalancer, error) { + resp, err := c.loadbalancer.GetLoadBalancer(ctx, loadbalancer.GetLoadBalancerRequest{ + LoadBalancerId: &id, + }) + incRequestCounter(err, getVerb, loadBalancerResource) + + if err != nil { + return nil, errors.WithStack(err) + } + + return &resp.LoadBalancer, nil +} + +func (c *client) GetLoadBalancerByName(ctx context.Context, name string) (*loadbalancer.LoadBalancer, error) { + var page *string + for { + resp, err := c.loadbalancer.ListLoadBalancers(ctx, loadbalancer.ListLoadBalancersRequest{ + CompartmentId: &c.config.Auth.CompartmentOCID, + DisplayName: &name, + Page: page, + }) + incRequestCounter(err, listVerb, loadBalancerResource) + + if err != nil { + return nil, errors.WithStack(err) + } + for _, lb := range resp.Items { + if *lb.DisplayName == name { + return &lb, nil + } + } + if page = resp.OpcNextPage; page == nil { + break + } + } + + return nil, errors.WithStack(errNotFound) +} + +func (c *client) CreateLoadBalancer(ctx context.Context, details loadbalancer.CreateLoadBalancerDetails) (string, error) { + resp, err := c.loadbalancer.CreateLoadBalancer(ctx, loadbalancer.CreateLoadBalancerRequest{ + CreateLoadBalancerDetails: details, + }) + incRequestCounter(err, createVerb, loadBalancerResource) + + if err != nil { + return "", errors.WithStack(err) + } + + return *resp.OpcWorkRequestId, nil +} + +func (c *client) DeleteLoadBalancer(ctx context.Context, id string) (string, error) { + resp, err := c.loadbalancer.DeleteLoadBalancer(ctx, loadbalancer.DeleteLoadBalancerRequest{ + LoadBalancerId: &id, + }) + incRequestCounter(err, deleteVerb, loadBalancerResource) + + if err != nil { + return "", errors.WithStack(err) + } + + return *resp.OpcWorkRequestId, nil +} + +func (c *client) GetCertificateByName(ctx context.Context, lbID, name string) (*loadbalancer.Certificate, error) { + resp, err := c.loadbalancer.ListCertificates(ctx, loadbalancer.ListCertificatesRequest{ + LoadBalancerId: &lbID, + }) + incRequestCounter(err, listVerb, certificateResource) + + if err != nil { + return nil, errors.WithStack(err) + } + + for _, cert := range resp.Items { + if *cert.CertificateName == name { + return &cert, nil + } + } + return nil, errors.WithStack(errNotFound) +} + +func (c *client) CreateCertificate(ctx context.Context, lbID, certificate, key string) (string, error) { + // TODO(apryde): We currently don't have a mechanism for supplying + // CreateCertificateDetails.CaCertificate. + resp, err := c.loadbalancer.CreateCertificate(ctx, loadbalancer.CreateCertificateRequest{ + LoadBalancerId: &lbID, + CreateCertificateDetails: loadbalancer.CreateCertificateDetails{ + PublicCertificate: &certificate, + PrivateKey: &key, + }, + }) + incRequestCounter(err, createVerb, certificateResource) + + if err != nil { + return "", errors.WithStack(err) + } + + return *resp.OpcWorkRequestId, nil +} + +func (c *client) GetWorkRequest(ctx context.Context, id string) (*loadbalancer.WorkRequest, error) { + resp, err := c.loadbalancer.GetWorkRequest(ctx, loadbalancer.GetWorkRequestRequest{ + WorkRequestId: &id, + }) + incRequestCounter(err, getVerb, workRequestResource) + + if err != nil { + return nil, errors.WithStack(err) + } + + return &resp.WorkRequest, nil +} + +func (c *client) CreateBackendSet(ctx context.Context, lbID, name string, details loadbalancer.BackendSetDetails) (string, error) { + resp, err := c.loadbalancer.CreateBackendSet(ctx, loadbalancer.CreateBackendSetRequest{ + LoadBalancerId: &lbID, + CreateBackendSetDetails: loadbalancer.CreateBackendSetDetails{ + Name: &name, + Backends: details.Backends, + HealthChecker: details.HealthChecker, + Policy: details.Policy, + SessionPersistenceConfiguration: details.SessionPersistenceConfiguration, + SslConfiguration: details.SslConfiguration, + }, + }) + incRequestCounter(err, createVerb, backendSetResource) + + if err != nil { + return "", errors.WithStack(err) + } + + return *resp.OpcWorkRequestId, nil +} + +func (c *client) UpdateBackendSet(ctx context.Context, lbID, name string, details loadbalancer.BackendSetDetails) (string, error) { + resp, err := c.loadbalancer.UpdateBackendSet(ctx, loadbalancer.UpdateBackendSetRequest{ + LoadBalancerId: &lbID, + BackendSetName: &name, + UpdateBackendSetDetails: loadbalancer.UpdateBackendSetDetails{ + Backends: details.Backends, + HealthChecker: details.HealthChecker, + Policy: details.Policy, + SessionPersistenceConfiguration: details.SessionPersistenceConfiguration, + SslConfiguration: details.SslConfiguration, + }, + }) + incRequestCounter(err, updateVerb, backendSetResource) + + if err != nil { + return "", errors.WithStack(err) + } + + return *resp.OpcWorkRequestId, nil +} + +func (c *client) DeleteBackendSet(ctx context.Context, lbID, name string) (string, error) { + resp, err := c.loadbalancer.DeleteBackendSet(ctx, loadbalancer.DeleteBackendSetRequest{ + LoadBalancerId: &lbID, + BackendSetName: &name, + }) + incRequestCounter(err, deleteVerb, backendSetResource) + + if err != nil { + return "", errors.WithStack(err) + } + + return *resp.OpcWorkRequestId, nil +} + +func (c *client) CreateListener(ctx context.Context, lbID, name string, details loadbalancer.ListenerDetails) (string, error) { + resp, err := c.loadbalancer.CreateListener(ctx, loadbalancer.CreateListenerRequest{ + LoadBalancerId: &lbID, + CreateListenerDetails: loadbalancer.CreateListenerDetails{ + Name: &name, + DefaultBackendSetName: details.DefaultBackendSetName, + Port: details.Port, + Protocol: details.Protocol, + SslConfiguration: details.SslConfiguration, + }, + }) + incRequestCounter(err, createVerb, listenerResource) + + if err != nil { + return "", errors.WithStack(err) + } + + return *resp.OpcWorkRequestId, nil +} + +func (c *client) UpdateListener(ctx context.Context, lbID, name string, details loadbalancer.ListenerDetails) (string, error) { + resp, err := c.loadbalancer.UpdateListener(ctx, loadbalancer.UpdateListenerRequest{ + LoadBalancerId: &lbID, + ListenerName: &name, + UpdateListenerDetails: loadbalancer.UpdateListenerDetails{ + DefaultBackendSetName: details.DefaultBackendSetName, + Port: details.Port, + Protocol: details.Protocol, + SslConfiguration: details.SslConfiguration, + }, + }) + incRequestCounter(err, updateVerb, listenerResource) + + if err != nil { + return "", errors.WithStack(err) + } + + return *resp.OpcWorkRequestId, nil +} + +func (c *client) AwaitWorkRequest(ctx context.Context, id string) (*loadbalancer.WorkRequest, error) { + var wr *loadbalancer.WorkRequest + err := wait.PollUntil(workRequestPollInterval, func() (done bool, err error) { + twr, err := c.GetWorkRequest(ctx, id) + if err != nil { + if IsRetryable(err) { + return false, nil + } + return true, errors.WithStack(err) + } + switch twr.LifecycleState { + case loadbalancer.WorkRequestLifecycleStateSucceeded: + wr = twr + return true, nil + case loadbalancer.WorkRequestLifecycleStateFailed: + return false, errors.Errorf("WorkRequest %q failed: %s", id, twr.Message) + } + return false, nil + }, ctx.Done()) + return wr, err +} + +func (c *client) DeleteListener(ctx context.Context, lbID, name string) (string, error) { + resp, err := c.loadbalancer.DeleteListener(ctx, loadbalancer.DeleteListenerRequest{ + LoadBalancerId: &lbID, + ListenerName: &name, + }) + incRequestCounter(err, deleteVerb, listenerResource) + + if err != nil { + return "", errors.WithStack(err) + } + + return *resp.OpcWorkRequestId, nil +} diff --git a/pkg/oci/client/metrics.go b/pkg/oci/client/metrics.go new file mode 100644 index 0000000000..89125cd89a --- /dev/null +++ b/pkg/oci/client/metrics.go @@ -0,0 +1,78 @@ +// Copyright 2018 Oracle and/or its affiliates. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "strconv" + + "github.com/oracle/oci-go-sdk/common" + "github.com/prometheus/client_golang/prometheus" +) + +var ( + ociRequestCounter = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "oci_requests_total", + Help: "OCI API requests total.", + }, + []string{"resource", "code", "verb"}, + ) +) + +type resource string + +const ( + instanceResource resource = "instance" + vnicAttachmentResource resource = "vnic_attachment" + vnicResource resource = "vnic" + subnetResource resource = "subnet" + loadBalancerResource resource = "load_balancer" + backendSetResource resource = "load_balancer_backend_set" + listenerResource resource = "load_balancer_listener" + certificateResource resource = "load_balancer_certificate" + workRequestResource resource = "load_balancer_work_request" + securityListResource resource = "security_list" +) + +type verb string + +const ( + getVerb verb = "get" + listVerb verb = "list" + createVerb verb = "create" + updateVerb verb = "update" + deleteVerb verb = "delete" +) + +func incRequestCounter(err error, v verb, r resource) { + statusCode := 200 + if err != nil { + if serviceErr, ok := err.(common.ServiceError); ok { + statusCode = serviceErr.GetHTTPStatusCode() + } else { + statusCode = 555 // ¯\_(ツ)_/¯ + } + } + + ociRequestCounter.With(prometheus.Labels{ + "resource": string(r), + "verb": string(v), + "code": strconv.Itoa(statusCode), + }).Inc() +} + +func init() { + prometheus.MustRegister(ociRequestCounter) +} diff --git a/pkg/oci/client/networking.go b/pkg/oci/client/networking.go new file mode 100644 index 0000000000..70abd2d3da --- /dev/null +++ b/pkg/oci/client/networking.go @@ -0,0 +1,107 @@ +// Copyright 2018 Oracle and/or its affiliates. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + "fmt" + "net" + + "github.com/oracle/oci-go-sdk/core" + "github.com/pkg/errors" +) + +// NetworkingInterface defines the subset of the OCI compute API utilised by the CCM. +type NetworkingInterface interface { + GetSubnet(ctx context.Context, id string) (*core.Subnet, error) + GetSubnetFromCacheByIP(ip string) (*core.Subnet, error) + + GetSecurityList(ctx context.Context, id string) (core.GetSecurityListResponse, error) + UpdateSecurityList(ctx context.Context, request core.UpdateSecurityListRequest) (core.UpdateSecurityListResponse, error) +} + +func (c *client) getVNIC(ctx context.Context, id string) (*core.Vnic, error) { + resp, err := c.network.GetVnic(ctx, core.GetVnicRequest{ + VnicId: &id, + }) + incRequestCounter(err, getVerb, vnicResource) + + if err != nil { + return nil, errors.WithStack(err) + } + + return &resp.Vnic, nil +} + +func (c *client) GetSubnet(ctx context.Context, id string) (*core.Subnet, error) { + item, exists, err := c.subnetCache.GetByKey(id) + if err != nil { + return nil, errors.WithStack(err) + } + if exists { + return item.(*core.Subnet), nil + } + + resp, err := c.network.GetSubnet(ctx, core.GetSubnetRequest{ + SubnetId: &id, + }) + incRequestCounter(err, getVerb, subnetResource) + + if err != nil { + return nil, errors.WithStack(err) + } + + subnet := &resp.Subnet + _ = c.subnetCache.Add(subnet) + return subnet, nil +} + +// GetSubnetFromCacheByIP checks to see if the given IP is contained by any subnet CIDR block in the subnet cache +// If no hits were found then no subnet and no error will be returned (nil, nil) +func (c *client) GetSubnetFromCacheByIP(ip string) (*core.Subnet, error) { + ipAddr := net.ParseIP(ip) + for _, subnetItem := range c.subnetCache.List() { + subnet := subnetItem.(*core.Subnet) + _, cidr, err := net.ParseCIDR(*subnet.CidrBlock) + if err != nil { + // This should never actually error but just in case + return nil, fmt.Errorf("unable to parse CIDR block %q for subnet %q: %v", *subnet.CidrBlock, *subnet.Id, err) + } + + if cidr.Contains(ipAddr) { + return subnet, nil + } + } + return nil, nil +} + +func (c *client) GetSecurityList(ctx context.Context, id string) (core.GetSecurityListResponse, error) { + resp, err := c.network.GetSecurityList(ctx, core.GetSecurityListRequest{ + SecurityListId: &id, + }) + incRequestCounter(err, getVerb, securityListResource) + + return resp, errors.WithStack(err) +} + +func (c *client) UpdateSecurityList(ctx context.Context, request core.UpdateSecurityListRequest) (core.UpdateSecurityListResponse, error) { + resp, err := c.network.UpdateSecurityList(ctx, request) + incRequestCounter(err, updateVerb, securityListResource) + return resp, errors.WithStack(err) +} + +func subnetCacheKeyFn(obj interface{}) (string, error) { + return *obj.(*core.Subnet).Id, nil +} diff --git a/pkg/oci/client/util.go b/pkg/oci/client/util.go deleted file mode 100644 index 313592ac22..0000000000 --- a/pkg/oci/client/util.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 Oracle and/or its affiliates. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package client - -import baremetal "github.com/oracle/bmcs-go-sdk" - -// SetNextPageOption sets the next page option on a baremetal list page options -// struct and returns true if there are more pages to fetch. -func SetNextPageOption(nextPage string, opts *baremetal.PageListOptions) (hasNextPage bool) { - if nextPage == "" { - hasNextPage = false - } else { - hasNextPage = true - opts.Page = nextPage - } - - return -} diff --git a/pkg/oci/instances.go b/pkg/oci/instances.go index 42df906fd8..49c0e1b597 100644 --- a/pkg/oci/instances.go +++ b/pkg/oci/instances.go @@ -15,17 +15,21 @@ package oci import ( - "errors" + "context" "fmt" + "net" "strings" "github.com/golang/glog" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/util" + "github.com/oracle/oci-go-sdk/core" + "github.com/pkg/errors" api "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/cloudprovider" + types "k8s.io/apimachinery/pkg/types" + cloudprovider "k8s.io/kubernetes/pkg/cloudprovider" + + "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" + "github.com/oracle/oci-cloud-controller-manager/pkg/oci/util" ) var _ cloudprovider.Instances = &CloudProvider{} @@ -42,6 +46,31 @@ func mapInstanceNameToNodeName(displayName string) types.NodeName { return types.NodeName(strings.ToLower(displayName)) } +func extractNodeAddressesFromVNIC(vnic *core.Vnic) ([]api.NodeAddress, error) { + addresses := []api.NodeAddress{} + if vnic == nil { + return addresses, nil + } + + if vnic.PrivateIp != nil && *vnic.PrivateIp != "" { + ip := net.ParseIP(*vnic.PrivateIp) + if ip == nil { + return nil, fmt.Errorf("instance has invalid private address: %q", *vnic.PrivateIp) + } + addresses = append(addresses, api.NodeAddress{Type: api.NodeInternalIP, Address: ip.String()}) + } + + if vnic.PublicIp != nil && *vnic.PublicIp != "" { + ip := net.ParseIP(*vnic.PublicIp) + if ip == nil { + return nil, errors.Errorf("instance has invalid public address: %q", *vnic.PublicIp) + } + addresses = append(addresses, api.NodeAddress{Type: api.NodeExternalIP, Address: ip.String()}) + } + + return addresses, nil +} + // NodeAddresses returns the addresses of the specified instance. // TODO(roberthbailey): This currently is only used in such a way that it // returns the address of the calling instance. We should do a rename to @@ -49,11 +78,16 @@ func mapInstanceNameToNodeName(displayName string) types.NodeName { func (cp *CloudProvider) NodeAddresses(name types.NodeName) ([]api.NodeAddress, error) { glog.V(4).Infof("NodeAddresses(%q) called", name) - inst, err := cp.client.GetInstanceByNodeName(mapNodeNameToInstanceName(name)) + inst, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), mapNodeNameToInstanceName(name)) if err != nil { - return nil, err + return nil, errors.Wrap(err, "GetInstanceByNodeName") } - return cp.client.GetNodeAddressesForInstance(inst.ID) + + vnic, err := cp.client.Compute().GetPrimaryVNICForInstance(context.TODO(), *inst.Id) + if err != nil { + return nil, errors.Wrap(err, "GetPrimaryVNICForInstance") + } + return extractNodeAddressesFromVNIC(vnic) } // NodeAddressesByProviderID returns the addresses of the specified instance. @@ -64,7 +98,11 @@ func (cp *CloudProvider) NodeAddresses(name types.NodeName) ([]api.NodeAddress, func (cp *CloudProvider) NodeAddressesByProviderID(providerID string) ([]api.NodeAddress, error) { glog.V(4).Infof("NodeAddressesByProviderID(%q) called", providerID) instanceID := util.MapProviderIDToInstanceID(providerID) - return cp.client.GetNodeAddressesForInstance(instanceID) + vnic, err := cp.client.Compute().GetPrimaryVNICForInstance(context.TODO(), instanceID) + if err != nil { + return nil, errors.Wrap(err, "GetPrimaryVNICForInstance") + } + return extractNodeAddressesFromVNIC(vnic) } // ExternalID returns the cloud provider ID of the node with the specified NodeName. @@ -74,7 +112,7 @@ func (cp *CloudProvider) ExternalID(nodeName types.NodeName) (string, error) { glog.V(4).Infof("ExternalID(%q) called", nodeName) instName := mapNodeNameToInstanceName(nodeName) - inst, err := cp.client.GetInstanceByNodeName(instName) + inst, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), instName) if client.IsNotFound(err) { glog.Infof("Instance %q was not found. Unable to get ExternalID: %v", instName, err) return "", cloudprovider.InstanceNotFound @@ -84,8 +122,8 @@ func (cp *CloudProvider) ExternalID(nodeName types.NodeName) (string, error) { return "", err } - glog.V(4).Infof("Got ExternalID %s for %s", inst.ID, nodeName) - return inst.ID, nil + glog.V(4).Infof("Got ExternalID %s for %s", *inst.Id, nodeName) + return *inst.Id, nil } // InstanceID returns the cloud provider ID of the node with the specified NodeName. @@ -94,22 +132,22 @@ func (cp *CloudProvider) InstanceID(nodeName types.NodeName) (string, error) { glog.V(4).Infof("InstanceID(%q) called", nodeName) name := mapNodeNameToInstanceName(nodeName) - inst, err := cp.client.GetInstanceByNodeName(name) + inst, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), name) if err != nil { - return "", fmt.Errorf("unable to fetch InstanceID for %q: %v", name, err) + return "", errors.Wrap(err, "GetInstanceByNodeName") } - return inst.ID, nil + return *inst.Id, nil } // InstanceType returns the type of the specified instance. func (cp *CloudProvider) InstanceType(name types.NodeName) (string, error) { glog.V(4).Infof("InstanceType(%q) called", name) - inst, err := cp.client.GetInstanceByNodeName(mapNodeNameToInstanceName(name)) + inst, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), mapNodeNameToInstanceName(name)) if err != nil { - return "", fmt.Errorf("getInstanceByNodeName failed for %q with %v", name, err) + return "", errors.Wrap(err, "GetInstanceByNodeName") } - return inst.Shape, nil + return *inst.Shape, nil } // InstanceTypeByProviderID returns the type of the specified instance. @@ -117,11 +155,11 @@ func (cp *CloudProvider) InstanceTypeByProviderID(providerID string) (string, er glog.V(4).Infof("InstanceTypeByProviderID(%q) called", providerID) instanceID := util.MapProviderIDToInstanceID(providerID) - inst, err := cp.client.GetInstance(instanceID) + inst, err := cp.client.Compute().GetInstance(context.TODO(), instanceID) if err != nil { - return "", err + return "", errors.Wrap(err, "GetInstance") } - return inst.Shape, nil + return *inst.Shape, nil } // AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances @@ -143,7 +181,7 @@ func (cp *CloudProvider) CurrentNodeName(hostname string) (types.NodeName, error func (cp *CloudProvider) InstanceExistsByProviderID(providerID string) (bool, error) { glog.V(4).Infof("InstanceExistsByProviderID(%q) called", providerID) instanceID := util.MapProviderIDToInstanceID(providerID) - instance, err := cp.client.GetInstance(instanceID) + instance, err := cp.client.Compute().GetInstance(context.TODO(), instanceID) if client.IsNotFound(err) { return false, nil } diff --git a/pkg/oci/instances_test.go b/pkg/oci/instances_test.go new file mode 100644 index 0000000000..6a3269461f --- /dev/null +++ b/pkg/oci/instances_test.go @@ -0,0 +1,96 @@ +// Copyright 2018 Oracle and/or its affiliates. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package oci + +import ( + "errors" + "reflect" + "testing" + + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/core" + + api "k8s.io/api/core/v1" +) + +func TestExtractNodeAddressesFromVNIC(t *testing.T) { + testCases := []struct { + name string + in *core.Vnic + out []api.NodeAddress + err error + }{ + { + name: "basic-complete", + in: &core.Vnic{ + PrivateIp: common.String("10.0.0.1"), + PublicIp: common.String("0.0.0.1"), + }, + out: []api.NodeAddress{ + api.NodeAddress{Type: api.NodeInternalIP, Address: "10.0.0.1"}, + api.NodeAddress{Type: api.NodeExternalIP, Address: "0.0.0.1"}, + }, + err: nil, + }, + { + name: "no-external-ip", + in: &core.Vnic{ + PrivateIp: common.String("10.0.0.1"), + }, + out: []api.NodeAddress{ + api.NodeAddress{Type: api.NodeInternalIP, Address: "10.0.0.1"}, + }, + err: nil, + }, + { + name: "no-internal-ip", + in: &core.Vnic{ + PublicIp: common.String("0.0.0.1"), + }, + out: []api.NodeAddress{ + api.NodeAddress{Type: api.NodeExternalIP, Address: "0.0.0.1"}, + }, + err: nil, + }, + { + name: "invalid-external-ip", + in: &core.Vnic{ + PublicIp: common.String("0.0.0."), + }, + out: nil, + err: errors.New(`instance has invalid public address: "0.0.0."`), + }, + { + name: "invalid-external-ip", + in: &core.Vnic{ + PrivateIp: common.String("10.0.0."), + }, + out: nil, + err: errors.New(`instance has invalid private address: "10.0.0."`), + }, + } + + for _, tt := range testCases { + t.Run(tt.name, func(t *testing.T) { + result, err := extractNodeAddressesFromVNIC(tt.in) + if err != nil && err.Error() != tt.err.Error() { + t.Errorf("extractNodeAddressesFromVNIC(%+v) got error %v, expected %v", tt.in, err, tt.err) + } + if !reflect.DeepEqual(result, tt.out) { + t.Errorf("extractNodeAddressesFromVNIC(%+v) => %+v, want %+v", tt.in, result, tt.out) + } + }) + } +} diff --git a/pkg/oci/load_balancer.go b/pkg/oci/load_balancer.go index ae4de8b1f7..68fb13dd11 100644 --- a/pkg/oci/load_balancer.go +++ b/pkg/oci/load_balancer.go @@ -15,18 +15,21 @@ package oci import ( - "fmt" + "context" + + "github.com/golang/glog" + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/core" + "github.com/oracle/oci-go-sdk/loadbalancer" + "github.com/pkg/errors" api "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/util/sets" + labels "k8s.io/apimachinery/pkg/labels" + sets "k8s.io/apimachinery/pkg/util/sets" apiservice "k8s.io/kubernetes/pkg/api/v1/service" k8sports "k8s.io/kubernetes/pkg/master/ports" - "github.com/golang/glog" - baremetal "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" "github.com/oracle/oci-cloud-controller-manager/pkg/oci/util" ) @@ -63,6 +66,10 @@ const ( ServiceAnnotationLoadBalancerTLSSecret = "service.beta.kubernetes.io/oci-load-balancer-tls-secret" ) +// DefaultLoadBalancerPolicy defines the default traffic policy for load +// balancers created by the CCM. +const DefaultLoadBalancerPolicy = "ROUND_ROBIN" + const ( // Fallback value if annotation on service is not set lbDefaultShape = "100Mbps" @@ -72,115 +79,248 @@ const ( lbNodesHealthCheckProto = "HTTP" ) -func (cp *CloudProvider) readTLSSecret(secretString, serviceNS string) (cert, key string, err error) { +// GetLoadBalancer returns whether the specified load balancer exists, and if +// so, what its status is. +func (cp *CloudProvider) GetLoadBalancer(clusterName string, service *api.Service) (*api.LoadBalancerStatus, bool, error) { + name := GetLoadBalancerName(service) + glog.V(4).Infof("Fetching load balancer with name %q", name) + + lb, err := cp.client.LoadBalancer().GetLoadBalancerByName(context.TODO(), name) + if err != nil { + if client.IsNotFound(err) { + glog.V(2).Infof("Load balancer %q does not exist", name) + return nil, false, nil + } + + return nil, false, err + } + + lbStatus, err := loadBalancerToStatus(lb) + if err != nil { + return nil, false, err + } + + return lbStatus, true, nil +} + +// getSubnets returns a list of Subnet objects for the corrosponding OCIDs. +func getSubnets(ctx context.Context, subnetIDs []string, n client.NetworkingInterface) ([]*core.Subnet, error) { + subnets := make([]*core.Subnet, len(subnetIDs)) + for i, id := range subnetIDs { + subnet, err := n.GetSubnet(context.TODO(), id) + if err != nil { + return nil, err + } + subnets[i] = subnet + } + return subnets, nil +} + +// getSubnetsForNodes returns the de-duplicated subnets in which the given +// internal IP addresses reside. +func getSubnetsForNodes(ctx context.Context, nodes []*api.Node, client client.Interface) ([]*core.Subnet, error) { + var ( + subnetOCIDs = sets.NewString() + subnets []*core.Subnet + ipSet = sets.NewString() + ) + + for _, node := range nodes { + ipSet.Insert(util.NodeInternalIP(node)) + } + + for _, node := range nodes { + // First see if the IP of the node belongs to a subnet in the cache. + ip := util.NodeInternalIP(node) + subnet, err := client.Networking().GetSubnetFromCacheByIP(ip) + if err != nil { + return nil, err + } + if subnet != nil { + // cache hit + if !subnetOCIDs.Has(*subnet.Id) { + subnetOCIDs.Insert(*subnet.Id) + subnets = append(subnets, subnet) + } + // Since we got a cache hit we don't need to do the expensive query to find the subnet. + continue + } + + id := util.MapProviderIDToInstanceID(node.Spec.ProviderID) + vnic, err := client.Compute().GetPrimaryVNICForInstance(ctx, id) + if err != nil { + return nil, err + } + + if vnic.PrivateIp != nil && ipSet.Has(*vnic.PrivateIp) && + !subnetOCIDs.Has(*vnic.SubnetId) { + subnet, err := client.Networking().GetSubnet(ctx, *vnic.SubnetId) + if err != nil { + return nil, errors.Wrapf(err, "get subnet %q for instance %q", *vnic.SubnetId, id, err) + } + + subnets = append(subnets, subnet) + subnetOCIDs.Insert(*vnic.SubnetId) + } + } + + return subnets, nil +} + +// readSSLSecret returns the certificate and private key from a Kubernetes TLS +// private key Secret. +func (cp *CloudProvider) readSSLSecret(svc *api.Service) (string, string, error) { + secretString, ok := svc.Annotations[ServiceAnnotationLoadBalancerTLSSecret] + if !ok { + return "", "", errors.Errorf("no %q annotation found", ServiceAnnotationLoadBalancerTLSSecret) + } + ns, name := parseSecretString(secretString) if ns == "" { - ns = serviceNS + ns = svc.Namespace } secret, err := cp.kubeclient.CoreV1().Secrets(ns).Get(name, metav1.GetOptions{}) if err != nil { - return cert, key, err + return "", "", err } - certBytes, ok := secret.Data[sslCertificateFileName] - if !ok { - err = fmt.Errorf("%s not found in secret %s/%s", sslCertificateFileName, ns, name) - return + var cert, key []byte + if cert, ok = secret.Data[sslCertificateFileName]; !ok { + return "", "", errors.Errorf("%s not found in secret %s/%s", sslCertificateFileName, ns, name) } - keyBytes, ok := secret.Data[sslPrivateKeyFileName] - if !ok { - err = fmt.Errorf("%s not found in secret %s/%s", sslCertificateFileName, ns, name) - return + if key, ok = secret.Data[sslPrivateKeyFileName]; !ok { + return "", "", errors.Errorf("%s not found in secret %s/%s", sslPrivateKeyFileName, ns, name) } - return string(certBytes), string(keyBytes), nil + return string(cert), string(key), nil } // ensureSSLCertificate creates a OCI SSL certificate to the given load // balancer, if it doesn't already exist. -func (cp *CloudProvider) ensureSSLCertificate(name string, svc *api.Service, lb *baremetal.LoadBalancer) error { - _, err := cp.client.GetCertificateByName(lb.ID, name) +func (cp *CloudProvider) ensureSSLCertificate(ctx context.Context, spec LBSpec, lb *loadbalancer.LoadBalancer) error { + name := spec.SSLConfig.Name + _, err := cp.client.LoadBalancer().GetCertificateByName(ctx, *lb.Id, name) if err == nil { - glog.V(4).Infof("Certificate: %q already exists on load balancer: %q", name, lb.DisplayName) + glog.V(4).Infof("Certificate %q already exists on load balancer %q. Nothing to do.", name, *lb.DisplayName) return nil } if !client.IsNotFound(err) { return err } - secretString, ok := svc.Annotations[ServiceAnnotationLoadBalancerTLSSecret] - if !ok { - return fmt.Errorf("no %s annotation found", ServiceAnnotationLoadBalancerTLSSecret) - } - - cert, key, err := cp.readTLSSecret(secretString, svc.Namespace) + // Although we iterate here only one certificate is supported at the + // moment as specifying a + certs, err := spec.GetCertificates() if err != nil { return err } + for _, cert := range certs { + wrID, err := cp.client.LoadBalancer().CreateCertificate(ctx, *lb.Id, *cert.PublicCertificate, *cert.PrivateKey) + if err != nil { + return err + } + _, err = cp.client.LoadBalancer().AwaitWorkRequest(ctx, wrID) + if err != nil { + return err + } - err = cp.client.CreateAndAwaitCertificate(lb, name, cert, key) - if err != nil { - return err + glog.V(2).Infof("Created certificate %q on load balancer %q", *cert.CertificateName, *lb.DisplayName) } - - glog.V(2).Infof("Created certificate %q on load balancer %q", name, lb.DisplayName) return nil } -// GetLoadBalancer returns whether the specified load balancer exists, and if -// so, what its status is. -func (cp *CloudProvider) GetLoadBalancer(clusterName string, service *api.Service) (status *api.LoadBalancerStatus, exists bool, retErr error) { - name := GetLoadBalancerName(service) - glog.V(4).Infof("Fetching load balancer with name '%s'", name) +// createLoadBalancer creates a new OCI load balancer based on the given spec. +func (cp *CloudProvider) createLoadBalancer(ctx context.Context, spec LBSpec, sourceCIDRs []string) (*api.LoadBalancerStatus, error) { + glog.Infof("Attempting to create a new load balancer with name %q", spec.Name) - lb, err := cp.client.GetLoadBalancerByName(name) + // First update the security lists so that if it fails (due to + // the etag bug or otherwise) we'll retry prior to LB creation. + lbSubnets, err := getSubnets(ctx, spec.Subnets, cp.client.Networking()) if err != nil { - if client.IsNotFound(err) { - glog.V(2).Infof("Load balancer '%s' does not exist", name) - return nil, false, nil - } + return nil, errors.Wrap(err, "getting subnets for load balancers") + } + nodeSubnets, err := getSubnetsForNodes(ctx, spec.Nodes, cp.client) + if err != nil { + return nil, errors.Wrap(err, "getting subnets for nodes") + } - return nil, false, err + for name, bs := range spec.GetBackendSets() { + backendPort := *bs.Backends[0].Port + healthCheckPort := *bs.HealthChecker.Port + listenerPort := *spec.GetListeners()[name].Port + if err = cp.securityListManager.Update(ctx, lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort); err != nil { + return nil, err + } } - lbStatus, err := loadBalancerToStatus(lb) + // Then we create the load balancer and wait for it to be online. + certs, err := spec.GetCertificates() if err != nil { - return nil, false, err + return nil, errors.Wrap(err, "get certificates") + } + details := loadbalancer.CreateLoadBalancerDetails{ + CompartmentId: common.String(cp.config.Auth.CompartmentOCID), + DisplayName: common.String(spec.Name), + ShapeName: common.String(spec.Shape), + IsPrivate: common.Bool(spec.Internal), + SubnetIds: spec.Subnets, + BackendSets: spec.GetBackendSets(), + Listeners: spec.GetListeners(), + Certificates: certs, + } + glog.V(4).Infof("CreateLoadBalancerDetails: %#v", details.String()) + wrID, err := cp.client.LoadBalancer().CreateLoadBalancer(ctx, details) + if err != nil { + glog.Errorf("Failed to create load balancer: %+v", err) + return nil, err + } + wr, err := cp.client.LoadBalancer().AwaitWorkRequest(ctx, wrID) + if err != nil { + return nil, errors.Wrap(err, "awaiting load balancer") } - return lbStatus, true, nil -} - -func getCertificateName(lb *baremetal.LoadBalancer) string { - return lb.DisplayName + lb, err := cp.client.LoadBalancer().GetLoadBalancer(ctx, *wr.LoadBalancerId) + if err != nil { + return nil, errors.Wrapf(err, "get load balancer %q", *wr.LoadBalancerId) + } + glog.Infof("Created load balancer %q with OCID %q", *lb.DisplayName, *lb.Id) + return loadBalancerToStatus(lb) } // EnsureLoadBalancer creates a new load balancer or updates the existing one. // Returns the status of the balancer (i.e it's public IP address if one exists). func (cp *CloudProvider) EnsureLoadBalancer(clusterName string, service *api.Service, nodes []*api.Node) (*api.LoadBalancerStatus, error) { - spec, err := NewLBSpec(cp, service, nodes) + lbName := GetLoadBalancerName(service) + lb, err := cp.client.LoadBalancer().GetLoadBalancerByName(context.TODO(), lbName) + if err != nil && !client.IsNotFound(err) { + return nil, err + } + exists := !client.IsNotFound(err) + + var ssl *SSLConfig + if needsCerts(service) { + ports, err := getSSLEnabledPorts(service) + if err != nil { + return nil, err + } + ssl = NewSSLConfig(lbName, ports, cp) + } + subnets := []string{cp.config.LoadBalancer.Subnet1, cp.config.LoadBalancer.Subnet2} + spec, err := NewLBSpec(service, nodes, subnets, ssl) if err != nil { glog.Errorf("Failed to create LBSpec: %v", err) return nil, err } - glog.V(4).Infof("Ensure load balancer '%s' called for '%s' with %d nodes.", spec.Name, spec.Service.Name, len(nodes)) - - var lb *baremetal.LoadBalancer - lb, err = cp.client.GetLoadBalancerByName(spec.Name) + sourceCIDRs, err := getLoadBalancerSourceRanges(service) if err != nil { - if client.IsNotFound(err) { - glog.Infof("Attempting to create a load balancer with name '%s'", spec.Name) - var cerr error - lb, cerr = cp.client.CreateAndAwaitLoadBalancer(spec.Name, spec.Shape, spec.Subnets, spec.Internal) - if cerr != nil { - glog.Errorf("Failed to create load balancer: %s", err) - return nil, cerr - } - glog.Infof("Created load balancer '%s' with OCID '%s'", lb.DisplayName, lb.ID) - } else { - return nil, err - } + return nil, err + } + + glog.V(4).Infof("Ensure load balancer %q called for %q with %d nodes.", spec.Name, service.Name, len(nodes)) + + if !exists { + return cp.createLoadBalancer(context.TODO(), spec, sourceCIDRs) } // Existing load balancers cannot change subnets. This ensures that the spec matches @@ -188,23 +328,16 @@ func (cp *CloudProvider) EnsureLoadBalancer(clusterName string, service *api.Ser // was just created then these values would be equal; however, if the load balancer // already existed and the default subnet ids changed, then this would ensure // we are setting the security rules on the correct subnets. - spec.Subnets = lb.SubnetIDs - - certificateName := getCertificateName(lb) + spec.Subnets = lb.SubnetIds - sslConfigMap, err := spec.GetSSLConfig(certificateName) - if sslEnabled(sslConfigMap) { - if err = cp.ensureSSLCertificate(certificateName, spec.Service, lb); err != nil { + // If the load balancer needs an SSL cert ensure it is present. + if needsCerts(service) { + if err := cp.ensureSSLCertificate(context.TODO(), spec, lb); err != nil { return nil, err } } - sourceCIDRs, err := getLoadBalancerSourceRanges(service) - if err != nil { - return nil, err - } - - err = cp.updateLoadBalancer(lb, spec, sslConfigMap, sourceCIDRs) + err = cp.updateLoadBalancer(context.TODO(), lb, spec, sourceCIDRs) if err != nil { return nil, err } @@ -214,123 +347,115 @@ func (cp *CloudProvider) EnsureLoadBalancer(clusterName string, service *api.Ser return nil, err } - glog.V(2).Infof("Successfully ensured load balancer %q", lb.DisplayName) + glog.V(2).Infof("Successfully ensured load balancer %q", *lb.DisplayName) return status, nil } -func (cp *CloudProvider) updateLoadBalancer( - lb *baremetal.LoadBalancer, - spec LBSpec, - sslConfigMap map[int]*baremetal.SSLConfiguration, - sourceCIDRs []string) error { - lbOCID := lb.ID +func (cp *CloudProvider) updateLoadBalancer(ctx context.Context, lb *loadbalancer.LoadBalancer, spec LBSpec, sourceCIDRs []string) error { + lbOCID := *lb.Id actualBackendSets := lb.BackendSets desiredBackendSets := spec.GetBackendSets() - backendSetActions := getBackendSetChanges(actualBackendSets, desiredBackendSets) actualListeners := lb.Listeners - desiredListeners := spec.GetListeners(sslConfigMap) + desiredListeners := spec.GetListeners() listenerActions := getListenerChanges(actualListeners, desiredListeners) if len(backendSetActions) == 0 && len(listenerActions) == 0 { return nil // Nothing to do. } - lbSubnets, err := cp.client.GetSubnets(spec.Subnets) + lbSubnets, err := getSubnets(ctx, spec.Subnets, cp.client.Networking()) if err != nil { - return fmt.Errorf("get subnets for lbs: %v", err) + return errors.Wrapf(err, "getting load balancer subnets") } - - nodeSubnets, err := cp.client.GetSubnetsForNodes(spec.Nodes) + nodeSubnets, err := getSubnetsForNodes(ctx, spec.Nodes, cp.client) if err != nil { - return fmt.Errorf("get subnets for nodes: %v", err) + return errors.Wrap(err, "get subnets for nodes") } actions := sortAndCombineActions(backendSetActions, listenerActions) for _, action := range actions { switch a := action.(type) { case *BackendSetAction: - err := cp.updateBackendSet(lbOCID, a, lbSubnets, nodeSubnets) + err := cp.updateBackendSet(context.TODO(), lbOCID, a, lbSubnets, nodeSubnets) if err != nil { - return fmt.Errorf("error updating BackendSet: %v", err) + return errors.Wrap(err, "updating BackendSet") } case *ListenerAction: - backendSet := spec.GetBackendSets()[a.Listener.DefaultBackendSetName] + backendSetName := *a.Listener.DefaultBackendSetName + var backendPort, healthCheckPort int if a.Type() == Delete { - // If we need to delete the backendset then it'll no longer be + // If we need to delete the BackendSet then it'll no longer be // present in the spec since that's what is desired, so we need // to fetch it from the load balancer object. - backendSet = lb.BackendSets[a.Listener.DefaultBackendSetName] + bs := lb.BackendSets[backendSetName] + // FIXME(apryde): panics when no backends. + backendPort = *bs.Backends[0].Port + healthCheckPort = *bs.HealthChecker.Port + } else { + bs := spec.GetBackendSets()[*a.Listener.DefaultBackendSetName] + // FIXME(apryde): panics when no backends. + backendPort = *bs.Backends[0].Port + healthCheckPort = *bs.HealthChecker.Port } - backendPort := uint64(getBackendPort(backendSet.Backends)) - healthCheckPort := uint64(backendSet.HealthChecker.Port) - err := cp.updateListener(lbOCID, a, backendPort, healthCheckPort, lbSubnets, nodeSubnets, sslConfigMap, sourceCIDRs) + err := cp.updateListener(ctx, lbOCID, a, backendPort, healthCheckPort, lbSubnets, nodeSubnets, sourceCIDRs) if err != nil { - return fmt.Errorf("error updating Listener: %v", err) + return errors.Wrap(err, "updating listener") } } } return nil } -func (cp *CloudProvider) updateBackendSet(lbOCID string, action *BackendSetAction, lbSubnets, nodeSubnets []*baremetal.Subnet) error { +func (cp *CloudProvider) updateBackendSet(ctx context.Context, lbOCID string, action *BackendSetAction, lbSubnets, nodeSubnets []*core.Subnet) error { sourceCIDRs := []string{} - listenerPort := uint64(0) + listenerPort := 0 var workRequestID string var err error - be := action.BackendSet - glog.V(2).Infof("Applying %q action on backend set `%s` for lb `%s`", action.Type(), be.Name, lbOCID) + bs := action.BackendSet - backendPort := uint64(getBackendPort(be.Backends)) - healthCheckPort := uint64(be.HealthChecker.Port) + glog.V(2).Infof("Applying %q action on backend set %q for lb %q", action.Type(), action.Name(), lbOCID) + + if len(bs.Backends) < 1 { + return errors.New("no backends provided") + } + backendPort := *bs.Backends[0].Port + healthCheckPort := *bs.HealthChecker.Port switch action.Type() { case Create: - err = cp.securityListManager.Update(lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) + err = cp.securityListManager.Update(ctx, lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) if err != nil { return err } - workRequestID, err = cp.client.CreateBackendSet( - lbOCID, - be.Name, - be.Policy, - be.Backends, - be.HealthChecker, - nil, // ssl config - nil, // session persistence - nil, // create opts - ) + workRequestID, err = cp.client.LoadBalancer().CreateBackendSet(ctx, lbOCID, action.Name(), bs) case Update: - err = cp.securityListManager.Update(lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) + err = cp.securityListManager.Update(ctx, lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) if err != nil { return err } - workRequestID, err = cp.client.UpdateBackendSet(lbOCID, be.Name, &baremetal.UpdateLoadBalancerBackendSetOptions{ - Policy: be.Policy, - HealthChecker: be.HealthChecker, - Backends: be.Backends, - }) + workRequestID, err = cp.client.LoadBalancer().UpdateBackendSet(ctx, lbOCID, action.Name(), bs) case Delete: - err = cp.securityListManager.Delete(lbSubnets, nodeSubnets, listenerPort, backendPort, healthCheckPort) + err = cp.securityListManager.Delete(ctx, lbSubnets, nodeSubnets, listenerPort, backendPort, healthCheckPort) if err != nil { return err } - workRequestID, err = cp.client.DeleteBackendSet(lbOCID, be.Name, nil) + workRequestID, err = cp.client.LoadBalancer().DeleteBackendSet(ctx, lbOCID, action.Name()) } if err != nil { return err } - _, err = cp.client.AwaitWorkRequest(workRequestID) + _, err = cp.client.LoadBalancer().AwaitWorkRequest(ctx, workRequestID) if err != nil { return err } @@ -338,80 +463,58 @@ func (cp *CloudProvider) updateBackendSet(lbOCID string, action *BackendSetActio return nil } -func (cp *CloudProvider) updateListener(lbOCID string, - action *ListenerAction, - backendPort uint64, - healthCheckPort uint64, - lbSubnets []*baremetal.Subnet, - nodeSubnets []*baremetal.Subnet, - sslConfigMap map[int]*baremetal.SSLConfiguration, - sourceCIDRs []string) error { - - var workRequestID string - var err error - l := action.Listener - listenerPort := uint64(l.Port) +func (cp *CloudProvider) updateListener(ctx context.Context, lbOCID string, action *ListenerAction, backendPort int, healthCheckPort int, lbSubnets, nodeSubnets []*core.Subnet, sourceCIDRs []string) error { + var ( + workRequestID string + err error + l = action.Listener + listenerPort = *l.Port + ) - glog.V(2).Infof("Applying %q action on listener `%s` for lb `%s`", action.Type(), l.Name, lbOCID) + glog.V(2).Infof("Applying %q action on listener %q for lb %q", action.Type(), action.Name(), lbOCID) switch action.Type() { case Create: - err = cp.securityListManager.Update(lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) + err = cp.securityListManager.Update(ctx, lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) if err != nil { return err } - workRequestID, err = cp.client.CreateListener( - lbOCID, - l.Name, - l.DefaultBackendSetName, - l.Protocol, - l.Port, - l.SSLConfig, - nil, // create opts - ) + workRequestID, err = cp.client.LoadBalancer().CreateListener(ctx, lbOCID, action.Name(), l) case Update: - err = cp.securityListManager.Update(lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) + err = cp.securityListManager.Update(ctx, lbSubnets, nodeSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) if err != nil { return err } - workRequestID, err = cp.client.UpdateListener(lbOCID, l.Name, &baremetal.UpdateLoadBalancerListenerOptions{ - DefaultBackendSetName: l.DefaultBackendSetName, - Port: l.Port, - Protocol: l.Protocol, - SSLConfig: l.SSLConfig, - }) + workRequestID, err = cp.client.LoadBalancer().UpdateListener(ctx, lbOCID, action.Name(), l) case Delete: - err = cp.securityListManager.Delete(lbSubnets, nodeSubnets, listenerPort, backendPort, healthCheckPort) + err = cp.securityListManager.Delete(ctx, lbSubnets, nodeSubnets, listenerPort, backendPort, healthCheckPort) if err != nil { return err } - workRequestID, err = cp.client.DeleteListener(lbOCID, l.Name, nil) - } - - if err != nil { - return err + workRequestID, err = cp.client.LoadBalancer().DeleteListener(ctx, lbOCID, action.Name()) } - _, err = cp.client.AwaitWorkRequest(workRequestID) if err != nil { return err } - return nil + _, err = cp.client.LoadBalancer().AwaitWorkRequest(ctx, workRequestID) + return err } // UpdateLoadBalancer : TODO find out where this is called func (cp *CloudProvider) UpdateLoadBalancer(clusterName string, service *api.Service, nodes []*api.Node) error { name := GetLoadBalancerName(service) - glog.Infof("Attempting to update load balancer '%s'", name) + glog.Infof("Attempting to update load balancer %q", name) _, err := cp.EnsureLoadBalancer(clusterName, service, nodes) return err } +// getNodesByIPs returns a slice of Nodes corrosponding to the given IP addresses. func (cp *CloudProvider) getNodesByIPs(backendIPs []string) ([]*api.Node, error) { nodeList, err := cp.NodeLister.List(labels.Everything()) if err != nil { @@ -428,7 +531,7 @@ func (cp *CloudProvider) getNodesByIPs(backendIPs []string) ([]*api.Node, error) for _, ip := range backendIPs { node, ok := ipToNodeLookup[ip] if !ok { - return nil, fmt.Errorf("node %q was not found by IP %q", node.Name, ip) + return nil, errors.Errorf("node %q was not found by IP %q", node.Name, ip) } nodes = append(nodes, node) } @@ -436,95 +539,94 @@ func (cp *CloudProvider) getNodesByIPs(backendIPs []string) ([]*api.Node, error) return nodes, nil } -// EnsureLoadBalancerDeleted deletes the specified load balancer if it -// exists, returning nil if the load balancer specified either didn't exist or -// was successfully deleted. +// EnsureLoadBalancerDeleted deletes the specified load balancer if it exists, +// returning nil if the load balancer specified either didn't exist or was +// successfully deleted. func (cp *CloudProvider) EnsureLoadBalancerDeleted(clusterName string, service *api.Service) error { name := GetLoadBalancerName(service) + glog.Infof("Attempting to delete load balancer %q", name) - glog.Infof("Attempting to delete load balancer with name `%s`", name) - - lb, err := cp.client.GetLoadBalancerByName(name) + lb, err := cp.client.LoadBalancer().GetLoadBalancerByName(context.TODO(), name) if err != nil { if client.IsNotFound(err) { - glog.Infof("Could not find load balancer with name `%s`. Nothing to do.", name) + glog.Infof("Could not find load balancer with name %q. Nothing to do.", name) return nil } - - return fmt.Errorf("get load balancer by name `%s`: %v", name, err) + return errors.Wrapf(err, "get load balancer %q by name", name) } + id := *lb.Id + nodeIPs := sets.NewString() for _, backendSet := range lb.BackendSets { for _, backend := range backendSet.Backends { - nodeIPs.Insert(backend.IPAddress) + nodeIPs.Insert(*backend.IpAddress) } } - nodes, err := cp.getNodesByIPs(nodeIPs.List()) if err != nil { - return fmt.Errorf("error fetching nodes by internal ips: %v", err) - } - - spec, err := NewLBSpec(cp, service, nodes) - if err != nil { - return fmt.Errorf("new lb spec: %v", err) + return errors.Wrap(err, "fetching nodes by internal ips") } - sslConfigMap, err := spec.GetSSLConfig(getCertificateName(lb)) + spec, err := NewLBSpec(service, nodes, []string{cp.config.LoadBalancer.Subnet1, cp.config.LoadBalancer.Subnet2}, nil) if err != nil { - return fmt.Errorf("get ssl config: %v", err) + return errors.Wrap(err, "new lb spec") } - lbSubnets, err := cp.client.GetSubnets(spec.Subnets) + lbSubnets, err := getSubnets(context.TODO(), spec.Subnets, cp.client.Networking()) if err != nil { - return fmt.Errorf("get subnets for lbs: %v", err) + return errors.Wrap(err, "getting subnets for load balancers") } - - nodeSubnets, err := cp.client.GetSubnetsForNodes(spec.Nodes) + nodeSubnets, err := getSubnetsForNodes(context.TODO(), nodes, cp.client) if err != nil { - return fmt.Errorf("get subnets for nodes: %v", err) + return errors.Wrap(err, "getting subnets for nodes") } - for _, listener := range spec.GetListeners(sslConfigMap) { - glog.V(4).Infof("Deleting security rules for listener `%s` for load balancer `%s`", listener.Name, lb.ID) + for listenerName, listener := range spec.GetListeners() { + glog.V(4).Infof("Deleting security rules for listener %q for load balancer %q", listenerName, id) - backendSet := spec.GetBackendSets()[listener.DefaultBackendSetName] - backends := backendSet.Backends - backendPort := uint64(getBackendPort(backends)) - healthCheckPort := uint64(backendSet.HealthChecker.Port) + backendSetName := *listener.DefaultBackendSetName + bs, ok := spec.GetBackendSets()[backendSetName] + if !ok { + return errors.Errorf("no backend set %q in spec", backendSetName) + } + if len(bs.Backends) < 1 { + return errors.Errorf("backend set %q has no backends", backendSetName) + } + backendPort := *bs.Backends[0].Port + if bs.HealthChecker == nil { + return errors.Errorf("backend set %q has no health checker", backendSetName) + } + healthCheckPort := *bs.HealthChecker.Port - err := cp.securityListManager.Delete(lbSubnets, nodeSubnets, uint64(listener.Port), backendPort, healthCheckPort) - if err != nil { - return fmt.Errorf("delete security rules for listener %s: %v", listener.Name, err) + if err := cp.securityListManager.Delete(context.TODO(), lbSubnets, nodeSubnets, *listener.Port, backendPort, healthCheckPort); err != nil { + return errors.Wrapf(err, "delete security rules for listener %q on load balancer %q", listenerName, name) } } - glog.Infof("Deleting load balancer `%s` (OCID: `%s`)", lb.DisplayName, lb.ID) - - workReqID, err := cp.client.DeleteLoadBalancer(lb.ID, &baremetal.ClientRequestOptions{}) + glog.Infof("Deleting load balancer %q (OCID: %q)", name, id) + workReqID, err := cp.client.LoadBalancer().DeleteLoadBalancer(context.TODO(), id) if err != nil { - return fmt.Errorf("delete load balancer `%s`: %v", lb.ID, err) + return errors.Wrapf(err, "delete load balancer %q", id) } - - _, err = cp.client.AwaitWorkRequest(workReqID) + _, err = cp.client.LoadBalancer().AwaitWorkRequest(context.TODO(), workReqID) if err != nil { - return err + return errors.Wrapf(err, "awaiting deletion of load balancer %q", name) } - glog.Infof("Deleted load balancer `%s` (OCID: `%s`)", lb.DisplayName, lb.ID) + glog.Infof("Deleted load balancer %q (OCID: %q)", name, id) return nil } // Given an OCI load balancer, return a LoadBalancerStatus -func loadBalancerToStatus(lb *baremetal.LoadBalancer) (*api.LoadBalancerStatus, error) { - if len(lb.IPAddresses) == 0 { - return nil, fmt.Errorf("no IPAddresses found for load balancer '%s'", lb.DisplayName) +func loadBalancerToStatus(lb *loadbalancer.LoadBalancer) (*api.LoadBalancerStatus, error) { + if len(lb.IpAddresses) == 0 { + return nil, errors.Errorf("no ip addresses found for load balancer %q", *lb.DisplayName) } ingress := []api.LoadBalancerIngress{} - for _, ip := range lb.IPAddresses { - ingress = append(ingress, api.LoadBalancerIngress{IP: ip.IPAddress}) + for _, ip := range lb.IpAddresses { + ingress = append(ingress, api.LoadBalancerIngress{IP: *ip.IpAddress}) } return &api.LoadBalancerStatus{Ingress: ingress}, nil } diff --git a/pkg/oci/load_balancer_security_lists.go b/pkg/oci/load_balancer_security_lists.go index 05f396b29c..11d415e99b 100644 --- a/pkg/oci/load_balancer_security_lists.go +++ b/pkg/oci/load_balancer_security_lists.go @@ -15,18 +15,23 @@ package oci import ( + "context" "fmt" "reflect" + "sort" "github.com/golang/glog" - baremetal "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/core" + "github.com/pkg/errors" api "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/util/sets" + labels "k8s.io/apimachinery/pkg/labels" + sets "k8s.io/apimachinery/pkg/util/sets" listersv1 "k8s.io/client-go/listers/core/v1" apiservice "k8s.io/kubernetes/pkg/api/v1/service" + + "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" ) const ( @@ -46,13 +51,13 @@ type securityListManager interface { // from LB subnets to backend subnets on the backend port // Egress rules added: // from LB subnets to backend subnets on the backend port - Update(lbSubnets []*baremetal.Subnet, backendSubnets []*baremetal.Subnet, sourceCIDRs []string, listenerPort uint64, backendPort uint64, healthCheckPort uint64) error + Update(ctx context.Context, lbSubnets []*core.Subnet, backendSubnets []*core.Subnet, sourceCIDRs []string, listenerPort, backendPort, healthCheckPort int) error // Delete the security list rules associated with the listener & backends. // // If the listener is nil, then only the egress rules from the LB's to the backends and the // ingress rules from the LB's to the backends will be cleaned up. // If the listener is not nil, then the ingress rules to the LB's will be cleaned up. - Delete(lbSubnets []*baremetal.Subnet, backendSubnets []*baremetal.Subnet, listenerPort uint64, backendPort uint64, healthCheckPort uint64) error + Delete(ctx context.Context, lbSubnets []*core.Subnet, backendSubnets []*core.Subnet, listenerPort, backendPort, healthCheckPort int) error } type securityListManagerImpl struct { @@ -67,59 +72,45 @@ func newSecurityListManager(client client.Interface, serviceLister listersv1.Ser } } -func (s *securityListManagerImpl) Update( - lbSubnets []*baremetal.Subnet, - backendSubnets []*baremetal.Subnet, - sourceCIDRs []string, - listenerPort uint64, - backendPort uint64, - healthCheckPort uint64) error { - - err := s.updateLoadBalancerRules(lbSubnets, backendSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort) - if err != nil { +func (s *securityListManagerImpl) Update(ctx context.Context, lbSubnets []*core.Subnet, backendSubnets []*core.Subnet, sourceCIDRs []string, listenerPort, backendPort, healthCheckPort int) error { + if err := s.updateLoadBalancerRules(ctx, lbSubnets, backendSubnets, sourceCIDRs, listenerPort, backendPort, healthCheckPort); err != nil { return err } - return s.updateBackendRules(lbSubnets, backendSubnets, backendPort, healthCheckPort) + return s.updateBackendRules(ctx, lbSubnets, backendSubnets, backendPort, healthCheckPort) } -func (s *securityListManagerImpl) Delete( - lbSubnets []*baremetal.Subnet, - backendSubnets []*baremetal.Subnet, - listenerPort uint64, - backendPort uint64, - healthCheckPort uint64) error { - - noSubnets := []*baremetal.Subnet{} +func (s *securityListManagerImpl) Delete(ctx context.Context, lbSubnets []*core.Subnet, backendSubnets []*core.Subnet, listenerPort, backendPort, healthCheckPort int) error { + noSubnets := []*core.Subnet{} noSourceCIDRs := []string{} - err := s.updateLoadBalancerRules(lbSubnets, noSubnets, noSourceCIDRs, listenerPort, backendPort, healthCheckPort) + err := s.updateLoadBalancerRules(ctx, lbSubnets, noSubnets, noSourceCIDRs, listenerPort, backendPort, healthCheckPort) if err != nil { return err } - return s.updateBackendRules(noSubnets, backendSubnets, backendPort, healthCheckPort) + return s.updateBackendRules(ctx, noSubnets, backendSubnets, backendPort, healthCheckPort) } // updateBackendRules handles adding ingress rules to the backend subnets from the load balancer subnets. -func (s *securityListManagerImpl) updateBackendRules(lbSubnets []*baremetal.Subnet, nodeSubnets []*baremetal.Subnet, backendPort uint64, healthCheckPort uint64) error { +func (s *securityListManagerImpl) updateBackendRules(ctx context.Context, lbSubnets []*core.Subnet, nodeSubnets []*core.Subnet, backendPort, healthCheckPort int) error { for _, subnet := range nodeSubnets { - secList, err := s.client.GetDefaultSecurityList(subnet) + secList, etag, err := getDefaultSecurityList(ctx, s.client.Networking(), subnet.SecurityListIds) if err != nil { - return fmt.Errorf("get security list for subnet `%s`: %v", subnet.ID, err) + return errors.Wrapf(err, "get security list for subnet %q", *subnet.Id) } ingressRules := getNodeIngressRules(secList.IngressSecurityRules, lbSubnets, backendPort, s.serviceLister) ingressRules = getNodeIngressRules(ingressRules, lbSubnets, healthCheckPort, s.serviceLister) if !securityListRulesChanged(secList, ingressRules, secList.EgressSecurityRules) { - glog.V(4).Infof("No changes for node subnet security list `%s`", secList.ID) + glog.V(4).Infof("No changes for node subnet security list %q", *secList.Id) continue } - err = s.updateSecurityListRules(secList.ID, secList.ETag, ingressRules, secList.EgressSecurityRules) + err = s.updateSecurityListRules(ctx, *secList.Id, etag, ingressRules, secList.EgressSecurityRules) if err != nil { - return fmt.Errorf("update security list rules `%s` for subnet `%s: %v", secList.ID, subnet.ID, err) + return errors.Wrapf(err, "update security list rules %q for subnet %q", *secList.Id, *subnet.Id) } } @@ -128,11 +119,11 @@ func (s *securityListManagerImpl) updateBackendRules(lbSubnets []*baremetal.Subn // updateLoadBalancerRules handles updating the ingress and egress rules for the load balance subnets. // If the listener is nil, then only egress rules from the load balancer to the backend subnets will be checked. -func (s *securityListManagerImpl) updateLoadBalancerRules(lbSubnets []*baremetal.Subnet, nodeSubnets []*baremetal.Subnet, sourceCIDRs []string, listenerPort uint64, backendPort uint64, healthCheckPort uint64) error { +func (s *securityListManagerImpl) updateLoadBalancerRules(ctx context.Context, lbSubnets []*core.Subnet, nodeSubnets []*core.Subnet, sourceCIDRs []string, listenerPort, backendPort, healthCheckPort int) error { for _, lbSubnet := range lbSubnets { - lbSecurityList, err := s.client.GetDefaultSecurityList(lbSubnet) + lbSecurityList, etag, err := getDefaultSecurityList(ctx, s.client.Networking(), lbSubnet.SecurityListIds) if err != nil { - return fmt.Errorf("get lb security list for subnet `%s`: %v", lbSubnet.ID, err) + return errors.Wrapf(err, "get lb security list for subnet %q", *lbSubnet.Id) } lbEgressRules := getLoadBalancerEgressRules(lbSecurityList.EgressSecurityRules, nodeSubnets, backendPort, s.serviceLister) @@ -144,24 +135,44 @@ func (s *securityListManagerImpl) updateLoadBalancerRules(lbSubnets []*baremetal } if !securityListRulesChanged(lbSecurityList, lbIngressRules, lbEgressRules) { - glog.V(4).Infof("No changes for lb subnet security list `%s`", lbSecurityList.ID) + glog.V(4).Infof("No changes for lb subnet security list %q", *lbSecurityList.Id) continue } - err = s.updateSecurityListRules(lbSecurityList.ID, lbSecurityList.ETag, lbIngressRules, lbEgressRules) + err = s.updateSecurityListRules(ctx, *lbSecurityList.Id, etag, lbIngressRules, lbEgressRules) if err != nil { - return fmt.Errorf("update lb security list rules `%s` for subnet `%s: %v", lbSecurityList.ID, lbSubnet.ID, err) + return errors.Wrapf(err, "update lb security list rules %q for subnet %q", *lbSecurityList.Id, *lbSubnet.Id) } } return nil } +func getDefaultSecurityList(ctx context.Context, n client.NetworkingInterface, ids []string) (*core.SecurityList, string, error) { + if len(ids) < 1 { + return nil, "", errors.Errorf("no security lists") + } + + responses := make([]core.GetSecurityListResponse, len(ids)) + for i, id := range ids { + response, err := n.GetSecurityList(ctx, id) + if err != nil { + return nil, "", err + } + responses[i] = response + } + + sort.Slice(responses, func(i, j int) bool { + return responses[i].TimeCreated.Before(responses[j].TimeCreated.Time) + }) + + return &responses[0].SecurityList, *responses[0].Etag, nil +} + // securityListRulesChanged compares the ingress rules and egress rules against the rules in the security list. It checks that all the passed in egress & ingress rules // exist or not in the security list rules. If a rule does not exist then the rules have changed, so an update is required. -func securityListRulesChanged(securityList *baremetal.SecurityList, ingressRules []baremetal.IngressSecurityRule, egressRules []baremetal.EgressSecurityRule) bool { - if len(ingressRules) != len(securityList.IngressSecurityRules) || - len(egressRules) != len(securityList.EgressSecurityRules) { +func securityListRulesChanged(securityList *core.SecurityList, ingressRules []core.IngressSecurityRule, egressRules []core.EgressSecurityRule) bool { + if len(ingressRules) != len(securityList.IngressSecurityRules) || len(egressRules) != len(securityList.EgressSecurityRules) { return true } @@ -197,40 +208,38 @@ func securityListRulesChanged(securityList *baremetal.SecurityList, ingressRules } // updateSecurityListRules updates the security list rules and saves the security list in the cache upon successful update. -func (s *securityListManagerImpl) updateSecurityListRules(securityListID string, etag string, ingressRules []baremetal.IngressSecurityRule, egressRules []baremetal.EgressSecurityRule) error { - _, err := s.client.UpdateSecurityList(securityListID, &baremetal.UpdateSecurityListOptions{ - IfMatchDisplayNameOptions: baremetal.IfMatchDisplayNameOptions{ - IfMatchOptions: baremetal.IfMatchOptions{ - IfMatch: etag, - }, +func (s *securityListManagerImpl) updateSecurityListRules(ctx context.Context, id string, etag string, ingressRules []core.IngressSecurityRule, egressRules []core.EgressSecurityRule) error { + _, err := s.client.Networking().UpdateSecurityList(ctx, core.UpdateSecurityListRequest{ + SecurityListId: &id, + IfMatch: &etag, + UpdateSecurityListDetails: core.UpdateSecurityListDetails{ + IngressSecurityRules: ingressRules, + EgressSecurityRules: egressRules, }, - EgressRules: egressRules, - IngressRules: ingressRules, }) return err } -func getNodeIngressRules(rules []baremetal.IngressSecurityRule, lbSubnets []*baremetal.Subnet, port uint64, serviceLister listersv1.ServiceLister) []baremetal.IngressSecurityRule { +func getNodeIngressRules(rules []core.IngressSecurityRule, lbSubnets []*core.Subnet, port int, serviceLister listersv1.ServiceLister) []core.IngressSecurityRule { desired := sets.NewString() for _, lbSubnet := range lbSubnets { - desired.Insert(lbSubnet.CIDRBlock) + desired.Insert(*lbSubnet.CidrBlock) } - ingressRules := []baremetal.IngressSecurityRule{} + ingressRules := []core.IngressSecurityRule{} for _, rule := range rules { - if rule.TCPOptions == nil || rule.TCPOptions.SourcePortRange != nil || rule.TCPOptions.DestinationPortRange == nil || - rule.TCPOptions.DestinationPortRange.Min != port || - rule.TCPOptions.DestinationPortRange.Max != port { + if rule.TcpOptions == nil || rule.TcpOptions.SourcePortRange != nil || rule.TcpOptions.DestinationPortRange == nil || + *rule.TcpOptions.DestinationPortRange.Min != port || *rule.TcpOptions.DestinationPortRange.Max != port { // this rule doesn't apply to this service so nothing to do but keep it ingressRules = append(ingressRules, rule) continue } - if desired.Has(rule.Source) { + if desired.Has(*rule.Source) { // This rule still exists so lets keep it ingressRules = append(ingressRules, rule) - desired.Delete(rule.Source) + desired.Delete(*rule.Source) continue } @@ -269,23 +278,22 @@ func getNodeIngressRules(rules []baremetal.IngressSecurityRule, lbSubnets []*bar return ingressRules } -func getLoadBalancerIngressRules(rules []baremetal.IngressSecurityRule, sourceCIDRs []string, port uint64, serviceLister listersv1.ServiceLister) []baremetal.IngressSecurityRule { +func getLoadBalancerIngressRules(rules []core.IngressSecurityRule, sourceCIDRs []string, port int, serviceLister listersv1.ServiceLister) []core.IngressSecurityRule { desired := sets.NewString(sourceCIDRs...) - ingressRules := []baremetal.IngressSecurityRule{} + ingressRules := []core.IngressSecurityRule{} for _, rule := range rules { - if rule.TCPOptions == nil || rule.TCPOptions.SourcePortRange != nil || rule.TCPOptions.DestinationPortRange == nil || - rule.TCPOptions.DestinationPortRange.Min != port || - rule.TCPOptions.DestinationPortRange.Max != port { + if rule.TcpOptions == nil || rule.TcpOptions.SourcePortRange != nil || rule.TcpOptions.DestinationPortRange == nil || + *rule.TcpOptions.DestinationPortRange.Min != port || *rule.TcpOptions.DestinationPortRange.Max != port { // this rule doesn't apply to this service so nothing to do but keep it ingressRules = append(ingressRules, rule) continue } - if desired.Has(rule.Source) { + if desired.Has(*rule.Source) { // This rule still exists so lets keep it ingressRules = append(ingressRules, rule) - desired.Delete(rule.Source) + desired.Delete(*rule.Source) continue } @@ -324,26 +332,25 @@ func getLoadBalancerIngressRules(rules []baremetal.IngressSecurityRule, sourceCI return ingressRules } -func getLoadBalancerEgressRules(rules []baremetal.EgressSecurityRule, nodeSubnets []*baremetal.Subnet, port uint64, serviceLister listersv1.ServiceLister) []baremetal.EgressSecurityRule { +func getLoadBalancerEgressRules(rules []core.EgressSecurityRule, nodeSubnets []*core.Subnet, port int, serviceLister listersv1.ServiceLister) []core.EgressSecurityRule { nodeCIDRs := sets.NewString() for _, subnet := range nodeSubnets { - nodeCIDRs.Insert(subnet.CIDRBlock) + nodeCIDRs.Insert(*subnet.CidrBlock) } - egressRules := []baremetal.EgressSecurityRule{} + egressRules := []core.EgressSecurityRule{} for _, rule := range rules { - if rule.TCPOptions == nil || rule.TCPOptions.SourcePortRange != nil || rule.TCPOptions.DestinationPortRange == nil || - rule.TCPOptions.DestinationPortRange.Min != port || - rule.TCPOptions.DestinationPortRange.Max != port { + if rule.TcpOptions == nil || rule.TcpOptions.SourcePortRange != nil || rule.TcpOptions.DestinationPortRange == nil || + *rule.TcpOptions.DestinationPortRange.Min != port || *rule.TcpOptions.DestinationPortRange.Max != port { // this rule doesn't apply to this service so nothing to do but keep it egressRules = append(egressRules, rule) continue } - if nodeCIDRs.Has(rule.Destination) { + if nodeCIDRs.Has(*rule.Destination) { // This rule still exists so lets keep it egressRules = append(egressRules, rule) - nodeCIDRs.Delete(rule.Destination) + nodeCIDRs.Delete(*rule.Destination) continue } @@ -383,32 +390,32 @@ func getLoadBalancerEgressRules(rules []baremetal.EgressSecurityRule, nodeSubnet } // TODO(apryde): UDP support. -func makeEgressSecurityRule(cidrBlock string, port uint64) baremetal.EgressSecurityRule { - return baremetal.EgressSecurityRule{ - Destination: cidrBlock, - Protocol: fmt.Sprintf("%d", ProtocolTCP), - TCPOptions: &baremetal.TCPOptions{ - DestinationPortRange: &baremetal.PortRange{ - Min: port, - Max: port, +func makeEgressSecurityRule(cidrBlock string, port int) core.EgressSecurityRule { + return core.EgressSecurityRule{ + Destination: common.String(cidrBlock), + Protocol: common.String(fmt.Sprintf("%d", ProtocolTCP)), + TcpOptions: &core.TcpOptions{ + DestinationPortRange: &core.PortRange{ + Min: common.Int(port), + Max: common.Int(port), }, }, - IsStateless: false, + IsStateless: common.Bool(false), } } // TODO(apryde): UDP support. -func makeIngressSecurityRule(cidrBlock string, port uint64) baremetal.IngressSecurityRule { - return baremetal.IngressSecurityRule{ - Source: cidrBlock, - Protocol: fmt.Sprintf("%d", ProtocolTCP), - TCPOptions: &baremetal.TCPOptions{ - DestinationPortRange: &baremetal.PortRange{ - Min: port, - Max: port, +func makeIngressSecurityRule(cidrBlock string, port int) core.IngressSecurityRule { + return core.IngressSecurityRule{ + Source: common.String(cidrBlock), + Protocol: common.String(fmt.Sprintf("%d", ProtocolTCP)), + TcpOptions: &core.TcpOptions{ + DestinationPortRange: &core.PortRange{ + Min: common.Int(port), + Max: common.Int(port), }, }, - IsStateless: false, + IsStateless: common.Bool(false), } } @@ -460,11 +467,11 @@ func healthCheckPortInUse(serviceLister listersv1.ServiceLister, port int32) (bo // to use that feature. type securityListManagerNOOP struct{} -func (s *securityListManagerNOOP) Update(lbSubnets []*baremetal.Subnet, backendSubnets []*baremetal.Subnet, sourceCIDRs []string, listenerPort uint64, backendPort uint64, healthCheckPort uint64) error { +func (s *securityListManagerNOOP) Update(ctx context.Context, lbSubnets []*core.Subnet, backendSubnets []*core.Subnet, sourceCIDRs []string, listenerPort int, backendPort int, healthCheckPort int) error { return nil } -func (s *securityListManagerNOOP) Delete(lbSubnets []*baremetal.Subnet, backendSubnets []*baremetal.Subnet, listenerPort uint64, backendPort uint64, healthCheckPort uint64) error { +func (s *securityListManagerNOOP) Delete(ctx context.Context, lbSubnets []*core.Subnet, backendSubnets []*core.Subnet, listenerPort int, backendPort int, healthCheckPort int) error { return nil } diff --git a/pkg/oci/load_balancer_security_lists_test.go b/pkg/oci/load_balancer_security_lists_test.go index 1ca0d75c27..d88a8fa95c 100644 --- a/pkg/oci/load_balancer_security_lists_test.go +++ b/pkg/oci/load_balancer_security_lists_test.go @@ -18,7 +18,8 @@ import ( "reflect" "testing" - baremetal "github.com/oracle/bmcs-go-sdk" + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/core" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -26,81 +27,70 @@ import ( "k8s.io/client-go/tools/cache" ) -func TestGetBackendPort(t *testing.T) { - backends := []baremetal.Backend{ - {Port: 80}, - } - - port := getBackendPort(backends) - if port != 80 { - t.Errorf("expected port 80 but got %d", port) - } -} - func TestGetNodeIngressRules(t *testing.T) { testCases := []struct { name string - securityList *baremetal.SecurityList - lbSubnets []*baremetal.Subnet - port uint64 + securityList *core.SecurityList + lbSubnets []*core.Subnet + port int services []*v1.Service - expected []baremetal.IngressSecurityRule + expected []core.IngressSecurityRule }{ { name: "new ingress", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), }, }, - lbSubnets: []*baremetal.Subnet{ - {CIDRBlock: "1"}, - {CIDRBlock: "2"}, + lbSubnets: []*core.Subnet{ + {CidrBlock: common.String("1")}, + {CidrBlock: common.String("2")}, }, port: 80, services: []*v1.Service{}, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), }, }, { name: "no change", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), }, }, - lbSubnets: []*baremetal.Subnet{ - {CIDRBlock: "1"}, - {CIDRBlock: "2"}, + lbSubnets: []*core.Subnet{ + {CidrBlock: common.String("1")}, + {CidrBlock: common.String("2")}, }, port: 80, services: []*v1.Service{}, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), }, }, { name: "change lb subnet", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), makeIngressSecurityRule("existing", 9001), }, }, - lbSubnets: []*baremetal.Subnet{ - {CIDRBlock: "1"}, - {CIDRBlock: "3"}, + lbSubnets: []*core.Subnet{ + {CidrBlock: common.String("1")}, + {CidrBlock: common.String("3")}, }, port: 80, services: []*v1.Service{}, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("existing", 9001), @@ -108,29 +98,29 @@ func TestGetNodeIngressRules(t *testing.T) { }, }, { name: "remove lb subnets", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), makeIngressSecurityRule("existing", 9001), }, }, - lbSubnets: []*baremetal.Subnet{}, + lbSubnets: []*core.Subnet{}, port: 80, services: []*v1.Service{}, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("existing", 9001), }, }, { name: "do not delete a port rule which is used by another services (default) health check", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("0.0.0.0/0", lbNodesHealthCheckPort), }, }, - lbSubnets: []*baremetal.Subnet{}, + lbSubnets: []*core.Subnet{}, port: lbNodesHealthCheckPort, services: []*v1.Service{ { @@ -141,7 +131,7 @@ func TestGetNodeIngressRules(t *testing.T) { }, }, }, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("0.0.0.0/0", lbNodesHealthCheckPort), }, }, @@ -167,16 +157,16 @@ func TestGetNodeIngressRules(t *testing.T) { func TestGetLoadBalancerIngressRules(t *testing.T) { testCases := []struct { name string - securityList *baremetal.SecurityList + securityList *core.SecurityList sourceCIDRs []string - port uint64 + port int services []*v1.Service - expected []baremetal.IngressSecurityRule + expected []core.IngressSecurityRule }{ { name: "new source cidrs", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), }, }, @@ -186,15 +176,15 @@ func TestGetLoadBalancerIngressRules(t *testing.T) { }, port: 80, services: []*v1.Service{}, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), }, }, { name: "no change", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), @@ -206,15 +196,15 @@ func TestGetLoadBalancerIngressRules(t *testing.T) { }, port: 80, services: []*v1.Service{}, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), }, }, { name: "change source cidr", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), @@ -227,7 +217,7 @@ func TestGetLoadBalancerIngressRules(t *testing.T) { }, port: 80, services: []*v1.Service{}, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("existing", 9001), @@ -235,8 +225,8 @@ func TestGetLoadBalancerIngressRules(t *testing.T) { }, }, { name: "remove source cidrs", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 80), @@ -246,14 +236,14 @@ func TestGetLoadBalancerIngressRules(t *testing.T) { sourceCIDRs: []string{}, port: 80, services: []*v1.Service{}, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("existing", 9000), makeIngressSecurityRule("existing", 9001), }, }, { name: "do not delete a port rule which is in use by another service", - securityList: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + securityList: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("0.0.0.0/0", 80), }, }, @@ -268,7 +258,7 @@ func TestGetLoadBalancerIngressRules(t *testing.T) { }, }, }, - expected: []baremetal.IngressSecurityRule{ + expected: []core.IngressSecurityRule{ makeIngressSecurityRule("0.0.0.0/0", 80), }, }, @@ -294,67 +284,67 @@ func TestGetLoadBalancerIngressRules(t *testing.T) { func TestGetLoadBalancerEgressRules(t *testing.T) { testCases := []struct { name string - securityList *baremetal.SecurityList - subnets []*baremetal.Subnet - port uint64 + securityList *core.SecurityList + subnets []*core.Subnet + port int services []*v1.Service - expected []baremetal.EgressSecurityRule + expected []core.EgressSecurityRule }{ { name: "new egress", - securityList: &baremetal.SecurityList{ - EgressSecurityRules: []baremetal.EgressSecurityRule{ + securityList: &core.SecurityList{ + EgressSecurityRules: []core.EgressSecurityRule{ makeEgressSecurityRule("existing", 9000), }, }, - subnets: []*baremetal.Subnet{ - {CIDRBlock: "1"}, - {CIDRBlock: "2"}, + subnets: []*core.Subnet{ + {CidrBlock: common.String("1")}, + {CidrBlock: common.String("2")}, }, port: 80, services: []*v1.Service{}, - expected: []baremetal.EgressSecurityRule{ + expected: []core.EgressSecurityRule{ makeEgressSecurityRule("existing", 9000), makeEgressSecurityRule("1", 80), makeEgressSecurityRule("2", 80), }, }, { name: "no change", - securityList: &baremetal.SecurityList{ - EgressSecurityRules: []baremetal.EgressSecurityRule{ + securityList: &core.SecurityList{ + EgressSecurityRules: []core.EgressSecurityRule{ makeEgressSecurityRule("existing", 9000), makeEgressSecurityRule("1", 80), makeEgressSecurityRule("2", 80), }, }, - subnets: []*baremetal.Subnet{ - {CIDRBlock: "1"}, - {CIDRBlock: "2"}, + subnets: []*core.Subnet{ + {CidrBlock: common.String("1")}, + {CidrBlock: common.String("2")}, }, port: 80, services: []*v1.Service{}, - expected: []baremetal.EgressSecurityRule{ + expected: []core.EgressSecurityRule{ makeEgressSecurityRule("existing", 9000), makeEgressSecurityRule("1", 80), makeEgressSecurityRule("2", 80), }, }, { name: "change node subnet", - securityList: &baremetal.SecurityList{ - EgressSecurityRules: []baremetal.EgressSecurityRule{ + securityList: &core.SecurityList{ + EgressSecurityRules: []core.EgressSecurityRule{ makeEgressSecurityRule("existing", 9000), makeEgressSecurityRule("1", 80), makeEgressSecurityRule("2", 80), makeEgressSecurityRule("existing", 9001), }, }, - subnets: []*baremetal.Subnet{ - {CIDRBlock: "1"}, - {CIDRBlock: "3"}, + subnets: []*core.Subnet{ + {CidrBlock: common.String("1")}, + {CidrBlock: common.String("3")}, }, port: 80, services: []*v1.Service{}, - expected: []baremetal.EgressSecurityRule{ + expected: []core.EgressSecurityRule{ makeEgressSecurityRule("existing", 9000), makeEgressSecurityRule("1", 80), makeEgressSecurityRule("existing", 9001), @@ -362,29 +352,29 @@ func TestGetLoadBalancerEgressRules(t *testing.T) { }, }, { name: "remove node subnets", - securityList: &baremetal.SecurityList{ - EgressSecurityRules: []baremetal.EgressSecurityRule{ + securityList: &core.SecurityList{ + EgressSecurityRules: []core.EgressSecurityRule{ makeEgressSecurityRule("existing", 9000), makeEgressSecurityRule("1", 80), makeEgressSecurityRule("2", 80), makeEgressSecurityRule("existing", 9001), }, }, - subnets: []*baremetal.Subnet{}, + subnets: []*core.Subnet{}, port: 80, services: []*v1.Service{}, - expected: []baremetal.EgressSecurityRule{ + expected: []core.EgressSecurityRule{ makeEgressSecurityRule("existing", 9000), makeEgressSecurityRule("existing", 9001), }, }, { name: "do not delete a port rule which is used by another services (default) health check", - securityList: &baremetal.SecurityList{ - EgressSecurityRules: []baremetal.EgressSecurityRule{ + securityList: &core.SecurityList{ + EgressSecurityRules: []core.EgressSecurityRule{ makeEgressSecurityRule("0.0.0.0/0", lbNodesHealthCheckPort), }, }, - subnets: []*baremetal.Subnet{}, + subnets: []*core.Subnet{}, port: lbNodesHealthCheckPort, services: []*v1.Service{ { @@ -395,7 +385,7 @@ func TestGetLoadBalancerEgressRules(t *testing.T) { }, }, }, - expected: []baremetal.EgressSecurityRule{ + expected: []core.EgressSecurityRule{ makeEgressSecurityRule("0.0.0.0/0", lbNodesHealthCheckPort), }, }, @@ -420,9 +410,9 @@ func TestGetLoadBalancerEgressRules(t *testing.T) { func TestMakeIngressSecurityRuleHasProtocolOptions(t *testing.T) { cdirRange := "10.0.0.0/16" - port := uint64(80) + port := 80 rule := makeIngressSecurityRule(cdirRange, port) - if rule.TCPOptions == nil && rule.UDPOptions == nil { + if rule.TcpOptions == nil && rule.UdpOptions == nil { t.Errorf("makeIngressSecurityRule(%q, %d) did not set protocol options", cdirRange, port) } @@ -430,9 +420,9 @@ func TestMakeIngressSecurityRuleHasProtocolOptions(t *testing.T) { func TestMakeEgressSecurityRuleHasProtocolOptions(t *testing.T) { cdirRange := "10.0.0.0/16" - port := uint64(80) + port := 80 rule := makeEgressSecurityRule(cdirRange, port) - if rule.TCPOptions == nil && rule.UDPOptions == nil { + if rule.TcpOptions == nil && rule.UdpOptions == nil { t.Errorf("makeEgressSecurityRule(%q, %d) did not set protocol options", cdirRange, port) } @@ -440,72 +430,72 @@ func TestMakeEgressSecurityRuleHasProtocolOptions(t *testing.T) { func TestSecurityListRulesChanged(t *testing.T) { testCases := map[string]struct { - list *baremetal.SecurityList - ingress []baremetal.IngressSecurityRule - egress []baremetal.EgressSecurityRule + list *core.SecurityList + ingress []core.IngressSecurityRule + egress []core.EgressSecurityRule expected bool }{ "no change": { - list: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + list: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("1", 80), }, - EgressSecurityRules: []baremetal.EgressSecurityRule{ + EgressSecurityRules: []core.EgressSecurityRule{ makeEgressSecurityRule("1", 80), }, }, - ingress: []baremetal.IngressSecurityRule{ + ingress: []core.IngressSecurityRule{ makeIngressSecurityRule("1", 80), }, - egress: []baremetal.EgressSecurityRule{ + egress: []core.EgressSecurityRule{ makeEgressSecurityRule("1", 80), }, expected: false, }, "change ingress - add": { - list: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + list: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("1", 80), }, }, - ingress: []baremetal.IngressSecurityRule{ + ingress: []core.IngressSecurityRule{ makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 81), }, expected: true, }, "change ingress - remove": { - list: &baremetal.SecurityList{ - IngressSecurityRules: []baremetal.IngressSecurityRule{ + list: &core.SecurityList{ + IngressSecurityRules: []core.IngressSecurityRule{ makeIngressSecurityRule("1", 80), makeIngressSecurityRule("2", 81), }, }, - ingress: []baremetal.IngressSecurityRule{ + ingress: []core.IngressSecurityRule{ makeIngressSecurityRule("1", 80), }, expected: true, }, "change egress - add": { - list: &baremetal.SecurityList{ - EgressSecurityRules: []baremetal.EgressSecurityRule{ + list: &core.SecurityList{ + EgressSecurityRules: []core.EgressSecurityRule{ makeEgressSecurityRule("1", 80), }, }, - egress: []baremetal.EgressSecurityRule{ + egress: []core.EgressSecurityRule{ makeEgressSecurityRule("1", 80), makeEgressSecurityRule("2", 81), }, expected: true, }, "change egress - remove": { - list: &baremetal.SecurityList{ - EgressSecurityRules: []baremetal.EgressSecurityRule{ + list: &core.SecurityList{ + EgressSecurityRules: []core.EgressSecurityRule{ makeEgressSecurityRule("1", 80), makeEgressSecurityRule("2", 81), }, }, - egress: []baremetal.EgressSecurityRule{ + egress: []core.EgressSecurityRule{ makeEgressSecurityRule("1", 80), }, expected: true, @@ -535,26 +525,26 @@ func TestDelete(t *testing.T) { // "lb-subnet-1", // "lb-subnet-2", // } - // lbSubnets := []*baremetal.Subnet{ + // lbSubnets := []*core.Subnet{ // { // ID: "lb-subnet-1", - // CIDRBlock: "lb-subnet-1", + // CidrBlock: "lb-subnet-1", // }, // { // ID: "lb-subnet-2", - // CIDRBlock: "lb-subnet-2", + // CidrBlock: "lb-subnet-2", // }, // } - // lbSecurityLists := []*baremetal.SecurityList{ + // lbSecurityLists := []*core.SecurityList{ // { // ID: "lb-subnet-1", - // IngressSecurityRules: []baremetal.IngressSecurityRule{}, - // EgressSecurityRules: []baremetal.EgressSecurityRule{}, + // IngressSecurityRules: []core.IngressSecurityRule{}, + // EgressSecurityRules: []core.EgressSecurityRule{}, // }, // { // ID: "lb-subnet-2", - // IngressSecurityRules: []baremetal.IngressSecurityRule{}, - // EgressSecurityRules: []baremetal.EgressSecurityRule{}, + // IngressSecurityRules: []core.IngressSecurityRule{}, + // EgressSecurityRules: []core.EgressSecurityRule{}, // }, // } diff --git a/pkg/oci/load_balancer_spec.go b/pkg/oci/load_balancer_spec.go index 9aa7714d36..9bdf296c00 100644 --- a/pkg/oci/load_balancer_spec.go +++ b/pkg/oci/load_balancer_spec.go @@ -15,177 +15,231 @@ package oci import ( - "errors" "fmt" - "github.com/golang/glog" + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/loadbalancer" + "github.com/pkg/errors" - baremetal "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/util" api "k8s.io/api/core/v1" + sets "k8s.io/apimachinery/pkg/util/sets" apiservice "k8s.io/kubernetes/pkg/api/v1/service" + + "github.com/oracle/oci-cloud-controller-manager/pkg/oci/util" ) +type sslSecretReader interface { + readSSLSecret(svc *api.Service) (cert, key string, err error) +} + +type noopSSLSecretReader struct{} + +func (ssr noopSSLSecretReader) readSSLSecret(svc *api.Service) (cert, key string, err error) { + return "", "", nil +} + +// SSLConfig is a description of a SSL certificate. +type SSLConfig struct { + Name string + Ports sets.Int + + sslSecretReader +} + +func needsCerts(svc *api.Service) bool { + _, ok := svc.Annotations[ServiceAnnotationLoadBalancerSSLPorts] + return ok +} + +// NewSSLConfig constructs a new SSLConfig. +func NewSSLConfig(name string, ports []int, ssr sslSecretReader) *SSLConfig { + if ssr == nil { + ssr = noopSSLSecretReader{} + } + return &SSLConfig{ + Name: name, + Ports: sets.NewInt(ports...), + sslSecretReader: ssr, + } +} + // LBSpec holds the data required to build a OCI load balancer from a // kubernetes service. type LBSpec struct { Name string Shape string - Service *api.Service Nodes []*api.Node Subnets []string Internal bool -} -// NewLBSpec creates a LB Spec from a kubernetes service and a slice of nodes. -func NewLBSpec(cp *CloudProvider, service *api.Service, nodes []*api.Node) (LBSpec, error) { - if err := validateProtocols(service.Spec.Ports); err != nil { - return LBSpec{}, err - } + SSLConfig *SSLConfig + service *api.Service +} - if service.Spec.SessionAffinity != api.ServiceAffinityNone { - return LBSpec{}, errors.New("OCI only supports SessionAffinity `None` currently") +// NewLBSpec creates a LB Spec from a Kubernetes service and a slice of nodes. +func NewLBSpec(service *api.Service, nodes []*api.Node, defaultSubnets []string, sslCfg *SSLConfig) (LBSpec, error) { + if len(defaultSubnets) != 2 { + return LBSpec{}, errors.New("defualt subnets incorrectly configured") } - if service.Spec.LoadBalancerIP != "" { - // TODO(horwitz): We need to figure out in the WG if this should actually log or error. - // The docs say: If the loadBalancerIP is specified, but the cloud provider does not support the feature, the field will be ignored. - // But no one does that... - // https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer - return LBSpec{}, errors.New("OCI does not support setting the LoadBalancerIP") + if err := validateService(service); err != nil { + return LBSpec{}, err } - spec := LBSpec{ - Name: GetLoadBalancerName(service), - Shape: lbDefaultShape, - Service: service, - Nodes: nodes, - Internal: false, - } - - _, ok := service.Annotations[ServiceAnnotationLoadBalancerInternal] - if ok { - spec.Internal = true - } + _, internal := service.Annotations[ServiceAnnotationLoadBalancerInternal] // TODO (apryde): We should detect when this changes and WARN as we don't // support updating a load balancer's Shape. - lbShape, ok := service.Annotations[ServiceAnnotationLoadBalancerShape] - if ok { - spec.Shape = lbShape + shape := lbDefaultShape + if s, ok := service.Annotations[ServiceAnnotationLoadBalancerShape]; ok { + shape = s } // NOTE: These will be overridden for existing load balancers as load // balancer subnets cannot be modified. - subnet1, ok := service.Annotations[ServiceAnnotationLoadBalancerSubnet1] - if !ok { - subnet1 = cp.config.LoadBalancer.Subnet1 + subnets := defaultSubnets + if s, ok := service.Annotations[ServiceAnnotationLoadBalancerSubnet1]; ok { + subnets[0] = s + } + if s, ok := service.Annotations[ServiceAnnotationLoadBalancerSubnet2]; ok { + subnets[1] = s } - spec.Subnets = append(spec.Subnets, subnet1) + if internal { + // Only public load balancers need two subnets. Internal load + // balancers will always use the first subnet. + subnets = subnets[:1] + } + + return LBSpec{ + Name: GetLoadBalancerName(service), + Shape: shape, + Nodes: nodes, + Internal: internal, + Subnets: subnets, + + service: service, + SSLConfig: sslCfg, + }, nil +} - subnet2, ok := service.Annotations[ServiceAnnotationLoadBalancerSubnet2] - if !ok { - subnet2 = cp.config.LoadBalancer.Subnet2 +// TODO(apryde): aggragate errors using an error list. +func validateService(svc *api.Service) error { + if err := validateProtocols(svc.Spec.Ports); err != nil { + return err } - if !spec.Internal { - // Only public load balancers need two subnets. - // Internal load balancers will always use the first subnet - spec.Subnets = append(spec.Subnets, subnet2) + if svc.Spec.SessionAffinity != api.ServiceAffinityNone { + return errors.New("OCI only supports SessionAffinity `None` currently") } - return spec, nil + if svc.Spec.LoadBalancerIP != "" { + // TODO(horwitz): We need to figure out in the WG if this should actually log or error. + // The docs say: If the loadBalancerIP is specified, but the cloud provider does not support the feature, the field will be ignored. + // But no one does that... + // https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer + return errors.New("OCI does not support setting the LoadBalancerIP") + } + + return nil } func getBackendSetName(protocol string, port int) string { return fmt.Sprintf("%s-%d", protocol, port) } +func (s *LBSpec) getBackends(nodePort int32) []loadbalancer.BackendDetails { + backends := make([]loadbalancer.BackendDetails, len(s.Nodes)) + for i, node := range s.Nodes { + backends[i] = loadbalancer.BackendDetails{ + IpAddress: common.String(util.NodeInternalIP(node)), + Port: common.Int(int(nodePort)), + Weight: common.Int(1), + } + } + return backends +} + // GetBackendSets builds a map of BackendSets based on the LBSpec. -func (s *LBSpec) GetBackendSets() map[string]baremetal.BackendSet { - backendSets := make(map[string]baremetal.BackendSet) - for _, servicePort := range s.Service.Spec.Ports { +func (s *LBSpec) GetBackendSets() map[string]loadbalancer.BackendSetDetails { + backendSets := make(map[string]loadbalancer.BackendSetDetails) + for _, servicePort := range s.service.Spec.Ports { name := getBackendSetName(string(servicePort.Protocol), int(servicePort.Port)) - backendSet := baremetal.BackendSet{ - Name: name, - Policy: client.DefaultLoadBalancerPolicy, - Backends: []baremetal.Backend{}, + backendSets[name] = loadbalancer.BackendSetDetails{ + Policy: common.String(DefaultLoadBalancerPolicy), + Backends: s.getBackends(servicePort.NodePort), HealthChecker: s.getHealthChecker(), } - for _, node := range s.Nodes { - backendSet.Backends = append(backendSet.Backends, baremetal.Backend{ - IPAddress: util.NodeInternalIP(node), - Port: int(servicePort.NodePort), - Weight: 1, - }) - } - backendSets[name] = backendSet + } return backendSets } -func (s *LBSpec) getHealthChecker() *baremetal.HealthChecker { - path, port := apiservice.GetServiceHealthCheckPathPort(s.Service) +func (s *LBSpec) getHealthChecker() *loadbalancer.HealthCheckerDetails { + path, port := apiservice.GetServiceHealthCheckPathPort(s.service) if path != "" { - return &baremetal.HealthChecker{ - Protocol: lbNodesHealthCheckProto, - URLPath: path, - Port: int(port), + return &loadbalancer.HealthCheckerDetails{ + Protocol: common.String(lbNodesHealthCheckProto), + UrlPath: &path, + Port: common.Int(int(port)), } } - return &baremetal.HealthChecker{ - Protocol: lbNodesHealthCheckProto, - URLPath: lbNodesHealthCheckPath, - Port: lbNodesHealthCheckPort, + return &loadbalancer.HealthCheckerDetails{ + Protocol: common.String(lbNodesHealthCheckProto), + UrlPath: common.String(lbNodesHealthCheckPath), + Port: common.Int(lbNodesHealthCheckPort), + } +} + +func (s *LBSpec) getSSLConfiguration(port int) *loadbalancer.SslConfigurationDetails { + if s.SSLConfig == nil || !s.SSLConfig.Ports.Has(port) { + return nil + } + return &loadbalancer.SslConfigurationDetails{ + CertificateName: &s.SSLConfig.Name, + VerifyDepth: common.Int(0), + VerifyPeerCertificate: common.Bool(false), } } -// GetSSLConfig builds a map of SSL configuration per listener port based on -// the LBSpec. -func (s *LBSpec) GetSSLConfig(certificateName string) (map[int]*baremetal.SSLConfiguration, error) { - sslConfigMap := make(map[int]*baremetal.SSLConfiguration) +// GetCertificates builds a map of required SSL certificates. +func (s *LBSpec) GetCertificates() (map[string]loadbalancer.CertificateDetails, error) { + certs := make(map[string]loadbalancer.CertificateDetails) + if s.SSLConfig == nil { + return certs, nil + } - sslEnabledPorts, err := getSSLEnabledPorts(s.Service.ObjectMeta.Annotations) + cert, key, err := s.SSLConfig.readSSLSecret(s.service) if err != nil { - return nil, err + return nil, errors.Wrap(err, "reading SSL Secret") } - - if len(sslEnabledPorts) == 0 { - glog.V(4).Infof("No SSL enabled ports found for service %q", s.Service.Name) - return sslConfigMap, nil + if cert == "" || key == "" { + return certs, nil } - for _, servicePort := range s.Service.Spec.Ports { - port := int(servicePort.Port) - if _, ok := sslEnabledPorts[port]; ok { - sslConfigMap[port] = &baremetal.SSLConfiguration{ - CertificateName: certificateName, - VerifyDepth: 0, - VerifyPeerCertificate: false, - } - } + certs[s.SSLConfig.Name] = loadbalancer.CertificateDetails{ + CertificateName: &s.SSLConfig.Name, + PublicCertificate: &cert, + PrivateKey: &key, } - return sslConfigMap, nil + + return certs, nil } // GetListeners builds a map of listeners based on the LBSpec. -func (s *LBSpec) GetListeners(sslConfigMap map[int]*baremetal.SSLConfiguration) map[string]baremetal.Listener { - listeners := make(map[string]baremetal.Listener) - for _, servicePort := range s.Service.Spec.Ports { +func (s *LBSpec) GetListeners() map[string]loadbalancer.ListenerDetails { + listeners := make(map[string]loadbalancer.ListenerDetails) + for _, servicePort := range s.service.Spec.Ports { protocol := string(servicePort.Protocol) port := int(servicePort.Port) - sslConfig := sslConfigMap[port] - name := getListenerName(protocol, port, sslConfig) - listener := baremetal.Listener{ - Name: name, - DefaultBackendSetName: getBackendSetName(string(servicePort.Protocol), int(servicePort.Port)), - Protocol: protocol, - Port: port, - SSLConfig: sslConfig, + sslConfiguration := s.getSSLConfiguration(port) + name := getListenerName(protocol, port, sslConfiguration) + listeners[name] = loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String(getBackendSetName(string(servicePort.Protocol), int(servicePort.Port))), + Protocol: &protocol, + Port: &port, + SslConfiguration: sslConfiguration, } - listeners[name] = listener } return listeners } diff --git a/pkg/oci/load_balancer_spec_test.go b/pkg/oci/load_balancer_spec_test.go index 53ba79f04a..29344cf6f1 100644 --- a/pkg/oci/load_balancer_spec_test.go +++ b/pkg/oci/load_balancer_spec_test.go @@ -18,7 +18,6 @@ import ( "reflect" "testing" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" api "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -139,16 +138,9 @@ func TestNewLBSpecSuccess(t *testing.T) { for name, tc := range testCases { t.Run(name, func(t *testing.T) { // we expect the service to be unchanged - tc.expected.Service = tc.service - cp := &CloudProvider{ - config: &client.Config{ - LoadBalancer: client.LoadBalancerConfig{ - Subnet1: tc.defaultSubnetOne, - Subnet2: tc.defaultSubnetTwo, - }, - }, - } - result, err := NewLBSpec(cp, tc.service, tc.nodes) + tc.expected.service = tc.service + subnets := []string{tc.defaultSubnetOne, tc.defaultSubnetTwo} + result, err := NewLBSpec(tc.service, tc.nodes, subnets, nil) if err != nil { t.Error(err) } @@ -204,15 +196,8 @@ func TestNewLBSpecFailure(t *testing.T) { for name, tc := range testCases { t.Run(name, func(t *testing.T) { - cp := &CloudProvider{ - config: &client.Config{ - LoadBalancer: client.LoadBalancerConfig{ - Subnet1: tc.defaultSubnetOne, - Subnet2: tc.defaultSubnetTwo, - }, - }, - } - _, err := NewLBSpec(cp, tc.service, tc.nodes) + subnets := []string{tc.defaultSubnetOne, tc.defaultSubnetTwo} + _, err := NewLBSpec(tc.service, tc.nodes, subnets, nil) if err == nil || err.Error() != tc.expectedErrMsg { t.Errorf("Expected error with message %q but got `%v`", tc.expectedErrMsg, err) } diff --git a/pkg/oci/load_balancer_util.go b/pkg/oci/load_balancer_util.go index 1c653e2376..af38528723 100644 --- a/pkg/oci/load_balancer_util.go +++ b/pkg/oci/load_balancer_util.go @@ -17,13 +17,12 @@ package oci import ( "fmt" "os" - "reflect" "sort" "strconv" "strings" "github.com/golang/glog" - baremetal "github.com/oracle/bmcs-go-sdk" + "github.com/oracle/oci-go-sdk/loadbalancer" api "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/sets" @@ -60,7 +59,9 @@ type BackendSetAction struct { Action actionType ActionType - BackendSet baremetal.BackendSet + name string + + BackendSet loadbalancer.BackendSetDetails } // Type of the Action. @@ -70,7 +71,7 @@ func (b *BackendSetAction) Type() ActionType { // Name of the action's object. func (b *BackendSetAction) Name() string { - return b.BackendSet.Name + return b.name } func (b *BackendSetAction) String() string { @@ -82,7 +83,9 @@ type ListenerAction struct { Action actionType ActionType - Listener baremetal.Listener + name string + + Listener loadbalancer.ListenerDetails } // Type of the Action. @@ -92,21 +95,74 @@ func (l *ListenerAction) Type() ActionType { // Name of the action's object. func (l *ListenerAction) Name() string { - return l.Listener.Name + return l.name } func (l *ListenerAction) String() string { return fmt.Sprintf("ListenerAction:{Name: %s, Type: %v }", l.Name(), l.actionType) } +func toBool(b *bool) bool { + if b == nil { + return false + } + return *b +} + +func toString(s *string) string { + if s == nil { + return "" + } + return *s +} + +func toInt(i *int) int { + if i == nil { + return 0 + } + return *i +} + +func hasHealthCheckerChanged(actual *loadbalancer.HealthChecker, desired *loadbalancer.HealthCheckerDetails) bool { + if actual == nil { + return !(desired == nil) + } + + if toInt(actual.Port) != toInt(desired.Port) { + return false + } + + if toString(actual.ResponseBodyRegex) != toString(desired.ResponseBodyRegex) { + return false + } + + if toInt(actual.Retries) != toInt(desired.Retries) { + return false + } + + if toInt(actual.ReturnCode) != toInt(desired.ReturnCode) { + return false + } + + if toInt(actual.TimeoutInMillis) != toInt(desired.TimeoutInMillis) { + return false + } + + if toString(actual.UrlPath) != toString(desired.UrlPath) { + return false + } + + return true +} + // TODO(horwitz): this doesn't check weight which we may want in the future to // evenly distribute Local traffic policy load. -func hasBackendSetChanged(actual, desired baremetal.BackendSet) bool { - if !reflect.DeepEqual(actual.HealthChecker, desired.HealthChecker) { +func hasBackendSetChanged(actual loadbalancer.BackendSet, desired loadbalancer.BackendSetDetails) bool { + if hasHealthCheckerChanged(actual.HealthChecker, desired.HealthChecker) { return true } - if actual.Policy != desired.Policy { + if toString(actual.Policy) != toString(desired.Policy) { return true } @@ -120,12 +176,12 @@ func hasBackendSetChanged(actual, desired baremetal.BackendSet) bool { // else there has been change. desiredSet := sets.NewString() for _, backend := range desired.Backends { - name := fmt.Sprintf(nameFormat, backend.IPAddress, backend.Port) + name := fmt.Sprintf(nameFormat, *backend.IpAddress, *backend.Port) desiredSet.Insert(name) } for _, backend := range actual.Backends { - name := fmt.Sprintf(nameFormat, backend.IPAddress, backend.Port) + name := fmt.Sprintf(nameFormat, *backend.IpAddress, *backend.Port) if !desiredSet.Has(name) { return true } @@ -134,15 +190,64 @@ func hasBackendSetChanged(actual, desired baremetal.BackendSet) bool { return false } -func getBackendSetChanges(actual, desired map[string]baremetal.BackendSet) []Action { +func healthCheckerToDetails(hc *loadbalancer.HealthChecker) *loadbalancer.HealthCheckerDetails { + if hc == nil { + return nil + } + return &loadbalancer.HealthCheckerDetails{ + Protocol: hc.Protocol, + IntervalInMillis: hc.IntervalInMillis, + Port: hc.Port, + ResponseBodyRegex: hc.ResponseBodyRegex, + Retries: hc.Retries, + ReturnCode: hc.ReturnCode, + TimeoutInMillis: hc.TimeoutInMillis, + UrlPath: hc.UrlPath, + } +} + +func sslConfigurationToDetails(sc *loadbalancer.SslConfiguration) *loadbalancer.SslConfigurationDetails { + if sc == nil { + return nil + } + return &loadbalancer.SslConfigurationDetails{ + CertificateName: sc.CertificateName, + VerifyDepth: sc.VerifyDepth, + VerifyPeerCertificate: sc.VerifyPeerCertificate, + } +} + +func backendsToBackendDetails(bs []loadbalancer.Backend) []loadbalancer.BackendDetails { + backends := make([]loadbalancer.BackendDetails, len(bs)) + for i, backend := range bs { + backends[i] = loadbalancer.BackendDetails{ + IpAddress: backend.IpAddress, + Port: backend.Port, + Backup: backend.Backup, + Drain: backend.Drain, + Offline: backend.Offline, + Weight: backend.Weight, + } + } + return backends +} + +func getBackendSetChanges(actual map[string]loadbalancer.BackendSet, desired map[string]loadbalancer.BackendSetDetails) []Action { var backendSetActions []Action // First check to see if any backendsets need to be deleted or updated. for name, actualBackendSet := range actual { desiredBackendSet, ok := desired[name] if !ok { - // No longer exists. + // No longer exists backendSetActions = append(backendSetActions, &BackendSetAction{ - BackendSet: actualBackendSet, + name: *actualBackendSet.Name, + BackendSet: loadbalancer.BackendSetDetails{ + HealthChecker: healthCheckerToDetails(actualBackendSet.HealthChecker), + Policy: actualBackendSet.Policy, + Backends: backendsToBackendDetails(actualBackendSet.Backends), + SessionPersistenceConfiguration: actualBackendSet.SessionPersistenceConfiguration, + SslConfiguration: sslConfigurationToDetails(actualBackendSet.SslConfiguration), + }, actionType: Delete, }) continue @@ -150,6 +255,7 @@ func getBackendSetChanges(actual, desired map[string]baremetal.BackendSet) []Act if hasBackendSetChanged(actualBackendSet, desiredBackendSet) { backendSetActions = append(backendSetActions, &BackendSetAction{ + name: name, BackendSet: desiredBackendSet, actionType: Update, }) @@ -161,6 +267,7 @@ func getBackendSetChanges(actual, desired map[string]baremetal.BackendSet) []Act if _, ok := actual[name]; !ok { // Doesn't exist so lets create it. backendSetActions = append(backendSetActions, &BackendSetAction{ + name: name, BackendSet: desiredBackendSet, actionType: Create, }) @@ -170,11 +277,43 @@ func getBackendSetChanges(actual, desired map[string]baremetal.BackendSet) []Act return backendSetActions } -func hasListenerChanged(actual, desired baremetal.Listener) bool { - return !reflect.DeepEqual(actual, desired) +func hasSSLConfigurationChanged(actual *loadbalancer.SslConfiguration, desired *loadbalancer.SslConfigurationDetails) bool { + if actual == nil || desired == nil { + if actual == nil && desired == nil { + return false + } + return true + } + + if toString(actual.CertificateName) != toString(desired.CertificateName) { + return true + } + if toInt(actual.VerifyDepth) != toInt(desired.VerifyDepth) { + return true + } + if toBool(actual.VerifyPeerCertificate) != toBool(desired.VerifyPeerCertificate) { + return true + } + return false } -func getListenerChanges(actual, desired map[string]baremetal.Listener) []Action { +func hasListenerChanged(actual loadbalancer.Listener, desired loadbalancer.ListenerDetails) bool { + if toString(actual.DefaultBackendSetName) != toString(desired.DefaultBackendSetName) { + return true + } + if toInt(actual.Port) != toInt(desired.Port) { + return true + } + if toString(actual.Protocol) != toString(desired.Protocol) { + return true + } + if hasSSLConfigurationChanged(actual.SslConfiguration, desired.SslConfiguration) { + return true + } + return false +} + +func getListenerChanges(actual map[string]loadbalancer.Listener, desired map[string]loadbalancer.ListenerDetails) []Action { var listenerActions []Action // First check to see if any listeners need to be deleted or updated. for name, actualListener := range actual { @@ -182,7 +321,13 @@ func getListenerChanges(actual, desired map[string]baremetal.Listener) []Action if !ok { // no longer exists listenerActions = append(listenerActions, &ListenerAction{ - Listener: actualListener, + Listener: loadbalancer.ListenerDetails{ + DefaultBackendSetName: actualListener.DefaultBackendSetName, + Port: actualListener.Port, + Protocol: actualListener.Protocol, + SslConfiguration: sslConfigurationToDetails(actualListener.SslConfiguration), + }, + name: name, actionType: Delete, }) continue @@ -191,6 +336,7 @@ func getListenerChanges(actual, desired map[string]baremetal.Listener) []Action if hasListenerChanged(actualListener, desiredListener) { listenerActions = append(listenerActions, &ListenerAction{ Listener: desiredListener, + name: name, actionType: Update, }) } @@ -202,6 +348,7 @@ func getListenerChanges(actual, desired map[string]baremetal.Listener) []Action // doesn't exist so lets create it listenerActions = append(listenerActions, &ListenerAction{ Listener: desiredListener, + name: name, actionType: Create, }) } @@ -210,13 +357,13 @@ func getListenerChanges(actual, desired map[string]baremetal.Listener) []Action return listenerActions } -func sslEnabled(sslConfigMap map[int]*baremetal.SSLConfiguration) bool { +func sslEnabled(sslConfigMap map[int]*loadbalancer.SslConfiguration) bool { return len(sslConfigMap) > 0 } -func getListenerName(protocol string, port int, sslConfig *baremetal.SSLConfiguration) string { +func getListenerName(protocol string, port int, sslConfig *loadbalancer.SslConfigurationDetails) string { if sslConfig != nil { - return fmt.Sprintf("%s-%d-%s", protocol, port, sslConfig.CertificateName) + return fmt.Sprintf("%s-%d-%s", protocol, port, *sslConfig.CertificateName) } return fmt.Sprintf("%s-%d", protocol, port) } @@ -250,23 +397,23 @@ func validateProtocols(servicePorts []api.ServicePort) error { return nil } -// getSSLEnabledPorts returns a set (implemented as a map) of port numbers for -// which we need to enable SSL on the corresponding listener. -func getSSLEnabledPorts(annotations map[string]string) (map[int]bool, error) { - sslPortsAnnotation, ok := annotations[ServiceAnnotationLoadBalancerSSLPorts] - if !ok { - return nil, nil +// getSSLEnabledPorts returns a list of port numbers for which we need to enable +// SSL on the corresponding listener. +func getSSLEnabledPorts(svc *api.Service) ([]int, error) { + ports := []int{} + annotation, ok := svc.Annotations[ServiceAnnotationLoadBalancerSSLPorts] + if !ok || annotation == "" { + return ports, nil } - sslPorts := make(map[int]bool) - for _, sslPort := range strings.Split(sslPortsAnnotation, ",") { - i, err := strconv.Atoi(strings.TrimSpace(sslPort)) + for _, s := range strings.Split(annotation, ",") { + port, err := strconv.Atoi(strings.TrimSpace(s)) if err != nil { return nil, fmt.Errorf("parse SSL port: %v", err) } - sslPorts[i] = true + ports = append(ports, port) } - return sslPorts, nil + return ports, nil } // parseSecretString returns the secret name and secret namespace from the @@ -317,9 +464,3 @@ func sortAndCombineActions(backendSetActions []Action, listenerActions []Action) }) return actions } - -func getBackendPort(backends []baremetal.Backend) uint64 { - // TODO: what happens if this is 0? e.g. we scale the pods to 0 for a - // deployment. - return uint64(backends[0].Port) -} diff --git a/pkg/oci/load_balancer_util_test.go b/pkg/oci/load_balancer_util_test.go index 75cfc604c1..159079a454 100644 --- a/pkg/oci/load_balancer_util_test.go +++ b/pkg/oci/load_balancer_util_test.go @@ -22,7 +22,8 @@ import ( api "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - baremetal "github.com/oracle/bmcs-go-sdk" + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/loadbalancer" ) func TestSortAndCombineActions(t *testing.T) { @@ -34,120 +35,144 @@ func TestSortAndCombineActions(t *testing.T) { "create": { backendSetActions: []Action{ &BackendSetAction{ + name: "TCP-80", actionType: Create, - BackendSet: baremetal.BackendSet{Name: "TCP-80"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, &BackendSetAction{ + name: "TCP-443", actionType: Create, - BackendSet: baremetal.BackendSet{Name: "TCP-443"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, }, listenerActions: []Action{ &ListenerAction{ + name: "TCP-443", actionType: Create, - Listener: baremetal.Listener{Name: "TCP-443"}, + Listener: loadbalancer.ListenerDetails{}, }, &ListenerAction{ + name: "TCP-80", actionType: Create, - Listener: baremetal.Listener{Name: "TCP-80"}, + Listener: loadbalancer.ListenerDetails{}, }, }, expected: []Action{ &BackendSetAction{ + name: "TCP-443", actionType: Create, - BackendSet: baremetal.BackendSet{Name: "TCP-443"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, &ListenerAction{ + name: "TCP-443", actionType: Create, - Listener: baremetal.Listener{Name: "TCP-443"}, + Listener: loadbalancer.ListenerDetails{}, }, &BackendSetAction{ + name: "TCP-80", actionType: Create, - BackendSet: baremetal.BackendSet{Name: "TCP-80"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, &ListenerAction{ + name: "TCP-80", actionType: Create, - Listener: baremetal.Listener{Name: "TCP-80"}, + Listener: loadbalancer.ListenerDetails{}, }, }, }, "update": { backendSetActions: []Action{ &BackendSetAction{ + name: "TCP-80", actionType: Update, - BackendSet: baremetal.BackendSet{Name: "TCP-80"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, &BackendSetAction{ + name: "TCP-443", actionType: Update, - BackendSet: baremetal.BackendSet{Name: "TCP-443"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, }, listenerActions: []Action{ &ListenerAction{ + name: "TCP-443", actionType: Update, - Listener: baremetal.Listener{Name: "TCP-443"}, + Listener: loadbalancer.ListenerDetails{}, }, &ListenerAction{ + name: "TCP-80", actionType: Update, - Listener: baremetal.Listener{Name: "TCP-80"}, + Listener: loadbalancer.ListenerDetails{}, }, }, expected: []Action{ &ListenerAction{ + name: "TCP-443", actionType: Update, - Listener: baremetal.Listener{Name: "TCP-443"}, + Listener: loadbalancer.ListenerDetails{}, }, &BackendSetAction{ + name: "TCP-443", actionType: Update, - BackendSet: baremetal.BackendSet{Name: "TCP-443"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, &ListenerAction{ + name: "TCP-80", actionType: Update, - Listener: baremetal.Listener{Name: "TCP-80"}, + Listener: loadbalancer.ListenerDetails{}, }, &BackendSetAction{ + name: "TCP-80", actionType: Update, - BackendSet: baremetal.BackendSet{Name: "TCP-80"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, }, }, "delete": { backendSetActions: []Action{ &BackendSetAction{ + name: "TCP-80", actionType: Delete, - BackendSet: baremetal.BackendSet{Name: "TCP-80"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, &BackendSetAction{ + name: "TCP-443", actionType: Delete, - BackendSet: baremetal.BackendSet{Name: "TCP-443"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, }, listenerActions: []Action{ &ListenerAction{ + name: "TCP-443", actionType: Delete, - Listener: baremetal.Listener{Name: "TCP-443"}, + Listener: loadbalancer.ListenerDetails{}, }, &ListenerAction{ + name: "TCP-80", actionType: Delete, - Listener: baremetal.Listener{Name: "TCP-80"}, + Listener: loadbalancer.ListenerDetails{}, }, }, expected: []Action{ &ListenerAction{ + name: "TCP-443", actionType: Delete, - Listener: baremetal.Listener{Name: "TCP-443"}, + Listener: loadbalancer.ListenerDetails{}, }, &BackendSetAction{ + name: "TCP-443", actionType: Delete, - BackendSet: baremetal.BackendSet{Name: "TCP-443"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, &ListenerAction{ + name: "TCP-80", actionType: Delete, - Listener: baremetal.Listener{Name: "TCP-80"}, + Listener: loadbalancer.ListenerDetails{}, }, &BackendSetAction{ + name: "TCP-80", actionType: Delete, - BackendSet: baremetal.BackendSet{Name: "TCP-80"}, + BackendSet: loadbalancer.BackendSetDetails{}, }, }, }, @@ -166,41 +191,41 @@ func TestSortAndCombineActions(t *testing.T) { func TestGetBackendSetChanges(t *testing.T) { var testCases = []struct { name string - desired map[string]baremetal.BackendSet - actual map[string]baremetal.BackendSet + desired map[string]loadbalancer.BackendSetDetails + actual map[string]loadbalancer.BackendSet expected []Action }{ { name: "create backendset", - desired: map[string]baremetal.BackendSet{ - "one": baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, + desired: map[string]loadbalancer.BackendSetDetails{ + "one": loadbalancer.BackendSetDetails{ + Backends: []loadbalancer.BackendDetails{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, }, }, - "two": baremetal.BackendSet{ - Name: "two", - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.3", Port: 80}, - {IPAddress: "0.0.0.4", Port: 80}, + "two": loadbalancer.BackendSetDetails{ + Backends: []loadbalancer.BackendDetails{ + {IpAddress: common.String("0.0.0.3"), Port: common.Int(80)}, + {IpAddress: common.String("0.0.0.4"), Port: common.Int(80)}, }, }, }, - actual: map[string]baremetal.BackendSet{ - "one": baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, + actual: map[string]loadbalancer.BackendSet{ + "one": loadbalancer.BackendSet{ + Name: common.String("one"), + Backends: []loadbalancer.Backend{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, }, }, }, expected: []Action{ &BackendSetAction{ + name: "two", actionType: Create, - BackendSet: baremetal.BackendSet{ - Name: "two", - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.3", Port: 80}, - {IPAddress: "0.0.0.4", Port: 80}, + BackendSet: loadbalancer.BackendSetDetails{ + Backends: []loadbalancer.BackendDetails{ + {IpAddress: common.String("0.0.0.3"), Port: common.Int(80)}, + {IpAddress: common.String("0.0.0.4"), Port: common.Int(80)}, }, }, }, @@ -208,28 +233,30 @@ func TestGetBackendSetChanges(t *testing.T) { }, { name: "update backendset - add backend", - desired: map[string]baremetal.BackendSet{ - "one": baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, - {IPAddress: "0.0.0.1", Port: 80}, + desired: map[string]loadbalancer.BackendSetDetails{ + "one": loadbalancer.BackendSetDetails{ + Backends: []loadbalancer.BackendDetails{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, + {IpAddress: common.String("0.0.0.1"), Port: common.Int(80)}, }, }, }, - actual: map[string]baremetal.BackendSet{ - "one": baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, + actual: map[string]loadbalancer.BackendSet{ + "one": loadbalancer.BackendSet{ + Name: common.String("one"), + Backends: []loadbalancer.Backend{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, }, }, }, expected: []Action{ &BackendSetAction{ + name: "one", actionType: Update, - BackendSet: baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, - {IPAddress: "0.0.0.1", Port: 80}, + BackendSet: loadbalancer.BackendSetDetails{ + Backends: []loadbalancer.BackendDetails{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, + {IpAddress: common.String("0.0.0.1"), Port: common.Int(80)}, }, }, }, @@ -237,27 +264,29 @@ func TestGetBackendSetChanges(t *testing.T) { }, { name: "update backendset - remove backend", - desired: map[string]baremetal.BackendSet{ - "one": baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, + desired: map[string]loadbalancer.BackendSetDetails{ + "one": loadbalancer.BackendSetDetails{ + Backends: []loadbalancer.BackendDetails{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, }, }, }, - actual: map[string]baremetal.BackendSet{ - "one": baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, - {IPAddress: "0.0.0.1", Port: 80}, + actual: map[string]loadbalancer.BackendSet{ + "one": loadbalancer.BackendSet{ + Name: common.String("one"), + Backends: []loadbalancer.Backend{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, + {IpAddress: common.String("0.0.0.1"), Port: common.Int(80)}, }, }, }, expected: []Action{ &BackendSetAction{ + name: "one", actionType: Update, - BackendSet: baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, + BackendSet: loadbalancer.BackendSetDetails{ + Backends: []loadbalancer.BackendDetails{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, }, }, }, @@ -265,20 +294,22 @@ func TestGetBackendSetChanges(t *testing.T) { }, { name: "remove backendset", - desired: map[string]baremetal.BackendSet{}, - actual: map[string]baremetal.BackendSet{ - "one": baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, + desired: map[string]loadbalancer.BackendSetDetails{}, + actual: map[string]loadbalancer.BackendSet{ + "one": loadbalancer.BackendSet{ + Name: common.String("one"), + Backends: []loadbalancer.Backend{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, }, }, }, expected: []Action{ &BackendSetAction{ + name: "one", actionType: Delete, - BackendSet: baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, + BackendSet: loadbalancer.BackendSetDetails{ + Backends: []loadbalancer.BackendDetails{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, }, }, }, @@ -286,17 +317,18 @@ func TestGetBackendSetChanges(t *testing.T) { }, { name: "no change", - desired: map[string]baremetal.BackendSet{ - "one": baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, + desired: map[string]loadbalancer.BackendSetDetails{ + "one": loadbalancer.BackendSetDetails{ + Backends: []loadbalancer.BackendDetails{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, }, }, }, - actual: map[string]baremetal.BackendSet{ - "one": baremetal.BackendSet{ - Backends: []baremetal.Backend{ - {IPAddress: "0.0.0.0", Port: 80}, + actual: map[string]loadbalancer.BackendSet{ + "one": loadbalancer.BackendSet{ + Name: common.String("one"), + Backends: []loadbalancer.Backend{ + {IpAddress: common.String("0.0.0.0"), Port: common.Int(80)}, }, }, }, @@ -320,157 +352,151 @@ func TestGetBackendSetChanges(t *testing.T) { func TestGetListenerChanges(t *testing.T) { var testCases = []struct { name string - desired map[string]baremetal.Listener - actual map[string]baremetal.Listener + desired map[string]loadbalancer.ListenerDetails + actual map[string]loadbalancer.Listener expected []Action }{ { name: "create listener", - desired: map[string]baremetal.Listener{"TCP-443": baremetal.Listener{ - Name: "TCP-443", - DefaultBackendSetName: "TCP-443", - Protocol: "TCP", - Port: 443, + desired: map[string]loadbalancer.ListenerDetails{"TCP-443": loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-443"), + Protocol: common.String("TCP"), + Port: common.Int(443), }}, - actual: map[string]baremetal.Listener{}, + actual: map[string]loadbalancer.Listener{}, expected: []Action{ &ListenerAction{ + name: "TCP-443", actionType: Create, - Listener: baremetal.Listener{ - Name: "TCP-443", - DefaultBackendSetName: "TCP-443", - Protocol: "TCP", - Port: 443, + Listener: loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-443"), + Protocol: common.String("TCP"), + Port: common.Int(443), }, }, }, }, { name: "add listener", - desired: map[string]baremetal.Listener{ - "TCP-80": baremetal.Listener{ - Name: "TCP-80", - DefaultBackendSetName: "TCP-80", - Protocol: "TCP", - Port: 80, + desired: map[string]loadbalancer.ListenerDetails{ + "TCP-80": loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-80"), + Protocol: common.String("TCP"), + Port: common.Int(80), }, - "TCP-443": baremetal.Listener{ - Name: "TCP-443", - DefaultBackendSetName: "TCP-443", - Protocol: "TCP", - Port: 443, + "TCP-443": loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-443"), + Protocol: common.String("TCP"), + Port: common.Int(443), }, }, - actual: map[string]baremetal.Listener{ - "TCP-80": baremetal.Listener{ - Name: "TCP-80", - DefaultBackendSetName: "TCP-80", - Protocol: "TCP", - Port: 80, + actual: map[string]loadbalancer.Listener{ + "TCP-80": loadbalancer.Listener{ + Name: common.String("TCP-80"), + DefaultBackendSetName: common.String("TCP-80"), + Protocol: common.String("TCP"), + Port: common.Int(80), }, }, expected: []Action{ &ListenerAction{ + name: "TCP-443", actionType: Create, - Listener: baremetal.Listener{ - Name: "TCP-443", - DefaultBackendSetName: "TCP-443", - Protocol: "TCP", - Port: 443, + Listener: loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-443"), + Protocol: common.String("TCP"), + Port: common.Int(443), }, }, }, }, { name: "remove listener", - desired: map[string]baremetal.Listener{ - "TCP-80": baremetal.Listener{ - Name: "TCP-80", - DefaultBackendSetName: "TCP-80", - Protocol: "TCP", - Port: 80, + desired: map[string]loadbalancer.ListenerDetails{ + "TCP-80": loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-80"), + Protocol: common.String("TCP"), + Port: common.Int(80), }, }, - actual: map[string]baremetal.Listener{ - "TCP-443": baremetal.Listener{ - Name: "TCP-443", - DefaultBackendSetName: "TCP-443", - Protocol: "TCP", - Port: 443, + actual: map[string]loadbalancer.Listener{ + "TCP-443": loadbalancer.Listener{ + Name: common.String("TCP-443"), + DefaultBackendSetName: common.String("TCP-443"), + Protocol: common.String("TCP"), + Port: common.Int(443), }, - "TCP-80": baremetal.Listener{ - Name: "TCP-80", - DefaultBackendSetName: "TCP-80", - Protocol: "TCP", - Port: 80, + "TCP-80": loadbalancer.Listener{ + Name: common.String("TCP-80"), + DefaultBackendSetName: common.String("TCP-80"), + Protocol: common.String("TCP"), + Port: common.Int(80), }, }, expected: []Action{ &ListenerAction{ + name: "TCP-443", actionType: Delete, - Listener: baremetal.Listener{ - Name: "TCP-443", - DefaultBackendSetName: "TCP-443", - Protocol: "TCP", - Port: 443, + Listener: loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-443"), + Protocol: common.String("TCP"), + Port: common.Int(443), }, }, }, }, { name: "no change", - desired: map[string]baremetal.Listener{ - "TCP-80": baremetal.Listener{ - Name: "TCP-80", - DefaultBackendSetName: "TCP-80", - Protocol: "TCP", - Port: 80, + desired: map[string]loadbalancer.ListenerDetails{ + "TCP-80": loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-80"), + Protocol: common.String("TCP"), + Port: common.Int(80), }, }, - actual: map[string]baremetal.Listener{ - "TCP-80": baremetal.Listener{ - Name: "TCP-80", - DefaultBackendSetName: "TCP-80", - Protocol: "TCP", - Port: 80, + actual: map[string]loadbalancer.Listener{ + "TCP-80": loadbalancer.Listener{ + Name: common.String("TCP-80"), + DefaultBackendSetName: common.String("TCP-80"), + Protocol: common.String("TCP"), + Port: common.Int(80), }, }, expected: []Action{}, }, { name: "ssl config change", - desired: map[string]baremetal.Listener{ - "TCP-80": baremetal.Listener{ - Name: "TCP-80", - DefaultBackendSetName: "TCP-80", - Protocol: "TCP", - Port: 80, - SSLConfig: &baremetal.SSLConfiguration{ - CertificateName: "desired", + desired: map[string]loadbalancer.ListenerDetails{ + "TCP-80": loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-80"), + Protocol: common.String("TCP"), + Port: common.Int(80), + SslConfiguration: &loadbalancer.SslConfigurationDetails{ + CertificateName: common.String("desired"), }, }, }, - actual: map[string]baremetal.Listener{ - "TCP-80": baremetal.Listener{ - Name: "TCP-80", - DefaultBackendSetName: "TCP-80", - Protocol: "TCP", - Port: 80, - SSLConfig: &baremetal.SSLConfiguration{ - CertificateName: "actual", + actual: map[string]loadbalancer.Listener{ + "TCP-80": loadbalancer.Listener{ + Name: common.String("TCP-80"), + DefaultBackendSetName: common.String("TCP-80"), + Protocol: common.String("TCP"), + Port: common.Int(80), + SslConfiguration: &loadbalancer.SslConfiguration{ + CertificateName: common.String("actual"), }, }, }, expected: []Action{ &ListenerAction{ + name: "TCP-80", actionType: Update, - Listener: baremetal.Listener{ - Name: "TCP-80", - DefaultBackendSetName: "TCP-80", - Protocol: "TCP", - Port: 80, - SSLConfig: &baremetal.SSLConfiguration{ - CertificateName: "desired", + Listener: loadbalancer.ListenerDetails{ + DefaultBackendSetName: common.String("TCP-80"), + Protocol: common.String("TCP"), + Port: common.Int(80), + SslConfiguration: &loadbalancer.SslConfigurationDetails{ + CertificateName: common.String("desired"), }, }, }, @@ -495,37 +521,39 @@ func TestGetSSLEnabledPorts(t *testing.T) { testCases := []struct { name string annotations map[string]string - expected map[int]bool + expected []int }{ { name: "empty", annotations: map[string]string{}, - expected: nil, + expected: []int{}, }, { name: "empty string", annotations: map[string]string{"service.beta.kubernetes.io/oci-load-balancer-ssl-ports": ""}, - expected: nil, + expected: []int{}, }, { name: "443", annotations: map[string]string{"service.beta.kubernetes.io/oci-load-balancer-ssl-ports": "443"}, - expected: map[int]bool{443: true}, + expected: []int{443}, }, { name: "1,2,3", annotations: map[string]string{"service.beta.kubernetes.io/oci-load-balancer-ssl-ports": "1,2,3"}, - expected: map[int]bool{1: true, 2: true, 3: true}, + expected: []int{1, 2, 3}, }, { name: "1, 2, 3", annotations: map[string]string{"service.beta.kubernetes.io/oci-load-balancer-ssl-ports": "1, 2, 3"}, - expected: map[int]bool{1: true, 2: true, 3: true}, + expected: []int{1, 2, 3}, }, { name: "not-an-integer", annotations: map[string]string{"service.beta.kubernetes.io/oci-load-balancer-ssl-ports": "not-an-integer"}, - expected: nil, + expected: nil, // becuase we error }, } for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { - sslEnabledPorts, _ := getSSLEnabledPorts(tt.annotations) + sslEnabledPorts, _ := getSSLEnabledPorts(&api.Service{ + ObjectMeta: metav1.ObjectMeta{Annotations: tt.annotations}, + }) if !reflect.DeepEqual(sslEnabledPorts, tt.expected) { t.Errorf("getSSLEnabledPorts(%#v) => (%#v), expected (%#v)", tt.annotations, sslEnabledPorts, tt.expected) diff --git a/pkg/oci/zones.go b/pkg/oci/zones.go index 82a77354b4..12dc8085c5 100644 --- a/pkg/oci/zones.go +++ b/pkg/oci/zones.go @@ -15,6 +15,7 @@ package oci import ( + "context" "errors" "strings" @@ -48,13 +49,13 @@ func (cp *CloudProvider) GetZone() (cloudprovider.Zone, error) { // initialization must be down outside the kubelets. func (cp *CloudProvider) GetZoneByProviderID(providerID string) (cloudprovider.Zone, error) { instanceID := util.MapProviderIDToInstanceID(providerID) - instance, err := cp.client.GetInstance(instanceID) + instance, err := cp.client.Compute().GetInstance(context.TODO(), instanceID) if err != nil { return cloudprovider.Zone{}, err } return cloudprovider.Zone{ - FailureDomain: mapAvailabilityDomainToFailureDomain(instance.AvailabilityDomain), - Region: instance.Region, + FailureDomain: mapAvailabilityDomainToFailureDomain(*instance.AvailabilityDomain), + Region: *instance.Region, }, nil } @@ -63,12 +64,12 @@ func (cp *CloudProvider) GetZoneByProviderID(providerID string) (cloudprovider.Z // in the context of external cloud providers where node initialization must be // down outside the kubelets. func (cp *CloudProvider) GetZoneByNodeName(nodeName types.NodeName) (cloudprovider.Zone, error) { - instance, err := cp.client.GetInstanceByNodeName(mapNodeNameToInstanceName(nodeName)) + instance, err := cp.client.Compute().GetInstanceByNodeName(context.TODO(), mapNodeNameToInstanceName(nodeName)) if err != nil { return cloudprovider.Zone{}, err } return cloudprovider.Zone{ - FailureDomain: mapAvailabilityDomainToFailureDomain(instance.AvailabilityDomain), - Region: instance.Region, + FailureDomain: mapAvailabilityDomainToFailureDomain(*instance.AvailabilityDomain), + Region: *instance.Region, }, nil } diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index bfa66d62ee..8a0c65ec1c 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -85,6 +85,7 @@ func NewDefaultFramework(baseName string) *Framework { func NewFrameworkWithCloudProvider(baseName string) *Framework { f := NewFramework(baseName, nil) f.SkipNamespaceCreation = true + f.InitCloudProvider = true return f } diff --git a/test/integration/framework/framework.go b/test/integration/framework/framework.go deleted file mode 100644 index 70068a7a6b..0000000000 --- a/test/integration/framework/framework.go +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2017 Oracle and/or its affiliates. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package framework - -import ( - "errors" - "os" - "path" - "time" - - "github.com/golang/glog" - baremetal "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" -) - -const ( - // ubuntu image ocid - instanceImageID = "ocid1.image.oc1.phx.aaaaaaaa2wjumduuoq6rqprrsmgu53eeyzp47vjztn355tkvsr3m2p57woqq" - instanceShape = "VM.Standard1.1" -) - -// Framework used to help with integration testing. -type Framework struct { - configFile string - nodeSubnetOne string - nodeSubnetTwo string - - Config *client.Config - Client client.Interface - Instances []*baremetal.Instance -} - -// New testing framework. -func New() *Framework { - return &Framework{ - configFile: path.Join(os.Getenv("HOME"), ".oci", "cloud-provider.yaml"), - } -} - -// Init the framework which validates the configuration & env vars. -func (f *Framework) Init() error { - if os.Getenv("OCI_CONFIG_FILE") != "" { - f.configFile = os.Getenv("OCI_CONFIG_FILE") - } - - file, err := os.Open(f.configFile) - if err != nil { - return err - } - - f.Config, err = client.ReadConfig(file) - if err != nil { - return err - } - - f.Client, err = client.New(f.Config) - if err != nil { - return err - } - - f.nodeSubnetOne = os.Getenv("NODE_SUBNET_ONE") - if f.nodeSubnetOne == "" { - return errors.New("env var `NODE_SUBNET_ONE` is required") - } - - f.nodeSubnetTwo = os.Getenv("NODE_SUBNET_TWO") - if f.nodeSubnetTwo == "" { - return errors.New("env var `NODE_SUBNET_TWO` is required") - } - - return nil -} - -// Run the tests and exit with the status code -func (f *Framework) Run(run func() int) { - os.Exit(run()) -} - -// NodeSubnets returns the node subnets that should be used for testing. -func (f *Framework) NodeSubnets() []string { - return []string{f.nodeSubnetOne, f.nodeSubnetTwo} -} - -// WaitForInstance waits until the instance has a state of RUNNING. -func (f *Framework) WaitForInstance(id string) error { - glog.Infof("Waiting for instance `%s` to be running", id) - - sleepTime := 30 * time.Second - for { - instance, err := f.Client.GetInstance(id) - if err != nil { - return err - } - if instance.State == baremetal.ResourceRunning { - time.Sleep(sleepTime) - return nil - } - glog.Infof("Instance is not running (%s)... sleeping for %v", instance.ID, sleepTime) - time.Sleep(sleepTime) - } -} - -// CreateInstance creates an instance and stores a reference for cleanup. -func (f *Framework) CreateInstance(availabilityDomain string, subnetID string) (*baremetal.Instance, error) { - instance, err := f.Client.LaunchInstance( - availabilityDomain, - f.Config.Auth.CompartmentOCID, - instanceImageID, - instanceShape, - subnetID, - &baremetal.LaunchInstanceOptions{}, - ) - if err != nil { - return nil, err - } - - f.Instances = append(f.Instances, instance) - return instance, nil -} - -// Cleanup all the instances created by the test framework. -func (f *Framework) Cleanup() { - glog.Info("Running instance cleanup") - for _, instance := range f.Instances { - glog.Infof("Terminating instance for cleanup `%s`", instance.ID) - err := f.Client.TerminateInstance(instance.ID, nil) - if client.IsNotFound(err) { - continue - } - if err != nil { - glog.Errorf("unable to terminate instance: %v", err) - } - } - f.Instances = []*baremetal.Instance{} - glog.Info("Instance cleanup is done") -} diff --git a/test/integration/loadbalancer/loadbalancer_test.go b/test/integration/loadbalancer/loadbalancer_test.go deleted file mode 100644 index e079f406ed..0000000000 --- a/test/integration/loadbalancer/loadbalancer_test.go +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright 2017 Oracle and/or its affiliates. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package loadbalancer - -import ( - "fmt" - "testing" - - "github.com/golang/glog" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci" - "github.com/oracle/oci-cloud-controller-manager/pkg/oci/client" - api "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" - listersv1 "k8s.io/client-go/listers/core/v1" - "k8s.io/client-go/tools/cache" -) - -func TestPublicLoadBalancer(t *testing.T) { - testLoadBalancer(t, false) -} - -func TestInternalLoadBalancer(t *testing.T) { - testLoadBalancer(t, true) -} - -func testLoadBalancer(t *testing.T, internal bool) { - cp, err := oci.NewCloudProvider(fw.Config) - if err != nil { - t.Fatal(err) - } - - indexer := cache.NewIndexer(cache.MetaNamespaceKeyFunc, cache.Indexers{}) - cp.(*oci.CloudProvider).NodeLister = listersv1.NewNodeLister(indexer) - - service := &api.Service{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "kube-system", - Name: "testservice", - UID: "integration-test-uid", - Annotations: map[string]string{}, - }, - Spec: api.ServiceSpec{ - Type: api.ServiceTypeLoadBalancer, - Ports: []api.ServicePort{ - { - Name: "http", - Protocol: api.ProtocolTCP, - Port: 80, - NodePort: 8080, - TargetPort: intstr.FromInt(9090), - }, - }, - SessionAffinity: api.ServiceAffinityNone, - LoadBalancerSourceRanges: []string{"0.0.0.0/0"}, - }, - } - - if internal { - service.Annotations[oci.ServiceAnnotationLoadBalancerInternal] = "" - } - - loadbalancers, enabled := cp.LoadBalancer() - if !enabled { - t.Fatal("the LoadBalancer interface is not enabled on the CCM") - } - - // Always call cleanup before any api calls are made since then otherwise we may - // get to an error state and some objects won't be cleaned up. - defer func() { - fw.Cleanup() - - err := loadbalancers.EnsureLoadBalancerDeleted("foo", service) - if err != nil { - t.Fatalf("Unable to delete the load balancer during cleanup: %v", err) - } - }() - - nodes := []*api.Node{} - for _, subnetID := range fw.NodeSubnets() { - - subnet, err := fw.Client.GetSubnet(subnetID) - if err != nil { - t.Fatal(err) - } - - instance, err := fw.CreateInstance(subnet.AvailabilityDomain, subnetID) - if err != nil { - t.Fatal(err) - } - - err = fw.WaitForInstance(instance.ID) - if err != nil { - t.Fatal(err) - } - - addresses, err := fw.Client.GetNodeAddressesForInstance(instance.ID) - if err != nil { - t.Fatal(err) - } - - node := &api.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: instance.ID, - }, - Spec: api.NodeSpec{ - ProviderID: instance.ID, - }, - Status: api.NodeStatus{ - Addresses: addresses, - }, - } - indexer.Add(node) - nodes = append(nodes, node) - } - - glog.Info("Stating test on creating initial load balancer") - - status, err := loadbalancers.EnsureLoadBalancer("foo", service, nodes) - if err != nil { - t.Fatalf("Unable to ensure the load balancer: %v", err) - } - - glog.Infof("Load Balancer Status: %+v", status) - - err = validateLoadBalancer(fw.Client, service, nodes) - if err != nil { - t.Fatalf("validation error: %v", err) - } - - glog.Info("Stating test on decreasing node count to 1") - - // Decrease the number of backends to 1 - lessNodes := []*api.Node{nodes[0]} - status, err = loadbalancers.EnsureLoadBalancer("foo", service, lessNodes) - if err != nil { - t.Fatalf("Unable to ensure load balancer: %v", err) - } - - err = validateLoadBalancer(fw.Client, service, lessNodes) - if err != nil { - t.Fatalf("validation error: %v", err) - } - - glog.Info("Stating test on increasing node count back to 2") - - // Go back to 2 nodes - status, err = loadbalancers.EnsureLoadBalancer("foo", service, nodes) - if err != nil { - t.Fatalf("Unable to ensure the load balancer: %v", err) - } - - err = validateLoadBalancer(fw.Client, service, nodes) - if err != nil { - t.Fatalf("validation error: %v", err) - } - - glog.Info("Stating test on changing service port") - - // Validate changing the service port. - service.Spec.Ports[0].Port = 81 - status, err = loadbalancers.EnsureLoadBalancer("foo", service, nodes) - if err != nil { - t.Fatalf("Unable to ensure the load balancer: %v", err) - } - - err = validateLoadBalancer(fw.Client, service, nodes) - if err != nil { - t.Fatalf("validation error: %v", err) - } - - glog.Info("Stating test on changing node port") - // Validate changing the node port. - service.Spec.Ports[0].NodePort = 8081 - status, err = loadbalancers.EnsureLoadBalancer("foo", service, nodes) - if err != nil { - t.Fatalf("Unable to ensure the load balancer: %v", err) - } - - err = validateLoadBalancer(fw.Client, service, nodes) - if err != nil { - t.Fatalf("validation error: %v", err) - } -} - -func validateLoadBalancer(client client.Interface, service *api.Service, nodes []*api.Node) error { - // TODO: make this better :) - // Generate expected listeners / backends based on service / nodes. - - lb, err := client.GetLoadBalancerByName(oci.GetLoadBalancerName(service)) - if err != nil { - return err - } - - if len(lb.Listeners) != 1 { - return fmt.Errorf("expected 1 Listener but got %d", len(lb.Listeners)) - } - - if len(lb.BackendSets) != 1 { - return fmt.Errorf("expected 1 BackendSet but got %d", len(lb.BackendSets)) - } - - name := fmt.Sprintf("TCP-%d", service.Spec.Ports[0].Port) - backendSet, ok := lb.BackendSets[name] - if !ok { - return fmt.Errorf("expected BackendSet with name %q to exist but it doesn't", name) - } - - if len(backendSet.Backends) != len(nodes) { - return fmt.Errorf("expected %d backends but got %d", len(nodes), len(backendSet.Backends)) - } - - expectedBackendPort := service.Spec.Ports[0].NodePort - actualBackendPort := backendSet.Backends[0].Port - if int(expectedBackendPort) != int(actualBackendPort) { - return fmt.Errorf("expected backend port %d but got %d", expectedBackendPort, actualBackendPort) - } - - return nil -} diff --git a/test/integration/loadbalancer/main_test.go b/test/integration/loadbalancer/main_test.go deleted file mode 100644 index 6b6ac2ff8c..0000000000 --- a/test/integration/loadbalancer/main_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 Oracle and/or its affiliates. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package loadbalancer - -import ( - "testing" - - "k8s.io/apiserver/pkg/util/flag" - "k8s.io/apiserver/pkg/util/logs" - - "github.com/golang/glog" - "github.com/oracle/oci-cloud-controller-manager/test/integration/framework" -) - -var fw *framework.Framework - -func TestMain(m *testing.M) { - logs.InitLogs() - defer logs.FlushLogs() - - err := fw.Init() - if err != nil { - glog.Fatal(err) - } - - fw.Run(m.Run) -} - -func init() { - flag.InitFlags() - fw = framework.New() -} diff --git a/vendor/github.com/google/go-querystring/LICENSE b/vendor/github.com/google/go-querystring/LICENSE deleted file mode 100644 index ae121a1e46..0000000000 --- a/vendor/github.com/google/go-querystring/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013 Google. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/go-querystring/query/encode.go b/vendor/github.com/google/go-querystring/query/encode.go deleted file mode 100644 index 37080b19b5..0000000000 --- a/vendor/github.com/google/go-querystring/query/encode.go +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package query implements encoding of structs into URL query parameters. -// -// As a simple example: -// -// type Options struct { -// Query string `url:"q"` -// ShowAll bool `url:"all"` -// Page int `url:"page"` -// } -// -// opt := Options{ "foo", true, 2 } -// v, _ := query.Values(opt) -// fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2" -// -// The exact mapping between Go values and url.Values is described in the -// documentation for the Values() function. -package query - -import ( - "bytes" - "fmt" - "net/url" - "reflect" - "strconv" - "strings" - "time" -) - -var timeType = reflect.TypeOf(time.Time{}) - -var encoderType = reflect.TypeOf(new(Encoder)).Elem() - -// Encoder is an interface implemented by any type that wishes to encode -// itself into URL values in a non-standard way. -type Encoder interface { - EncodeValues(key string, v *url.Values) error -} - -// Values returns the url.Values encoding of v. -// -// Values expects to be passed a struct, and traverses it recursively using the -// following encoding rules. -// -// Each exported struct field is encoded as a URL parameter unless -// -// - the field's tag is "-", or -// - the field is empty and its tag specifies the "omitempty" option -// -// The empty values are false, 0, any nil pointer or interface value, any array -// slice, map, or string of length zero, and any time.Time that returns true -// for IsZero(). -// -// The URL parameter name defaults to the struct field name but can be -// specified in the struct field's tag value. The "url" key in the struct -// field's tag value is the key name, followed by an optional comma and -// options. For example: -// -// // Field is ignored by this package. -// Field int `url:"-"` -// -// // Field appears as URL parameter "myName". -// Field int `url:"myName"` -// -// // Field appears as URL parameter "myName" and the field is omitted if -// // its value is empty -// Field int `url:"myName,omitempty"` -// -// // Field appears as URL parameter "Field" (the default), but the field -// // is skipped if empty. Note the leading comma. -// Field int `url:",omitempty"` -// -// For encoding individual field values, the following type-dependent rules -// apply: -// -// Boolean values default to encoding as the strings "true" or "false". -// Including the "int" option signals that the field should be encoded as the -// strings "1" or "0". -// -// time.Time values default to encoding as RFC3339 timestamps. Including the -// "unix" option signals that the field should be encoded as a Unix time (see -// time.Unix()) -// -// Slice and Array values default to encoding as multiple URL values of the -// same name. Including the "comma" option signals that the field should be -// encoded as a single comma-delimited value. Including the "space" option -// similarly encodes the value as a single space-delimited string. Including -// the "semicolon" option will encode the value as a semicolon-delimited string. -// Including the "brackets" option signals that the multiple URL values should -// have "[]" appended to the value name. "numbered" will append a number to -// the end of each incidence of the value name, example: -// name0=value0&name1=value1, etc. -// -// Anonymous struct fields are usually encoded as if their inner exported -// fields were fields in the outer struct, subject to the standard Go -// visibility rules. An anonymous struct field with a name given in its URL -// tag is treated as having that name, rather than being anonymous. -// -// Non-nil pointer values are encoded as the value pointed to. -// -// Nested structs are encoded including parent fields in value names for -// scoping. e.g: -// -// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO" -// -// All other values are encoded using their default string representation. -// -// Multiple fields that encode to the same URL parameter name will be included -// as multiple URL values of the same name. -func Values(v interface{}) (url.Values, error) { - values := make(url.Values) - val := reflect.ValueOf(v) - for val.Kind() == reflect.Ptr { - if val.IsNil() { - return values, nil - } - val = val.Elem() - } - - if v == nil { - return values, nil - } - - if val.Kind() != reflect.Struct { - return nil, fmt.Errorf("query: Values() expects struct input. Got %v", val.Kind()) - } - - err := reflectValue(values, val, "") - return values, err -} - -// reflectValue populates the values parameter from the struct fields in val. -// Embedded structs are followed recursively (using the rules defined in the -// Values function documentation) breadth-first. -func reflectValue(values url.Values, val reflect.Value, scope string) error { - var embedded []reflect.Value - - typ := val.Type() - for i := 0; i < typ.NumField(); i++ { - sf := typ.Field(i) - if sf.PkgPath != "" && !sf.Anonymous { // unexported - continue - } - - sv := val.Field(i) - tag := sf.Tag.Get("url") - if tag == "-" { - continue - } - name, opts := parseTag(tag) - if name == "" { - if sf.Anonymous && sv.Kind() == reflect.Struct { - // save embedded struct for later processing - embedded = append(embedded, sv) - continue - } - - name = sf.Name - } - - if scope != "" { - name = scope + "[" + name + "]" - } - - if opts.Contains("omitempty") && isEmptyValue(sv) { - continue - } - - if sv.Type().Implements(encoderType) { - if !reflect.Indirect(sv).IsValid() { - sv = reflect.New(sv.Type().Elem()) - } - - m := sv.Interface().(Encoder) - if err := m.EncodeValues(name, &values); err != nil { - return err - } - continue - } - - if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array { - var del byte - if opts.Contains("comma") { - del = ',' - } else if opts.Contains("space") { - del = ' ' - } else if opts.Contains("semicolon") { - del = ';' - } else if opts.Contains("brackets") { - name = name + "[]" - } - - if del != 0 { - s := new(bytes.Buffer) - first := true - for i := 0; i < sv.Len(); i++ { - if first { - first = false - } else { - s.WriteByte(del) - } - s.WriteString(valueString(sv.Index(i), opts)) - } - values.Add(name, s.String()) - } else { - for i := 0; i < sv.Len(); i++ { - k := name - if opts.Contains("numbered") { - k = fmt.Sprintf("%s%d", name, i) - } - values.Add(k, valueString(sv.Index(i), opts)) - } - } - continue - } - - for sv.Kind() == reflect.Ptr { - if sv.IsNil() { - break - } - sv = sv.Elem() - } - - if sv.Type() == timeType { - values.Add(name, valueString(sv, opts)) - continue - } - - if sv.Kind() == reflect.Struct { - reflectValue(values, sv, name) - continue - } - - values.Add(name, valueString(sv, opts)) - } - - for _, f := range embedded { - if err := reflectValue(values, f, scope); err != nil { - return err - } - } - - return nil -} - -// valueString returns the string representation of a value. -func valueString(v reflect.Value, opts tagOptions) string { - for v.Kind() == reflect.Ptr { - if v.IsNil() { - return "" - } - v = v.Elem() - } - - if v.Kind() == reflect.Bool && opts.Contains("int") { - if v.Bool() { - return "1" - } - return "0" - } - - if v.Type() == timeType { - t := v.Interface().(time.Time) - if opts.Contains("unix") { - return strconv.FormatInt(t.Unix(), 10) - } - return t.Format(time.RFC3339) - } - - return fmt.Sprint(v.Interface()) -} - -// isEmptyValue checks if a value should be considered empty for the purposes -// of omitting fields with the "omitempty" option. -func isEmptyValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - } - - if v.Type() == timeType { - return v.Interface().(time.Time).IsZero() - } - - return false -} - -// tagOptions is the string following a comma in a struct field's "url" tag, or -// the empty string. It does not include the leading comma. -type tagOptions []string - -// parseTag splits a struct field's url tag into its name and comma-separated -// options. -func parseTag(tag string) (string, tagOptions) { - s := strings.Split(tag, ",") - return s[0], s[1:] -} - -// Contains checks whether the tagOptions contains the specified option. -func (o tagOptions) Contains(option string) bool { - for _, s := range o { - if s == option { - return true - } - } - return false -} diff --git a/vendor/github.com/google/go-querystring/query/encode_test.go b/vendor/github.com/google/go-querystring/query/encode_test.go deleted file mode 100644 index 0f26a77509..0000000000 --- a/vendor/github.com/google/go-querystring/query/encode_test.go +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package query - -import ( - "fmt" - "net/url" - "reflect" - "testing" - "time" -) - -type Nested struct { - A SubNested `url:"a"` - B *SubNested `url:"b"` - Ptr *SubNested `url:"ptr,omitempty"` -} - -type SubNested struct { - Value string `url:"value"` -} - -func TestValues_types(t *testing.T) { - str := "string" - strPtr := &str - timeVal := time.Date(2000, 1, 1, 12, 34, 56, 0, time.UTC) - - tests := []struct { - in interface{} - want url.Values - }{ - { - // basic primitives - struct { - A string - B int - C uint - D float32 - E bool - }{}, - url.Values{ - "A": {""}, - "B": {"0"}, - "C": {"0"}, - "D": {"0"}, - "E": {"false"}, - }, - }, - { - // pointers - struct { - A *string - B *int - C **string - D *time.Time - }{ - A: strPtr, - C: &strPtr, - D: &timeVal, - }, - url.Values{ - "A": {str}, - "B": {""}, - "C": {str}, - "D": {"2000-01-01T12:34:56Z"}, - }, - }, - { - // slices and arrays - struct { - A []string - B []string `url:",comma"` - C []string `url:",space"` - D [2]string - E [2]string `url:",comma"` - F [2]string `url:",space"` - G []*string `url:",space"` - H []bool `url:",int,space"` - I []string `url:",brackets"` - J []string `url:",semicolon"` - K []string `url:",numbered"` - }{ - A: []string{"a", "b"}, - B: []string{"a", "b"}, - C: []string{"a", "b"}, - D: [2]string{"a", "b"}, - E: [2]string{"a", "b"}, - F: [2]string{"a", "b"}, - G: []*string{&str, &str}, - H: []bool{true, false}, - I: []string{"a", "b"}, - J: []string{"a", "b"}, - K: []string{"a", "b"}, - }, - url.Values{ - "A": {"a", "b"}, - "B": {"a,b"}, - "C": {"a b"}, - "D": {"a", "b"}, - "E": {"a,b"}, - "F": {"a b"}, - "G": {"string string"}, - "H": {"1 0"}, - "I[]": {"a", "b"}, - "J": {"a;b"}, - "K0": {"a"}, - "K1": {"b"}, - }, - }, - { - // other types - struct { - A time.Time - B time.Time `url:",unix"` - C bool `url:",int"` - D bool `url:",int"` - }{ - A: time.Date(2000, 1, 1, 12, 34, 56, 0, time.UTC), - B: time.Date(2000, 1, 1, 12, 34, 56, 0, time.UTC), - C: true, - D: false, - }, - url.Values{ - "A": {"2000-01-01T12:34:56Z"}, - "B": {"946730096"}, - "C": {"1"}, - "D": {"0"}, - }, - }, - { - struct { - Nest Nested `url:"nest"` - }{ - Nested{ - A: SubNested{ - Value: "that", - }, - }, - }, - url.Values{ - "nest[a][value]": {"that"}, - "nest[b]": {""}, - }, - }, - { - struct { - Nest Nested `url:"nest"` - }{ - Nested{ - Ptr: &SubNested{ - Value: "that", - }, - }, - }, - url.Values{ - "nest[a][value]": {""}, - "nest[b]": {""}, - "nest[ptr][value]": {"that"}, - }, - }, - { - nil, - url.Values{}, - }, - } - - for i, tt := range tests { - v, err := Values(tt.in) - if err != nil { - t.Errorf("%d. Values(%q) returned error: %v", i, tt.in, err) - } - - if !reflect.DeepEqual(tt.want, v) { - t.Errorf("%d. Values(%q) returned %v, want %v", i, tt.in, v, tt.want) - } - } -} - -func TestValues_omitEmpty(t *testing.T) { - str := "" - s := struct { - a string - A string - B string `url:",omitempty"` - C string `url:"-"` - D string `url:"omitempty"` // actually named omitempty, not an option - E *string `url:",omitempty"` - }{E: &str} - - v, err := Values(s) - if err != nil { - t.Errorf("Values(%q) returned error: %v", s, err) - } - - want := url.Values{ - "A": {""}, - "omitempty": {""}, - "E": {""}, // E is included because the pointer is not empty, even though the string being pointed to is - } - if !reflect.DeepEqual(want, v) { - t.Errorf("Values(%q) returned %v, want %v", s, v, want) - } -} - -type A struct { - B -} - -type B struct { - C string -} - -type D struct { - B - C string -} - -type e struct { - B - C string -} - -type F struct { - e -} - -func TestValues_embeddedStructs(t *testing.T) { - tests := []struct { - in interface{} - want url.Values - }{ - { - A{B{C: "foo"}}, - url.Values{"C": {"foo"}}, - }, - { - D{B: B{C: "bar"}, C: "foo"}, - url.Values{"C": {"foo", "bar"}}, - }, - { - F{e{B: B{C: "bar"}, C: "foo"}}, // With unexported embed - url.Values{"C": {"foo", "bar"}}, - }, - } - - for i, tt := range tests { - v, err := Values(tt.in) - if err != nil { - t.Errorf("%d. Values(%q) returned error: %v", i, tt.in, err) - } - - if !reflect.DeepEqual(tt.want, v) { - t.Errorf("%d. Values(%q) returned %v, want %v", i, tt.in, v, tt.want) - } - } -} - -func TestValues_invalidInput(t *testing.T) { - _, err := Values("") - if err == nil { - t.Errorf("expected Values() to return an error on invalid input") - } -} - -type EncodedArgs []string - -func (m EncodedArgs) EncodeValues(key string, v *url.Values) error { - for i, arg := range m { - v.Set(fmt.Sprintf("%s.%d", key, i), arg) - } - return nil -} - -func TestValues_Marshaler(t *testing.T) { - s := struct { - Args EncodedArgs `url:"arg"` - }{[]string{"a", "b", "c"}} - v, err := Values(s) - if err != nil { - t.Errorf("Values(%q) returned error: %v", s, err) - } - - want := url.Values{ - "arg.0": {"a"}, - "arg.1": {"b"}, - "arg.2": {"c"}, - } - if !reflect.DeepEqual(want, v) { - t.Errorf("Values(%q) returned %v, want %v", s, v, want) - } -} - -func TestValues_MarshalerWithNilPointer(t *testing.T) { - s := struct { - Args *EncodedArgs `url:"arg"` - }{} - v, err := Values(s) - if err != nil { - t.Errorf("Values(%q) returned error: %v", s, err) - } - - want := url.Values{} - if !reflect.DeepEqual(want, v) { - t.Errorf("Values(%q) returned %v, want %v", s, v, want) - } -} - -func TestTagParsing(t *testing.T) { - name, opts := parseTag("field,foobar,foo") - if name != "field" { - t.Fatalf("name = %q, want field", name) - } - for _, tt := range []struct { - opt string - want bool - }{ - {"foobar", true}, - {"foo", true}, - {"bar", false}, - {"field", false}, - } { - if opts.Contains(tt.opt) != tt.want { - t.Errorf("Contains(%q) = %v", tt.opt, !tt.want) - } - } -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/availability_domain_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/availability_domain_test.go deleted file mode 100644 index 8047d7ca7d..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/availability_domain_test.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestListAvailabilityDomains(t *testing.T) { - client := helpers.GetClient("fixtures/availability_domain") - defer client.Stop() - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err) - - // List - list, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err) - require.NotNil(t, list) - assert.Len(t, list.AvailabilityDomains, 3, "List") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/compartment_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/compartment_test.go deleted file mode 100644 index 9f2cf05097..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/compartment_test.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestCompartmentCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/compartment") - defer client.Stop() - - // Create - // TODO: find a safe way to test creating compartments, which cannot be deleted - // id, err := helpers.CreateCompartment(client) - // assert.NoError(t, err, "Create") - - // TODO: Get - // compartment, err := client.GetCompartment(id) - // assert.NoError(t, err, "Get") - // assert.NotNil(t, compartment, "Get") - - // TODO: Update - // updateCompartment := bm.UpdateIdentityOptions{ - // Description: "new desc", - // } - // compartment, err = client.UpdateCompartment(id, &updateCompartment) - // assert.NoError(t, err, "Update") - // assert.Equal(t, "new desc", compartment.Description, "Update: Description") - - // List sans pagination - var options bm.ListOptions - options.Limit = 1 - - list, err := client.ListCompartments(&options) - assert.NoError(t, err, "List sans pagination") - assert.NotNil(t, list, "List sans pagination") - - assert.Len(t, list.Compartments, 1, "List sans pagination") - - // List with pagination - compartments := 0 - wantLen := 2 - for i := 0; i < wantLen; i++ { - list, err := client.ListCompartments(&options) - assert.NoError(t, err, "List with pagination, page %v", i) - assert.NotNil(t, list, "List with pagination, page %v", i) - - compartments += len(list.Compartments) - if list.NextPage == "" { - break - } - options.Page = list.NextPage - } - - assert.Equal(t, wantLen, compartments, "List with pagination: len") - - // Note: compartments do not support Delete -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/core_private_ip_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/core_private_ip_test.go deleted file mode 100644 index 2a1bf4bae5..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/core_private_ip_test.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -// +build recording,core recording,all !recording - -package acceptance - -import ( - "strings" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -const ( - ipAddress = "172.16.0.3" - displayName1 = "privateIP" - displayName2 = "privateIP2" - hostnameLabel = "hostnamelabel" -) - -func TestPrivateIP(t *testing.T) { - client := helpers.GetClient("fixtures/core/private_ip") - defer client.Stop() - - // Get compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err) - // Get Availability Domain - ads, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err) - availabilityDomainName := ads.AvailabilityDomains[0].Name - // Create VCN - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err) - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err) - }() - require.NotEmpty(t, vcnID) - // Create Subnet - subnetID, err := helpers.CreateSubnet(client, compartmentID, availabilityDomainName, vcnID) - require.NoError(t, err) - defer func() { - _, err := helpers.DeleteSubnet(client, subnetID) - assert.NoError(t, err) - helpers.Sleep(2 * time.Second) - }() - require.NotEmpty(t, subnetID) - // Create Instance - instanceID, err := helpers.CreateInstance( - client, - compartmentID, - availabilityDomainName, - helpers.FastestImageID, - helpers.SmallestShapeName, - subnetID, - ) - require.NoError(t, err) - defer func() { - _, err := helpers.DeleteInstance(client, instanceID) - assert.NoError(t, err) - }() - require.NotEmpty(t, instanceID) - - //get VNIC ID - opts := &baremetal.ListVnicAttachmentsOptions{} - opts.InstanceID = instanceID - vnicAttachments, err := client.ListVnicAttachments(compartmentID, opts) - var vnicID string - if err == nil { - vnicID = vnicAttachments.Attachments[0].VnicID - } - - //Create private ip - CreateOpts := &baremetal.CreatePrivateIPOptions{} - CreateOpts.DisplayName = displayName1 - CreateOpts.IPAddress = ipAddress - privateIP, err := client.CreatePrivateIP(vnicID, CreateOpts) - assert.NoError(t, err) - assert.NotNil(t, privateIP) - privateIPID := privateIP.ID - defer func() { - err := client.DeletePrivateIP(privateIPID, nil) - assert.NoError(t, err) - }() - require.NotEmpty(t, privateIPID) - assert.Equal(t, vnicID, privateIP.VnicID) - assert.Equal(t, displayName1, privateIP.DisplayName) - assert.Equal(t, ipAddress, privateIP.IPAddress) - - //Get Private IP - privateIPObj, err := client.GetPrivateIP(privateIPID) - require.NoError(t, err) - assert.Equal(t, privateIPID, privateIPObj.ID) - assert.Equal(t, false, privateIPObj.IsPrimary) - assert.Equal(t, subnetID, privateIPObj.SubnetID) - assert.Equal(t, vnicID, privateIPObj.VnicID) - assert.NotEmpty(t, privateIPObj.ETag) - assert.NotEmpty(t, privateIPObj.RequestID) - assert.NotEmpty(t, privateIPObj.TimeCreated) - - //Update Private IP - updateOpts := &baremetal.UpdatePrivateIPOptions{} - updateOpts.DisplayName = displayName2 - privateIP, err = client.UpdatePrivateIP(privateIPID, updateOpts) - assert.NoError(t, err) - assert.NotNil(t, privateIP) - assert.Equal(t, privateIP.DisplayName, displayName2) - updateOpts.HostnameLabel = hostnameLabel - privateIP, err = client.UpdatePrivateIP(privateIPID, updateOpts) - assert.NoError(t, err) - assert.NotNil(t, privateIP) - assert.Equal(t, privateIP.HostnameLabel, hostnameLabel) - - //test multiple ways to List (in accordance with spec) - var privateIPs *baremetal.ListPrivateIPs - var found bool - - //list using subnetID - listOpts := &baremetal.ListPrivateIPsOptions{} - listOpts.SubnetID = subnetID - privateIPs, err = client.ListPrivateIPs(listOpts) - require.NoError(t, err) - found = false - for _, privateIP := range privateIPs.PrivateIPs { - if strings.Compare(privateIPID, privateIP.ID) == 0 { - found = true - } - } - require.True(t, found, "Created Private IP not found while listing by subnetID") - - //list using subnetID and IP, this is used to get PrivateIP by IPAddress - listOpts.IPAddress = ipAddress - privateIPs, err = client.ListPrivateIPs(listOpts) - require.NoError(t, err) - found = false - for _, privateIP := range privateIPs.PrivateIPs { - if strings.Compare(privateIPID, privateIP.ID) == 0 { - found = true - } - } - require.True(t, found, "Created Private IP not found while listing by subnetID and Private IP") - - //list using vnicID - listOpts = &baremetal.ListPrivateIPsOptions{} - listOpts.VnicID = vnicID - privateIPs, err = client.ListPrivateIPs(listOpts) - require.NoError(t, err) - found = false - for _, privateIP := range privateIPs.PrivateIPs { - if strings.Compare(privateIPID, privateIP.ID) == 0 { - found = true - } - } - require.True(t, found, "Created Private IP not found while listing by VNIC ID") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/cpe_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/cpe_test.go deleted file mode 100644 index 165250cfa1..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/cpe_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestCPECRUD(t *testing.T) { - client := helpers.GetClient("fixtures/cpe") - defer client.Stop() - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - - // Create - cpe, err := client.CreateCpe(compartmentID, "120.90.41.18", nil) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, cpe.ID, "Create: ID") - - // TODO: Get - // TODO: Update - - // List - cpes, err := client.ListCpes(compartmentID, nil) - assert.NoError(t, err, "List") - found := false - for _, ce := range cpes.Cpes { - if strings.Compare(ce.ID, cpe.ID) == 0 { - found = true - } - } - assert.True(t, found, "List: Created CPE not found") - - // Delete - err = client.DeleteCpe(cpe.ID, nil) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/database_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/database_test.go deleted file mode 100644 index 69c97e8190..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/database_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package acceptance - -import ( - "strings" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestDatabaseCRUD(t *testing.T) { - // Arrange - client := helpers.GetClient("fixtures/database") - defer client.Stop() - // Get compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - // Get Availability Domain - ads, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err, "Setup AvailabilityDomains") - availabilityDomainName := ads.AvailabilityDomains[0].Name - // Create VCN (DnsLabel is required for DB Systems) - vcnOpts := &bm.CreateVcnOptions{ - DnsLabel: "database", - } - vcnID, err := helpers.CreateVCNWithOptions(client, "172.16.0.0/16", compartmentID, vcnOpts) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err, "Teardown VCN") - }() - // Create Subnet - subnetOpts := &bm.CreateSubnetOptions{ - DNSLabel: "test", - } - subnetID, err := helpers.CreateSubnetWithOptions(client, compartmentID, availabilityDomainName, vcnID, "172.16.0.0/16", subnetOpts) - require.NoError(t, err, "Setup Subnet") - require.NotEmpty(t, subnetID, "Setup Subnet: ID") - defer func() { - _, err = helpers.DeleteSubnet(client, subnetID) - assert.NoError(t, err, "Teardown Subnet") - helpers.Sleep(2 * time.Second) - }() - - versions, err := client.ListDBVersions(compartmentID, nil) - assert.NoError(t, err, "ListDBVersions") - version := versions.DBVersions[1] - - shapes, err := client.ListDBSystemShapes(availabilityDomainName, compartmentID, nil) - assert.NoError(t, err, "ListDBSystemShapes") - assert.NotEmpty(t, shapes, "ListDBSystemShapes") - - dbHomeOpts := &bm.CreateDBHomeOptions{ - DisplayNameOptions: bm.DisplayNameOptions{DisplayName: "dbHomeDisplayName"}, - } - dbOpts := &bm.CreateDatabaseOptions{ - CharacterSet: "AL32UTF8", - NCharacterSet: "AL16UTF16", - DBWorkload: "OLTP", - PDBName: "pdbName", - } - db := bm.NewCreateDatabaseDetails("ABab_#789", "dbname", dbOpts) - dbHome := bm.NewCreateDBHomeDetails(db, version.Version, dbHomeOpts) - opts := &bm.LaunchDBSystemOptions{ - Domain: "testDBDomain", - DataStoragePercentage: 80, - DiskRedundancy: "HIGH", - InitialDataStorageSizeInGB: 256, - LicenseModel: bm.BringYourOwnLicense, - NodeCount: 1, - } - opts.DisplayName = "dbDisplayName" - sys, err := client.LaunchDBSystem( - availabilityDomainName, - compartmentID, - 2, // this parameter is not used because the core count is inferred from the shape - bm.DatabaseEditionStandard, - dbHome, - "test-db-system-hostname", - "VM.Standard1.2", - []string{"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWm/fWAxfDy2DxlJLvIRubenc/aO77QaoSHXotCAxCkgttaxv+YNGyJIxO1hGDbmxwlBfyYivHCAg+LMBX6vrp8esA5B3Gnd9kLcvnfazGFvCmGJAecoZFwGvGJb5UeFZI6jCmELp/QbAx7wL2iOvCB+HY3K18sVft0kk4vd/p9iXiXrDPBytdZcYtR6hBU8pal6+FR1o0UlGbK8vvTi3r57IJ/U+DMs1wRHYvIEBWGoCBeuCXqL5PQU+HxGp1SwmicQGZbXS4x1XW1Hvc4pudvfoC0YOVXmVYIE3ZgWYzyid/IPm/JEs9wlbPN1zoCbHQjxKd7o15B2nSvDj0/gTT gotascii@gmail.com"}, - subnetID, - opts, - ) - assert.NoError(t, err, "LaunchDBSystem") - dbSystemID := sys.ID - - sys, err = client.GetDBSystem(dbSystemID) - assert.NoError(t, err, "GetDBSystem") - assert.Equal(t, dbSystemID, sys.ID) - assert.Equal(t, bm.BringYourOwnLicense, sys.LicenseModel) - - systems, err := client.ListDBSystems(compartmentID, nil) - assert.NoError(t, err, "ListDBSystems") - found := false - for _, system := range systems.DBSystems { - if strings.Compare(dbSystemID, system.ID) == 0 { - found = true - } - } - assert.True(t, found, "ListDBSystems: Launched DBSystem not found") - - nodes, err := client.ListDBNodes(compartmentID, dbSystemID, nil) - assert.NoError(t, err, "ListDBNodes") - assert.NotEmpty(t, nodes, "ListDBNodes") - for _, node := range nodes.DBNodes { - assert.Equal(t, dbSystemID, node.DBSystemID, "ListDBNodes") - } - - homes, err := client.ListDBHomes(compartmentID, dbSystemID, nil) - assert.NoError(t, err, "ListDBHomes") - assert.NotEmpty(t, homes, "ListDBHomes") - for _, home := range homes.DBHomes { - assert.Equal(t, dbSystemID, home.DBSystemID, "ListDBHomes") - } - - err = client.TerminateDBSystem(dbSystemID, nil) - assert.NoError(t, err, "TerminateDBSystem") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/dhcp_options_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/dhcp_options_test.go deleted file mode 100644 index 6a0b089d54..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/dhcp_options_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestDHCPOptionCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/dhcp_options") - defer client.Stop() - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err, "Teardown VCN") - }() - - // Create - dhcpID, err := helpers.CreateDhcpOption(client, compartmentID, vcnID) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, dhcpID, "Create: ID") - - // TODO: Get - // TODO: Update - - // List - opts, err := client.ListDHCPOptions(compartmentID, vcnID, nil) - assert.NoError(t, err, "List") - found := false - for _, opt := range opts.DHCPOptions { - if strings.Compare(dhcpID, opt.ID) == 0 { - found = true - } - } - assert.True(t, found, "List: Created DHCPOptions not found") - - // Delete - _, err = helpers.DeleteDhcpOption(client, dhcpID) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/drg_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/drg_test.go deleted file mode 100644 index 1fa39cbce9..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/drg_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestDRGDRUD(t *testing.T) { - client := helpers.GetClient("fixtures/drg") - defer client.Stop() - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - - // Create - drgID, err := helpers.CreateDrg(client, compartmentID) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, drgID, "Create: ID") - - // TODO: Get - // TODO: Update - - // List - drgs, err := client.ListDrgs(compartmentID, nil) - assert.NoError(t, err, "List") - found := false - for _, drg := range drgs.Drgs { - if strings.Compare(drgID, drg.ID) == 0 { - found = true - } - } - assert.True(t, found, "List: Created DRG not found") - - // Delete - _, err = helpers.DeleteDrg(client, drgID) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/group_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/group_test.go deleted file mode 100644 index 202478d394..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/group_test.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestGroupCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/group") - defer client.Stop() - - // Create - var gids []string - for i := 0; i < 4; i++ { - id, err := helpers.CreateGroup(client) - assert.NoError(t, err, "Create %v", i) - gids = append(gids, id) - } - - // TODO: Get - - // Update - id := gids[0] - - opt := bm.UpdateIdentityOptions{ - Description: "new description", - } - g, err := client.UpdateGroup(id, &opt) - assert.NoError(t, err, "Update") - assert.Equal(t, opt.Description, g.Description, "Update: Description") - - // List with pagination - var options bm.ListOptions - options.Limit = 1 - lenGroups := 0 - for i := 0; i < 2; i++ { - list, err := client.ListGroups(&options) - assert.NoError(t, err, "List with pagination: page %v", i) - assert.NotNil(t, list, "List with pagination: page %v", i) - lenGroups += len(list.Groups) - if list.NextPage == "" { - break - } - options.Page = list.NextPage - } - assert.Equal(t, 2, lenGroups, "List with pagination: len") - - // Delete - for _, id := range gids { - err := client.DeleteGroup(id, nil) - assert.NoError(t, err, "Delete") - } -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/core.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/core.go deleted file mode 100644 index ee01c3dbd7..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/core.go +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package helpers - -import ( - "errors" - "log" - "math/rand" - "net/http" - "reflect" - "strconv" - "sync" - "time" - - "github.com/dnaeon/go-vcr/recorder" - - bm "github.com/oracle/bmcs-go-sdk" -) - -type Runmode string - -const ( - RunmodeRecord Runmode = "RECORD" - RunmodeReplay Runmode = "REPLAY" -) - -// This test used to dynamically select the image and shape from the available options, but some images and sizes are /much/ slower to create than others. These are known to be better than the worst case, but feel free to optimize more! -const ( - OracleLinux73ImageID = "ocid1.image.oc1.phx.aaaaaaaa6uwtn7h3hogd5zlwd35eeqbndurkayshzvrfx5usqn6cwxd5vdqq" // DisplayName: Oracle-Linux-7.3-2017.05.23-0 - FastestImageID = OracleLinux73ImageID - SmallestShapeName = "VM.Standard1.1" -) - -type stopper interface { - Stop() error -} - -type TestClient struct { - *bm.Client - recorder *recorder.Recorder -} - -func (tc *TestClient) Stop() error { - return tc.recorder.Stop() -} - -type testTransport struct { - requestCount int - realTransport http.RoundTripper - mtx sync.Mutex -} - -func NewTestTransport(t http.RoundTripper) http.RoundTripper { - tt := &testTransport{ - realTransport: http.DefaultTransport, - } - if t != nil { - tt.realTransport = t - } - return tt -} - -func (tt *testTransport) RoundTrip(req *http.Request) (*http.Response, error) { - req.Header.Add("Request-Number", strconv.Itoa(tt.requestCount)) - tt.mtx.Lock() - tt.requestCount++ - tt.mtx.Unlock() - return tt.realTransport.RoundTrip(req) -} - -var validNameChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_" - -func RandomText(keySize int) string { - key := make([]byte, keySize) - r := rand.New(rand.NewSource(time.Now().UnixNano())) - r.Read(key) - for i := range key { - key[i] = validNameChars[key[i]%byte(len(validNameChars))] - } - return string(key) -} - -func BoolPtr(v bool) *bool { - return &v -} - -const maxWaitDuration = 120 * time.Minute - -type resourceCommandResult struct { - id string - err error -} - -var errResourceCommandTimeout = errors.New("timed out waiting to apply command to resource") - -// commandFunc takes a channel; when called should push a resourceCreateResponse onto the channel and return whether the finished executing -type commandFunc func(c chan<- resourceCommandResult) (finished bool) - -// resourceApply takes a commandFunc; executes it; and returns an id. -// If the command fails to execute, returns an error. -func resourceApply(f commandFunc) (id string, err error) { - idChan := make(chan resourceCommandResult) - go func(c chan<- resourceCommandResult) { - log.Println("[DEBUG] RUNMODE: " + RUNMODE) - // linear backoff - waitDuration := 1 - for { - if finished := f(idChan); finished { - return - } - if RUNMODE == RunmodeRecord { - log.Printf("[DEBUG] Waiting %d second(s)\n", waitDuration) - Sleep(time.Duration(waitDuration) * time.Second) - waitDuration += 1 - } - } - }(idChan) - for { - select { - case r := <-idChan: - return r.id, r.err - case <-time.After(maxWaitDuration): - return "", errResourceCommandTimeout - } - } -} - -func getCreatedState(resource interface{}) string { - v := reflect.ValueOf(resource).Elem().FieldByName("State") - - if !v.IsValid() { - panic("Developer error, resource passed to getCreatedState does not have a State field") - } - - return v.Interface().(string) -} - -func getID(resource interface{}) string { - v := reflect.ValueOf(resource) - if !v.IsValid() { - panic("Developer error, resource passed to getID is not valid") - } - if v.IsNil() { - return "" - } - id := v.Elem().FieldByName("ID") - - return id.Interface().(string) -} - -func isResourceGoneOrTerminated(resource interface{}, err error) (bool, error) { - if bmError, ok := err.(*bm.Error); ok { - if bmError.Code == bm.NotAuthorizedOrNotFound { - return true, nil - } - } - if err != nil { - return false, err - } - - v := reflect.ValueOf(resource).Elem().FieldByName("State") - - if !v.IsValid() { - panic("Developer error, resource passed to isResourceGoneOrTerminated does not have a state field") - } - - state := v.Interface().(string) - - if state == bm.ResourceTerminated { - return true, nil - } - return false, nil -} - -func getCreateFn(err error, resource interface{}, completedState string, resourceFetchFn func() (interface{}, error)) commandFunc { - id := getID(resource) // This wont be used if err != nil - return func(c chan<- resourceCommandResult) bool { - if err != nil { - c <- resourceCommandResult{"", err} - return true - } - fresh, err := resourceFetchFn() - if err != nil { - c <- resourceCommandResult{"", err} - return true - } - if getCreatedState(fresh) == completedState { - c <- resourceCommandResult{id, nil} - return true - } - return false - } -} - -// getDeleteFn takes an error, an id, and a func to fetch the resource; returns a createFunc. -// the createFunc will fetch the resource and check if it is gone, returning -func getDeleteFn(err error, id string, resourceFetchFn func() (interface{}, error)) commandFunc { - return func(c chan<- resourceCommandResult) bool { - if err != nil { - c <- resourceCommandResult{"", err} - return true - } - res, erra := resourceFetchFn() - /*if erra != nil { - c <- resourceCommandResult{"", erra} - return true - }*/ - gone, errb := isResourceGoneOrTerminated(res, erra) - if errb != nil { - c <- resourceCommandResult{"", errb} - return true - } - if gone { - c <- resourceCommandResult{id, nil} - return true - } - return false - } -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/shared.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/shared.go deleted file mode 100644 index 0e12b308fe..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/shared.go +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package helpers - -import ( - "log" - "time" - - bm "github.com/oracle/bmcs-go-sdk" -) - -func Sleep(d time.Duration) { - if RUNMODE == RunmodeRecord { - time.Sleep(d) - } -} - -func CreateVCNWithOptions(client *TestClient, cidr, compartmentID string, opts *bm.CreateVcnOptions) (string, error) { - log.Printf("[DEBUG] Create VCN with CIDR:%v", cidr) - if opts == nil { - opts = &bm.CreateVcnOptions{} - } - vcn, err := client.CreateVirtualNetwork(cidr, compartmentID, opts) - return resourceApply(getCreateFn(err, vcn, bm.ResourceAvailable, func() (interface{}, error) { - return client.GetVirtualNetwork(vcn.ID) - })) -} - -func CreateVCN(client *TestClient, cidr, compartmentID string) (string, error) { - unique := RandomText(8) - displayName := "vcn_" + unique - retryToken := "retry_token_" + unique - opts := &bm.CreateVcnOptions{ - CreateOptions: bm.CreateOptions{ - DisplayNameOptions: bm.DisplayNameOptions{DisplayName: displayName}, - RetryTokenOptions: bm.RetryTokenOptions{RetryToken: retryToken}, - }, - } - return CreateVCNWithOptions(client, cidr, compartmentID, opts) -} - -func DeleteVCN(client *TestClient, id string) (string, error) { - log.Printf("[DEBUG] Delete VCN") - err := client.DeleteVirtualNetwork(id, nil) - // FIXME: always returns an error because the VCN jumps directly from State:TERMINATING to http status:404 - return resourceApply(getDeleteFn(err, id, func() (interface{}, error) { - log.Printf("[DEBUG] Get VCN.State for Delete") - return client.GetVirtualNetwork(id) - })) -} - -func CreateSubnetWithOptions(client *TestClient, compartmentID, availabilityDomainName, vcnID, cidr string, opts *bm.CreateSubnetOptions) (string, error) { - log.Printf("[DEBUG] Create Subnet with CIDR:%v", cidr) - if opts == nil { - opts = &bm.CreateSubnetOptions{} - } - subnet, err := client.CreateSubnet(availabilityDomainName, cidr, compartmentID, vcnID, opts) - return resourceApply(getCreateFn(err, subnet, bm.ResourceAvailable, func() (interface{}, error) { - log.Printf("[DEBUG] Get Subnet.State for Create") - return client.GetSubnet(subnet.ID) - })) -} - -func CreateSubnet(client *TestClient, compartmentID, availabilityDomainName, vcnID string) (string, error) { - cidr := "172.16.0.0/16" - return CreateSubnetWithOptions(client, compartmentID, availabilityDomainName, vcnID, cidr, nil) -} - -func DeleteSubnet(client *TestClient, subnetID string) (string, error) { - log.Printf("[DEBUG] Delete Subnet") - err := client.DeleteSubnet(subnetID, nil) - // FIXME: always returns an error because the subnet jumps directly from State:TERMINATING to http status:404 - return resourceApply(getDeleteFn(err, subnetID, func() (interface{}, error) { - log.Printf("[DEBUG] Get Subnet.State for Delete") - s, err := client.GetSubnet(subnetID) - if err == nil { - log.Printf("[WARN] Subnet state: %v", s.State) - } - return s, err - })) -} - -func CreateInternetGateway(client *TestClient, compartmentID, vcnID string) (string, error) { - log.Printf("[DEBUG] Create InternetGateway") - ig, err := client.CreateInternetGateway(compartmentID, vcnID, true, nil) - return resourceApply(getCreateFn(err, ig, bm.ResourceAvailable, func() (interface{}, error) { - return client.GetInternetGateway(ig.ID) - })) -} - -func DeleteInternetGateway(client *TestClient, id string) (string, error) { - log.Printf("[DEBUG] Delete InternetGateway") - err := client.DeleteInternetGateway(id, nil) - return resourceApply(getDeleteFn(err, id, func() (interface{}, error) { - return client.GetInternetGateway(id) - })) -} - -func DeleteSecurityList(client *TestClient, id string) (string, error) { - log.Printf("[DEBUG] Delete SecurityList") - err := client.DeleteSecurityList(id, nil) - return resourceApply(getDeleteFn(err, id, func() (interface{}, error) { - return client.GetSecurityList(id) - })) -} - -func CreateRouteTable(client *TestClient, compartmentID, vcnID, targetID string) (string, error) { - log.Printf("[DEBUG] Create RouteTable") - rules := []bm.RouteRule{ - { - NetworkEntityID: targetID, - CidrBlock: "0.0.0.0/0", - }, - } - rt, err := client.CreateRouteTable(compartmentID, vcnID, rules, nil) - return resourceApply(getCreateFn(err, rt, bm.ResourceAvailable, func() (interface{}, error) { - return client.GetRouteTable(rt.ID) - })) -} - -func DeleteRouteTable(client *TestClient, id string) (string, error) { - log.Printf("[DEBUG] Delete RouteTable") - err := client.DeleteRouteTable(id, nil) - return resourceApply(getDeleteFn(err, id, func() (interface{}, error) { - return client.GetRouteTable(id) - })) -} - -func CreateDhcpOption(client *TestClient, compartmentID, vcnID string) (string, error) { - log.Printf("[DEBUG] Create DHCPOption") - dhcp := []bm.DHCPDNSOption{ - { - Type: "DomainNameServer", - CustomDNSServers: []string{"202.44.61.9"}, - ServerType: "CustomDnsServer", - }, - } - dhcpOpt, err := client.CreateDHCPOptions(compartmentID, vcnID, dhcp, nil) - return resourceApply(getCreateFn(err, dhcpOpt, bm.ResourceAvailable, func() (interface{}, error) { - return client.GetDHCPOptions(dhcpOpt.ID) - })) -} - -func DeleteDhcpOption(client *TestClient, id string) (string, error) { - log.Printf("[DEBUG] Delete DHCPOption") - err := client.DeleteDHCPOptions(id, nil) - return resourceApply(getDeleteFn(err, id, func() (interface{}, error) { - return client.GetDHCPOptions(id) - })) -} - -func CreateDrg(client *TestClient, compartmentID string) (string, error) { - log.Printf("[DEBUG] Create DRG") - drg, err := client.CreateDrg(compartmentID, nil) - return resourceApply(getCreateFn(err, drg, bm.ResourceAvailable, func() (interface{}, error) { - return client.GetDrg(drg.ID) - })) -} - -func DeleteDrg(client *TestClient, id string) (string, error) { - log.Printf("[DEBUG] Delete DRG") - err := client.DeleteDrg(id, nil) - return resourceApply(getDeleteFn(err, id, func() (interface{}, error) { - return client.GetDrg(id) - })) -} - -func CreateInstance(client *TestClient, compartmentID, availabilityDomainName, image, shape, subnetID string) (string, error) { - log.Printf("[DEBUG] Create Instance") - opts := &bm.LaunchInstanceOptions{CreateOptions: bm.CreateOptions{DisplayNameOptions: bm.DisplayNameOptions{DisplayName: "instance"}}} - instance, err := client.LaunchInstance(availabilityDomainName, compartmentID, image, shape, subnetID, opts) - return resourceApply(getCreateFn(err, instance, bm.ResourceRunning, func() (interface{}, error) { - return client.GetInstance(instance.ID) - })) -} - -func DeleteInstance(client *TestClient, id string) (string, error) { - log.Printf("[DEBUG] Delete Instance") - err := client.TerminateInstance(id, nil) - return resourceApply(getDeleteFn(err, id, func() (interface{}, error) { - return client.GetInstance(id) - })) -} - -func CreateVolumeAttachment(client *TestClient, instanceID, volumeID string) (string, error) { - log.Printf("[DEBUG] Create VolumeAttachment") - av, err := client.AttachVolume("iscsi", instanceID, volumeID, nil) - return resourceApply(getCreateFn(err, av, bm.ResourceRunning, func() (interface{}, error) { - return client.GetVolumeAttachment(av.ID) - })) -} - -func DeleteVolumeAttachment(client *TestClient, id string) (string, error) { - log.Printf("[DEBUG] Delete VolumeAttachment") - err := client.DetachVolume(id, nil) - return resourceApply(getDeleteFn(err, id, func() (interface{}, error) { - return client.GetVolumeAttachment(id) - })) -} - -func CreatePolicy(client *TestClient, statements []string, compartmentID string) (string, error) { - log.Printf("[DEBUG] Create Policy") - unique := RandomText(8) - name := "test_policy_" + unique - retry := "retry_tokey_" + unique - opts := &bm.CreatePolicyOptions{ - RetryTokenOptions: bm.RetryTokenOptions{ - RetryToken: retry, - }, - } - policy, err := client.CreatePolicy(name, "desc", compartmentID, statements, opts) - return resourceApply(getCreateFn(err, policy, bm.ResourceActive, func() (interface{}, error) { - return client.GetPolicy(policy.ID) - })) -} - -func CreateUser(client *TestClient) (string, error) { - log.Printf("[DEBUG] Create User") - uniqueName := RandomText(8) - testUser := "test_user_" + uniqueName - retryToken := "retry_token_" + uniqueName - user, err := client.CreateUser(testUser, "test user", &bm.RetryTokenOptions{RetryToken: retryToken}) - return resourceApply(getCreateFn(err, user, bm.ResourceActive, func() (interface{}, error) { - return client.GetUser(user.ID) - })) -} - -func CreateGroup(client *TestClient) (string, error) { - log.Printf("[DEBUG] Create Group") - uniqueName := RandomText(8) - tg := "test_group_" + uniqueName - rt := "retry_token_" + uniqueName - group, err := client.CreateGroup(tg, "test group", &bm.RetryTokenOptions{RetryToken: rt}) - return resourceApply(getCreateFn(err, group, bm.ResourceActive, func() (interface{}, error) { - return client.GetGroup(group.ID) - })) -} - -func AddUserToGroup(client *TestClient, uid, gid string) (string, error) { - log.Printf("[DEBUG] Add User to Group") - retryToken := "token_" + RandomText(8) - userGroup, err := client.AddUserToGroup(uid, gid, &bm.RetryTokenOptions{RetryToken: retryToken}) - return resourceApply(getCreateFn(err, userGroup, bm.ResourceActive, func() (interface{}, error) { - return client.GetUserGroupMembership(userGroup.ID) - })) -} - -func CreateCompartment(client *TestClient) (string, error) { - log.Printf("[DEBUG] Create Compartment") - unique := RandomText(8) - compartmentName := "test_compartment_" + unique - retryToken := "retry_token_" + unique - compartment, err := client.CreateCompartment(compartmentName, "test", &bm.RetryTokenOptions{RetryToken: retryToken}) - return resourceApply(getCreateFn(err, compartment, bm.ResourceActive, func() (interface{}, error) { - return client.GetCompartment(compartment.ID) - })) -} - -// TODO: -func CreateLoadBalancer(client *TestClient, compartmentID string, subnets []string) (string, error) { - log.Printf("[DEBUG] Create LB") - unique := RandomText(8) - displayName := "lb_" + unique - retryToken := "retry_token_" + unique - opts := &bm.CreateLoadBalancerOptions{ - DisplayNameOptions: bm.DisplayNameOptions{DisplayName: displayName}, - } - opts.RetryTokenOptions = bm.RetryTokenOptions{RetryToken: retryToken} - wr, err := client.CreateLoadBalancer(nil, nil, compartmentID, nil, "100Mbps", subnets, opts) - return resourceApply(getCreateFn(err, wr, bm.WorkRequestSucceeded, func() (interface{}, error) { - return client.GetWorkRequest(wr, nil) - })) -} - -func DeleteLoadBalancer(client *TestClient, id string) (string, error) { - log.Printf("[DEBUG] Delete VCN") - wr, err := client.DeleteLoadBalancer(id, nil) - // FIXME: always returns an error because the VCN jumps directly from State:TERMINATING to http status:404 - return resourceApply(getDeleteFn(err, wr, func() (interface{}, error) { - log.Printf("[DEBUG] Get LB.State for Delete") - return client.GetLoadBalancer(id, nil) - })) -} - -// FindOrCreateCompartment selects an arbitrary compartment if any exist, or creates a new one if none already exist -func FindOrCreateCompartmentID(client *TestClient) (string, error) { - // get a compartment, any compartment - var listOpts bm.ListOptions - listOpts.Limit = 1 - list, err := client.ListCompartments(&listOpts) - if err != nil { - return "", err - } - if len(list.Compartments) == 1 { - compartment := list.Compartments[0] - log.Printf("[DEBUG] Compartment (name: %v, id: %v)", compartment.Name, compartment.ID) - return compartment.ID, nil - } else { - id, err := CreateCompartment(client) - if err != nil { - return "", err - } - log.Printf("[DEBUG] Created a new compartment (id: %v)", id) - return id, nil - } -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/shared_recording.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/shared_recording.go deleted file mode 100644 index 36c0c1682a..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/shared_recording.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -// +build recording - -package helpers - -import ( - "fmt" - "os" - - "github.com/dnaeon/go-vcr/recorder" - "github.com/joho/godotenv" - - bm "github.com/oracle/bmcs-go-sdk" -) - -const RUNMODE = RunmodeRecord - -const ( - prettyString = "===========================================================" -) - -var apiParams = map[string]string{} - -func init() { - if err := godotenv.Load(); err != nil { - panic("could not load required environment - " + err.Error()) - } - - keys := []string{ - "BAREMETAL_PRIVATE_KEY_PATH", - "BAREMETAL_TENANCY_OCID", - "BAREMETAL_USER_OCID", - "BAREMETAL_FINGERPRINT", - "BAREMETAL_KEY_PASSWORD", - "TEST_COMPARTMENT_ID", - } - fmt.Println(prettyString) - - for _, key := range keys { - val := os.Getenv(key) - fmt.Println(key, "=>", val) - apiParams[key] = val - } - - fmt.Println(prettyString) -} - -func GetClient(cassetteName string) *TestClient { - rec, err := recorder.NewAsMode(cassetteName, recorder.ModeRecording, NewTestTransport(nil)) - - if err != nil { - panic(fmt.Sprintf("could not create recorder. error: %s", err)) - } - - client, err := bm.NewClient( - apiParams["BAREMETAL_USER_OCID"], - apiParams["BAREMETAL_TENANCY_OCID"], - apiParams["BAREMETAL_FINGERPRINT"], - bm.CustomTransport(rec), - bm.PrivateKeyFilePath(apiParams["BAREMETAL_PRIVATE_KEY_PATH"]), - bm.PrivateKeyPassword(apiParams["BAREMETAL_KEY_PASSWORD"]), - ) - - if err != nil { - panic(fmt.Sprintf("could not create client. error: %s", err)) - } - - tc := &TestClient{ - Client: client, - recorder: rec, - } - - return tc - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/shared_replay.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/shared_replay.go deleted file mode 100644 index 5aa164f752..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/helpers/shared_replay.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -// +build !recording - -package helpers - -import ( - "fmt" - "net/http" - "regexp" - - "github.com/dnaeon/go-vcr/cassette" - "github.com/dnaeon/go-vcr/recorder" - - bm "github.com/oracle/bmcs-go-sdk" -) - -const RUNMODE = RunmodeReplay - -const ( - mockKey = ` ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,EB2F52157F4A19A2 - -iWOPMqtbRxstDZDCKeQsOWFgZ3XdMCfz84MWmB5imkM6D34kOj8BXQFIcc8Hi2Lj -YQQ03HcpSE8h8Fj5086frRDEl5Sd1QmThiT6DFsbvNom9coat1zwUZHoMIgY+cIH -LuIrlAVQaYidVC5MBgFoJlitszQpZnygnN8H8MMQS9WIIeV5wVqhpVZMzjp9Unq0 -RfSeryHIIH0ZwgSelnMbec5SRiMaWtqcjpL9p0qDIwmxdJW2JY3sDNQ2S+V1wNG4 -kXw8Bfd3+F7pw+s3xmZVVmdfNCHzWhGSV2ssOO9yovAd0tark2FNTYZTgx4HzijY -i11cAqgB8wfOpEe7RXleKhjJRdtto1ANeAx3wfTW0As7zXdoZCJy/7qXBfVBe+nA -I6j5fGba3b2kkDnrd740d4Na7/fHnMKt+j+Ke4+C/Kimxt6vuQtvb9brOjV+qpPW -6yLzyXaKtoZaGFi5839F08fr/2yY8huz7H5C1U6Gza2/8ZvIRhvCKJOvRYrTnnGT -08QsX+wzYNqUyl5j64L8QPACY3zdWpuxQ7FhM2fMnymDKJjBhoRbnEjxJppaES/Q -tPo6w7nB4sMHhOobyXG+12kToEl/BVnoL/KG77M4kTCno6tg4Ca8+cvw2y/dFj3u -KD+Tt3j4uITc4Majt9oNyWHINlM6lV0czF852RliwdZgf+yQxi734QeJj8XhcDNK -Pt2fiFxsVuy3JA4CYcfn/DuKGqrMwHE2rn1e9tQ8nzsZn84k+oLBHC4LBoEtCg/r -BxqK4FQpUzccw5hXGwvZobE6qnp77m0mkgukGmo0ieyumhlQt3lNGq8P4WQDFF0b -KnJzEf7Z58olBmkn8qtAGuYTEN9/1/LXMXE9RKTMe/5N7zJFqSIzSFasP58PMLmP -U+/dGRkXxMSXO8LvQm5JpY1K5fOjeZC5ePSmHlx5i9cxRJfU05W7XrNAdCwn4F3I -tji5wcCKFziOI2JREZSR5SjfxEbhUbdYQ/eEkzPSVfvPCBCBAxwMyy4NipRX0e3v -jeVBnR1Oxz19i85yOwHpsYARKcMY30o+aSpNafDp8jSKx6dJTTOKdaZ1X/IpNTdt -ppMgoicYof0es7rpsd9rB+n8l5LsspbTKq9f3JejqZC9FW8G/ZakmTuMPSc+ITub -zaiiRjN6+CJCA2t8l9zTFLrVb71H0/e9yZAW/TxFVWnkLJqZkFn1LGZxkQUOARQW -+/UDhzb/9rSypG+EHJD9MQDa//S6YnzdybpOq9dHg2Ttf1sevb8aLLRa2AL7s8cs -q8RuCTx7VKIkskVKcx1W8Cf56bZn4mZ95fzlNMbyIJNw+ZFcWKX1L54EpBI9i7zb -vUSXT2wUYYPMAF+Zbksa0aTU9rkqRP+gKmYaPDcO5kchegHjOfI5oqzJcZ+3udbV -sx3gkL1HT1nnFxKpzDeroE1YenOHF8WCbEUi6P1lDh7L6MhFfdFf5oIXL35pvui7 -GKOEzfUTeaEajeTogLYl/StW6i8+07acJ7Edk//jvqATf5jIG7hVHNQyOpwM8W/K -cMuGz30TqwTxIXNqqtKzz94jAigz3YWtJbWgBuphTqZ9xTWhPeipRw== ------END RSA PRIVATE KEY----- -` - - tenancyOcid = "ocid1.tenancy.oc1..aaaaaaaayfzsknabeptheebqsaicjddtlubq7dnwz5izbvs3vfs4xmkargta" - userOcid = "ocid1.user.oc1..aaaaaaaaubrcg3qvtqf2ormvbgjxty5bpj5acpjw2q7ul4pb3pha2vf56tqa" - fingerprint = "3a:09:91:bb:d1:66:a0:13:12:f1:bf:3e:f6:ea:16:09" -) - -var re = regexp.MustCompile(`(.*compartmentId=)ocid[a-zA-Z0-9.%]+(&?.*)`) - -func GetClient(cassetteName string) *TestClient { - rec, err := recorder.NewAsMode(cassetteName, recorder.ModeReplaying, nil) - - // Since the default matcher only matches by url, we inject a header with a sequential request number - // so we can find the appropriate request when we replay - rec.SetMatcher(func(r *http.Request, cr cassette.Request) bool { - - // maybe it's an exact match, return early - if cassette.DefaultMatcher(r, cr) && (r.Header.Get("Request-Number") == cr.Headers.Get("Request-Number")) { - return true - } - - // matching by url might not work if the user who recorded the test data had a different config from - // the user who is running the tests. Stripping compartmentId from the url accommodates that. - // Tripping hazard: theoretical cross-compartment acceptance could fail to replay due to this but - // most likely not due to the additional Request-Number provision. - subStr := re.ReplaceAllLiteralString(r.URL.String(), `$1$2`) - recStr := re.ReplaceAllLiteralString(cr.URL, `$1$2`) - return (recStr == subStr) && (r.Header.Get("Request-Number") == cr.Headers.Get("Request-Number")) - }) - - if err != nil { - panic(fmt.Sprintf("could not create recorder. error: %s", err)) - } - - client, err := bm.NewClient( - userOcid, - tenancyOcid, - fingerprint, - bm.PrivateKeyBytes([]byte(mockKey)), - bm.PrivateKeyPassword("supersecret"), - bm.CustomTransport(NewTestTransport(rec)), - ) - - if err != nil { - panic(fmt.Sprintf("could not create client. error: %s", err)) - - } - - tc := &TestClient{ - Client: client, - recorder: rec, - } - - return tc -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/instance_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/instance_test.go deleted file mode 100644 index d7515be0c7..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/instance_test.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "strings" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestInstanceCRUD(t *testing.T) { - // Arrange - client := helpers.GetClient("fixtures/instance") - defer client.Stop() - // Get compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - // Get Availability Domain - ads, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err, "Setup AvailabilityDomains") - availabilityDomainName := ads.AvailabilityDomains[0].Name - // Create VCN - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err, "Teardown VCN") - }() - // Create Subnet - subnetID, err := helpers.CreateSubnet(client, compartmentID, availabilityDomainName, vcnID) - require.NoError(t, err, "Setup Subnet") - require.NotEmpty(t, subnetID, "Setup Subnet: ID") - defer func() { - _, err := helpers.DeleteSubnet(client, subnetID) - assert.NoError(t, err, "Teardown Subnet") - helpers.Sleep(2 * time.Second) - }() - - // Create - id, err := helpers.CreateInstance( - client, - compartmentID, - availabilityDomainName, - helpers.FastestImageID, - helpers.SmallestShapeName, - subnetID, - ) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, id, "Create: ID") - - // TODO: Get - // TODO: Update - // TODO: InstanceAction - // TODO: GetWindowsInstanceInitialCredentials - - // List - instances, err := client.ListInstances(compartmentID, nil) - assert.NoError(t, err, "List") - found := false - for _, instance := range instances.Instances { - if strings.Compare(id, instance.ID) == 0 { - found = true - } - } - assert.True(t, found, "List: Created Instance not found") - - // Delete - _, err = helpers.DeleteInstance(client, id) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/internet_gateway_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/internet_gateway_test.go deleted file mode 100644 index 5000db2e3d..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/internet_gateway_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestInternetGatewayCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/internet_gateway") - defer client.Stop() - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err, "Teardown VCN") - }() - - // Create - igID, err := helpers.CreateInternetGateway(client, compartmentID, vcnID) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, igID, "Create: ID") - - // TODO: Get - // TODO: Update - - // List - igs, err := client.ListInternetGateways(compartmentID, vcnID, nil) - assert.NoError(t, err, "List") - found := false - for _, ig := range igs.Gateways { - if strings.Compare(igID, ig.ID) == 0 { - found = true - } - } - assert.True(t, found, "List: Created InternetGateway not found") - - // Delete - _, err = helpers.DeleteInternetGateway(client, igID) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_backendset_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_backendset_test.go deleted file mode 100644 index 0402265af6..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_backendset_test.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestBackendSetCRUD(t *testing.T) { - // TODO: this requires so much arrangement, can we simplify? - client := helpers.GetClient("fixtures/backend_set") - defer client.Stop() - // get a compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - // Get Availability Domains - ads, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err, "Setup AvailabilityDomains") - availabilityDomains := ads.AvailabilityDomains - // populate shapeName from ListShapes() - shapeList, err := client.ListLoadBalancerShapes(compartmentID, nil) - require.NoError(t, err, "Setup LoadBalancer Shapes") - shapes := shapeList.LoadBalancerShapes - // Create VCN - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - // Create subnets. Load Balancers require 2, each in seperate Availability Domains - subnetIDs := make([]string, 2) - for i := range subnetIDs { - subnetIDs[i], err = helpers.CreateSubnetWithOptions( - client, - compartmentID, - availabilityDomains[i].Name, - vcnID, - fmt.Sprintf("172.16.%d.0/24", i), - nil, - ) - require.NoError(t, err, "Setup Subnet %v", i) - } - helpers.Sleep(TIMEOUT) // TODO: can we verify the subnets have been created? - // Create minimal load balander - workRequestID, err := client.CreateLoadBalancer( - nil, - nil, - compartmentID, - nil, - shapes[0].Name, - subnetIDs, - &bm.CreateLoadBalancerOptions{ - DisplayNameOptions: bm.DisplayNameOptions{ - DisplayName: "my test LB", - }, - }, - ) - require.NoError(t, err, "Setup LoadBalancer") - require.NotEmpty(t, workRequestID, "Setup LoadBalancer: WorkRequest ID") - var workRequest *bm.WorkRequest - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - require.NoError(t, err, "Setup LoadBalancer: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) // wait until create is complete - } - require.NotEmpty(t, workRequest.LoadBalancerID, "Setup LoadBalancer: ID") - - // Create - workRequestID, err = client.CreateBackendSet( - workRequest.LoadBalancerID, - "backend-set-name", - "ROUND_ROBIN", - []bm.Backend{}, - &bm.HealthChecker{ - Protocol: "HTTP", - URLPath: "/", - }, - nil, // &bm.SSLConfiguration{}, - nil, - nil, - ) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, workRequestID, "Create: WorkRequest ID") - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - assert.NoError(t, err, "Create: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) - } - - // Get - lb, err := client.GetLoadBalancer(workRequest.LoadBalancerID, nil) - assert.NoError(t, err, "Get") - - assert.Equal(t, compartmentID, lb.CompartmentID, "Get: CompartmentID") - assert.Equal(t, "my test LB", lb.DisplayName, "Get: DisplayName") - assert.Equal(t, "100Mbps", lb.Shape, "Get: Shape") - assert.Len(t, lb.SubnetIDs, len(subnetIDs), "Get: SubnetIDs") - // SubnetIDs should use Set equivalance - for _, subnetID := range subnetIDs { - assert.Contains(t, - lb.SubnetIDs, - subnetID, - "Get: SubnetIDs", - ) - } - assert.Equal(t, - bm.BackendSet{ - Backends: []bm.Backend{}, - Policy: "ROUND_ROBIN", - Name: "backend-set-name", - HealthChecker: &bm.HealthChecker{ - Protocol: "HTTP", - IntervalInMS: 10000, - Port: 0, - ResponseBodyRegex: ".*", - URLPath: "/", - Retries: 3, - ReturnCode: 200, - TimeoutInMS: 3000, - }, - }, - lb.BackendSets["backend-set-name"], - "Get: BackendSet", - ) - // Note: Listener & Certificate operations happen in other test suites - assert.Equal(t, map[string]bm.Listener{}, lb.Listeners, "Get: Listeners") - assert.Equal(t, map[string]bm.Certificate{}, lb.Certificates, "Get: Certificates") - // Computed - assert.NotEmpty(t, lb.ID, "Get: ID") - assert.NotEmpty(t, lb.IPAddresses, "Get: IPAddresses") - assert.NotEmpty(t, lb.TimeCreated, "Get: TimeCreated") - - // TODO: Update - - // Delete - workRequestID, err = client.DeleteLoadBalancer(lb.ID, nil) - assert.NoError(t, err, "Delete") - assert.NotEmpty(t, workRequestID, "Delete: WorkRequest ID") - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - assert.NoError(t, err, "Delete: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) // wait until delete is complete - } - - // VCN requires all subnets to be deleted first - for _, subnetID := range subnetIDs { - helpers.DeleteSubnet(client, subnetID) - } - helpers.DeleteVCN(client, vcnID) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_certificate_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_certificate_test.go deleted file mode 100644 index dc933a6fd5..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_certificate_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestCertificateCRUD(t *testing.T) { - // TODO: this requires so much arrangement, can we simplify? - client := helpers.GetClient("fixtures/certificate") - defer client.Stop() - // get a compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - // Get Availability Domains - ads, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err, "Setup AvailabilityDomains") - availabilityDomains := ads.AvailabilityDomains - // populate shapeName from ListShapes() - shapeList, err := client.ListLoadBalancerShapes(compartmentID, nil) - require.NoError(t, err, "Setup LoadBalancer Shapes") - shapes := shapeList.LoadBalancerShapes - // Create VCN - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - // Create subnets. Load Balancers require 2, each in seperate Availability Domains - subnetIDs := make([]string, 2) - for i := range subnetIDs { - subnetIDs[i], err = helpers.CreateSubnetWithOptions( - client, - compartmentID, - availabilityDomains[i].Name, - vcnID, - fmt.Sprintf("172.16.%d.0/24", i), - nil, - ) - require.NoError(t, err, "Setup Subnet %v", i) - } - helpers.Sleep(TIMEOUT) // TODO: can we verify the subnets have been created? - // Create minimal load balander - workRequestID, err := client.CreateLoadBalancer( - nil, - nil, - compartmentID, - nil, - shapes[0].Name, - subnetIDs, - &bm.CreateLoadBalancerOptions{ - DisplayNameOptions: bm.DisplayNameOptions{ - DisplayName: "my test LB", - }, - }, - ) - require.NoError(t, err, "Setup LoadBalancer") - require.NotEmpty(t, workRequestID, "Setup LoadBalancer: WorkRequest ID") - var workRequest *bm.WorkRequest - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - require.NoError(t, err, "Setup LoadBalancer: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) // wait until create is complete - } - require.NotEmpty(t, workRequest.LoadBalancerID, "Setup LoadBalancer: ID") - - // Create - workRequestID, err = client.CreateCertificate( - workRequest.LoadBalancerID, - "certificate-name", - "", - "-----BEGIN RSA PRIVATE KEY-----\nMIIBOgIBAAJBAOUzyXPcEUkDrMGWwXreT1qM9WrdDVZCgdDePfnTwNEoh/Cp9X4L\nEvrdbd1mvAvhOuOqis/kJDfr4jo5YAsfbNUCAwEAAQJAJz8k4bfvJceBT2zXGIj0\noZa9d1z+qaSdwfwsNJkzzRyGkj/j8yv5FV7KNdSfsBbStlcuxUm4i9o5LXhIA+iQ\ngQIhAPzStAN8+Rz3dWKTjRWuCfy+Pwcmyjl3pkMPSiXzgSJlAiEA6BUZWHP0b542\nu8AizBT3b3xKr1AH2nkIx9OHq7F/QbECIHzqqpDypa8/QVuUZegpVrvvT/r7mn1s\nddS6cDtyJgLVAiEA1Z5OFQeuL2sekBRbMyP9WOW7zMBKakLL3TqL/3JCYxECIAkG\nl96uo1MjK/66X5zQXBG7F2DN2CbcYEz0r3c3vvfq\n-----END RSA PRIVATE KEY-----", - "", - "-----BEGIN CERTIFICATE-----\nMIIBNzCB4gIJAKtwJkxUgNpzMA0GCSqGSIb3DQEBCwUAMCMxITAfBgNVBAoTGElu\ndGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0xNzA0MTIyMTU3NTZaFw0xODA0MTIy\nMTU3NTZaMCMxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDBcMA0G\nCSqGSIb3DQEBAQUAA0sAMEgCQQDlM8lz3BFJA6zBlsF63k9ajPVq3Q1WQoHQ3j35\n08DRKIfwqfV+CxL63W3dZrwL4TrjqorP5CQ36+I6OWALH2zVAgMBAAEwDQYJKoZI\nhvcNAQELBQADQQCEjHVQJoiiVpIIvDWF+4YDRReVuwzrvq2xduWw7CIsDWlYuGZT\nQKVY6tnTy2XpoUk0fqUvMB/M2HGQ1WqZGHs6\n-----END CERTIFICATE-----", - nil, - ) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, workRequestID, "Create: WorkRequest ID") - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - assert.NoError(t, err, "Create: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) - } - - // Get - lb, err := client.GetLoadBalancer(workRequest.LoadBalancerID, nil) - assert.NoError(t, err, "Create") - - assert.Equal(t, - bm.Certificate{ - CertificateName: "certificate-name", - // PrivateKey should not be included in response, only in request - PublicCertificate: "-----BEGIN CERTIFICATE-----\nMIIBNzCB4gIJAKtwJkxUgNpzMA0GCSqGSIb3DQEBCwUAMCMxITAfBgNVBAoTGElu\ndGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0xNzA0MTIyMTU3NTZaFw0xODA0MTIy\nMTU3NTZaMCMxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDBcMA0G\nCSqGSIb3DQEBAQUAA0sAMEgCQQDlM8lz3BFJA6zBlsF63k9ajPVq3Q1WQoHQ3j35\n08DRKIfwqfV+CxL63W3dZrwL4TrjqorP5CQ36+I6OWALH2zVAgMBAAEwDQYJKoZI\nhvcNAQELBQADQQCEjHVQJoiiVpIIvDWF+4YDRReVuwzrvq2xduWw7CIsDWlYuGZT\nQKVY6tnTy2XpoUk0fqUvMB/M2HGQ1WqZGHs6\n-----END CERTIFICATE-----", - }, - lb.Certificates["certificate-name"], - "Create: Certificate", - ) - - // Note: Certificates have no Update operation - - // Delete - workRequestID, err = client.DeleteLoadBalancer(lb.ID, nil) - assert.NoError(t, err, "Delete") - assert.NotEmpty(t, workRequestID, "Delete: WorkRequest ID") - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - assert.NoError(t, err, "Delete: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) // wait until delete is complete - } - - // VCN requires all subnets to be deleted first - for _, subnetID := range subnetIDs { - helpers.DeleteSubnet(client, subnetID) - } - helpers.DeleteVCN(client, vcnID) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_listener_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_listener_test.go deleted file mode 100644 index d71edf8032..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_listener_test.go +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestListenerCRUD(t *testing.T) { - // TODO: this requires so much arrangement, can we simplify? - client := helpers.GetClient("fixtures/listener") - defer client.Stop() - // get a compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - // Get Availability Domains - ads, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err, "Setup AvailabilityDomains") - availabilityDomains := ads.AvailabilityDomains - // populate shapeName from ListShapes() - shapeList, err := client.ListLoadBalancerShapes(compartmentID, nil) - require.NoError(t, err, "Setup LoadBalancer Shapes") - shapes := shapeList.LoadBalancerShapes - // Create VCN - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - // Create subnets. Load Balancers require 2, each in seperate Availability Domains - subnetIDs := make([]string, 2) - for i := range subnetIDs { - subnetIDs[i], err = helpers.CreateSubnetWithOptions( - client, - compartmentID, - availabilityDomains[i].Name, - vcnID, - fmt.Sprintf("172.16.%d.0/24", i), - nil, - ) - require.NoError(t, err, "Setup Subnet %v", i) - } - helpers.Sleep(TIMEOUT) // TODO: can we verify the subnets have been created? - // Create minimal load balander - workRequestID, err := client.CreateLoadBalancer( - nil, - nil, - compartmentID, - nil, - shapes[0].Name, - subnetIDs, - &bm.CreateLoadBalancerOptions{ - DisplayNameOptions: bm.DisplayNameOptions{ - DisplayName: "my test LB", - }, - }, - ) - require.NoError(t, err, "Setup LoadBalancer") - require.NotEmpty(t, workRequestID, "Setup LoadBalancer: WorkRequest ID") - var workRequest *bm.WorkRequest - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - require.NoError(t, err, "Setup LoadBalancer: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) // wait until create is complete - } - require.NotEmpty(t, workRequest.LoadBalancerID, "Setup LoadBalancer: ID") - // Create load balancer backend set - workRequestID, err = client.CreateBackendSet( - workRequest.LoadBalancerID, - "backend-set-name", - "ROUND_ROBIN", - []bm.Backend{}, - &bm.HealthChecker{ - Protocol: "HTTP", - URLPath: "/", - }, - nil, // &bm.SSLConfiguration{}, - nil, - nil, - ) - require.NoError(t, err, "Setup LoadBalancer BackendSet") - require.NotEmpty(t, workRequestID, "Setup LoadBalancer BackendSet: WorkRequest ID") - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - require.NoError(t, err, "Setup LoadBalancer BackendSet: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) - } - protos, err := client.ListLoadBalancerProtocols( - compartmentID, - nil, - ) - require.NoError(t, err, "Setup LoadBalancer Protocols") - - // Create - workRequestID, err = client.CreateListener( - workRequest.LoadBalancerID, - "listener-name", - "backend-set-name", - protos.LoadBalancerProtocols[0].Name, - 1234, - nil, - nil, - ) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, workRequestID, "Create: WorkRequest ID") - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - assert.NoError(t, err, "Create: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) - } - - // Get - lb, err := client.GetLoadBalancer(workRequest.LoadBalancerID, nil) - assert.NoError(t, err, "Get") - - assert.Equal(t, - bm.Listener{ - DefaultBackendSetName: "backend-set-name", - Name: "listener-name", - Port: 1234, - Protocol: "HTTP", - SSLConfig: (*bm.SSLConfiguration)(nil), - }, - lb.Listeners["listener-name"], - "Get", - ) - - // TODO: Update SUT - - // Delete - workRequestID, err = client.DeleteLoadBalancer(lb.ID, nil) - assert.NoError(t, err, "Delete") - assert.NotEmpty(t, workRequestID, "Delete: WorkRequest ID") - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - assert.NoError(t, err, "Delete: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) // wait until delete is complete - } - - // VCN requires all subnets to be deleted first - for _, subnetID := range subnetIDs { - helpers.DeleteSubnet(client, subnetID) - } - helpers.DeleteVCN(client, vcnID) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_test.go deleted file mode 100644 index 1c90230bea..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/load_balancer_test.go +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "fmt" - "log" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -const TIMEOUT = (2 * time.Second) - -func TestLoadBalancerCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/load_balancer") - defer client.Stop() - // get a compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - // Get Availability Domains - ads, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err, "Setup AvailabilityDomains") - availabilityDomains := ads.AvailabilityDomains - // populate shapeName from ListShapes() - shapeList, err := client.ListLoadBalancerShapes(compartmentID, nil) - require.NoError(t, err, "Setup LoadBalancer Shapes") - shapes := shapeList.LoadBalancerShapes - // Create VCN - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - // Create subnets. Load Balancers require 2, each in seperate Availability Domains - subnetIDs := make([]string, 2) - for i := range subnetIDs { - subnetIDs[i], err = helpers.CreateSubnetWithOptions( - client, - compartmentID, - availabilityDomains[i].Name, - vcnID, - fmt.Sprintf("172.16.%d.0/24", i), - nil, - ) - require.NoError(t, err, "Setup Subnet %v", i) - } - helpers.Sleep(TIMEOUT) // TODO: can we verify the subnets have been created? - - // Create - workRequestID, err := client.CreateLoadBalancer( - nil, - nil, - compartmentID, - nil, - shapes[0].Name, - subnetIDs, - &bm.CreateLoadBalancerOptions{ - DisplayNameOptions: bm.DisplayNameOptions{ - DisplayName: "my test LB", - }, - }, - ) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, workRequestID, "Create: WorkRequest ID") - log.Printf("[DEBUG] Load Balancer Create Requested: %v", workRequestID) - var workRequest *bm.WorkRequest - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - assert.NoError(t, err, "Create: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) // wait until create is complete - } - assert.NotEmpty(t, workRequest.LoadBalancerID, "Create: ID") - - // Get - lb, err := client.GetLoadBalancer(workRequest.LoadBalancerID, nil) - assert.NoError(t, err, "Get") - assert.Equal(t, compartmentID, lb.CompartmentID, "Get: CompartmentID") - assert.Equal(t, "my test LB", lb.DisplayName, "Get: DisplayName") - assert.Equal(t, "100Mbps", lb.Shape, "Get: Shape") - // SubnetIDs should use Set equivalance - assert.Len(t, lb.SubnetIDs, len(subnetIDs), "Get: SubnetIDs") - for _, subnetID := range subnetIDs { - assert.Contains(t, - lb.SubnetIDs, - subnetID, - "Get", - ) - } - // Note: Backend, Listener & Certificate operations happen in other tests - assert.Equal(t, map[string]bm.BackendSet{}, lb.BackendSets, "Get: BackendSets") - assert.Equal(t, map[string]bm.Listener{}, lb.Listeners, "Get: Listeners") - assert.Equal(t, map[string]bm.Certificate{}, lb.Certificates, "Get: Certificates") - // Computed - assert.NotEmpty(t, lb.ID, "Get: ID") - assert.NotEmpty(t, lb.IPAddresses, "Get: IPAddresses") - assert.NotEmpty(t, lb.TimeCreated, "Get: TimeCreated") - - // TODO: Update - - // Delete - workRequestID, err = client.DeleteLoadBalancer(lb.ID, nil) - assert.NoError(t, err, "Delete") - assert.NotEmpty(t, workRequestID, "Delete: WorkRequest ID") - for { - workRequest, err = client.GetWorkRequest(workRequestID, nil) - assert.NoError(t, err, "Delete: WorkRequest Get") - if workRequest.State == bm.WorkRequestSucceeded { - break - } - helpers.Sleep(TIMEOUT) // wait until delete is complete - } - - // VCN requires all subnets to be deleted first - for _, subnetID := range subnetIDs { - helpers.DeleteSubnet(client, subnetID) - } - helpers.DeleteVCN(client, vcnID) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/objectstorage_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/objectstorage_test.go deleted file mode 100644 index bf5e3f659f..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/objectstorage_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestBucketCrud(t *testing.T) { - client := helpers.GetClient("fixtures/bucket") - defer client.Stop() - // get a compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - - // Create Bucket - bucket, err := client.CreateBucket(compartmentID, "bucketname", "mynamespace", nil) - assert.NoError(t, err, "Create Bucket") - assert.NotNil(t, bucket, "Create Bucket") - - helpers.Sleep(10 * time.Second) - - // TODO: Get Bucket - // TODO: Update Bucket - // TODO: Head Bucket - - // Put Object - obj, err := client.PutObject("mynamespace", "bucketname", "objectName", []byte("{\"content\": \"SomeContent\"}"), nil) - assert.NoError(t, err, "Put Object") - assert.NotNil(t, obj, "Put Object") - - // TODO: List Objects - // TODO: Get Object - // TODO: Head Object - - // Delete Object - _, err = client.DeleteObject("mynamespace", "bucketname", "objectName", nil) - assert.NoError(t, err, "Delete Object") - - // Delete Bucket - err = client.DeleteBucket("bucketname", "mynamespace", nil) - assert.NoError(t, err, "Delete Bucket") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/policy_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/policy_test.go deleted file mode 100644 index c2e3e35226..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/policy_test.go +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestPolicyCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/policy") - defer client.Stop() - // get a compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - c, err := client.GetCompartment(compartmentID) - require.NoError(t, err, "Setup Compartment Get") - compartmentName := c.Name - // Create group and get its name, we need this for statement - gid, err := helpers.CreateGroup(client) - require.NoError(t, err, "Setup Group") - defer func() { - err = client.DeleteGroup(gid, nil) - assert.NoError(t, err, "Teardown Group") - }() - group, err := client.GetGroup(gid) - require.NoError(t, err, "Setup Group Get") - - // Create - statements := []string{ - fmt.Sprintf("Allow group %s to manage users in compartment %s", group.Name, compartmentName), - fmt.Sprintf("Allow group %s to inspect all-resources in compartment %s", group.Name, compartmentName), - } - p1, err := helpers.CreatePolicy(client, []string{statements[0]}, compartmentID) - assert.NoError(t, err, "Create p1") - p2, err := helpers.CreatePolicy(client, []string{statements[1]}, compartmentID) - assert.NoError(t, err, "Create p2") - - // TODO: Get - - // Update - updateOpts := &bm.UpdatePolicyOptions{ - UpdateIdentityOptions: bm.UpdateIdentityOptions{ - Description: "new desc", - }, - Statements: statements, - } - policy, err := client.UpdatePolicy(p1, updateOpts) - assert.NoError(t, err, "Update") - assert.Len(t, policy.Statements, 2, "Update: Statements") - assert.Equal(t, "new desc", policy.Description, "Update: Description") - - // List - list, err := client.ListPolicies(compartmentID, nil) - assert.NoError(t, err, "List") - pols := map[string]bm.Policy{} - for _, p := range list.Policies { - pols[p.ID] = p - } - _, ok := pols[p1] - assert.True(t, ok, "List: Policy p1 ok") - _, ok = pols[p2] - assert.True(t, ok, "List: Policy p2 ok") - - // Delete - err = client.DeletePolicy(p1, nil) - assert.NoError(t, err, "Delete p1") - err = client.DeletePolicy(p2, nil) - assert.NoError(t, err, "Delete p2") - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/route_table_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/route_table_test.go deleted file mode 100644 index a85816b824..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/route_table_test.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestRouteTableCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/route_table") - defer client.Stop() - // get a compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - // Create VCN - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err, "Teardown VCN") - }() - // Create internet gateway - igID, err := helpers.CreateInternetGateway(client, compartmentID, vcnID) - require.NoError(t, err, "Setup InternetGateway") - require.NotEmpty(t, igID, "Setup InternetGateway: ID") - defer func() { - _, err := helpers.DeleteInternetGateway(client, igID) - assert.NoError(t, err, "Teardown InternetGateway") - }() - - // Create - rtID, err := helpers.CreateRouteTable(client, compartmentID, vcnID, igID) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, rtID, "Create: ID") - - // List - rts, err := client.ListRouteTables(compartmentID, vcnID, nil) - assert.NoError(t, err, "List") - found := false - for _, rt := range rts.RouteTables { - if strings.Compare(rtID, rt.ID) == 0 { - found = true - } - } - assert.True(t, found, "List: Created RouteTable not found") - - // Delete - _, err = helpers.DeleteRouteTable(client, rtID) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/security_list_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/security_list_test.go deleted file mode 100644 index 353015f760..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/security_list_test.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "time" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestSecurityListCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/security_list") - defer client.Stop() - // get a compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err, "Teardown VCN") - }() - - // Create - ingressRules := []bm.IngressSecurityRule{ - { - Source: "0.0.0.0/0", - Protocol: "6", // TCP - TCPOptions: &bm.TCPOptions{ - DestinationPortRange: &bm.PortRange{ - Min: 1, - Max: 2, - }, - }, - }, - } - egressRules := []bm.EgressSecurityRule{ - { - Destination: "0.0.0.0/0", - Protocol: "17", // UDP - UDPOptions: &bm.UDPOptions{ - DestinationPortRange: &bm.PortRange{ - Min: 1, - Max: 2, - }, - SourcePortRange: &bm.PortRange{ - Min: 3, - Max: 4, - }, - }, - }, - } - securityList, err := client.CreateSecurityList(compartmentID, vcnID, egressRules, ingressRules, nil) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, securityList.ID, "Create: ID") - - // Get - startTime := time.Now() - for { - securityList, _ := client.GetSecurityList(securityList.ID) - if securityList.State == bm.ResourceAvailable { - break - } - helpers.Sleep(2 * time.Second) - if time.Now().Sub(startTime) > 5*time.Minute { - assert.FailNow(t, "Timeout while waiting for Security List provisioning.") - } - } - - assert.Equal(t, bm.ResourceAvailable, securityList.State, "Get: State") - assert.Equal(t, 1, len(securityList.EgressSecurityRules)) - assert.Equal(t, uint64(2), securityList.EgressSecurityRules[0].UDPOptions.DestinationPortRange.Max) - assert.Equal(t, uint64(3), securityList.EgressSecurityRules[0].UDPOptions.SourcePortRange.Min) - assert.Equal(t, 1, len(securityList.IngressSecurityRules)) - assert.Equal(t, uint64(1), securityList.IngressSecurityRules[0].TCPOptions.DestinationPortRange.Min) - assert.Equal(t, "6", securityList.IngressSecurityRules[0].Protocol) - - // List - sls, err := client.ListSecurityLists(compartmentID, vcnID, nil) - assert.NoError(t, err, "List") - found := false - for _, sl := range sls.SecurityLists { - if strings.Compare(securityList.ID, sl.ID) == 0 { - found = true - } - } - assert.True(t, found, "List: Created SecurityList not found") - - // Delete - _, err = helpers.DeleteSecurityList(client, securityList.ID) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/subnet_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/subnet_test.go deleted file mode 100644 index 229af8bf9e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/subnet_test.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "strings" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestSubnetCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/subnet") - defer client.Stop() - // get a compartment, any compartment - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - // Get Availability Domains - ads, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err, "Setup AvailabilityDomains") - availabilityDomains := ads.AvailabilityDomains - // Create VCN - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err, "Teardown VCN") - }() - - // Create - id, err := helpers.CreateSubnet(client, compartmentID, availabilityDomains[0].Name, vcnID) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, id, "Create: ID") - - // TODO: Get - // TODO: Update - - // List - subnets, err := client.ListSubnets(compartmentID, vcnID, nil) - assert.NoError(t, err, "List") - found := false - for _, sub := range subnets.Subnets { - if strings.Compare(sub.ID, id) == 0 { - found = true - } - } - assert.True(t, found, "List: Created Subnet not found") - - // Delete - _, err = helpers.DeleteSubnet(client, id) - assert.NoError(t, err, "Delete") - helpers.Sleep(2 * time.Second) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/user_group_membership_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/user_group_membership_test.go deleted file mode 100644 index ab3553967d..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/user_group_membership_test.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestUserGroupMembershipsRUD(t *testing.T) { - client := helpers.GetClient("fixtures/user_group_membership") - defer client.Stop() - // Create user - uid, err := helpers.CreateUser(client) - require.NoError(t, err, "Setup User") - defer func() { - err = client.DeleteUser(uid, nil) - assert.NoError(t, err, "Teardown User") - }() - // Create group - gid, err := helpers.CreateGroup(client) - require.NoError(t, err, "Setup Group") - defer func() { - err = client.DeleteGroup(gid, nil) - assert.NoError(t, err, "Teardown Group") - }() - - // Create - ugid, err := helpers.AddUserToGroup(client, uid, gid) - assert.NoError(t, err, "Create") - - // Get - ugm, err := client.GetUserGroupMembership(ugid) - assert.NoError(t, err, "Get") - assert.Equal(t, uid, ugm.UserID, "Get: UserID") - assert.Equal(t, gid, ugm.GroupID, "Get: GroupID") - - // List with GID - var opts bm.ListMembershipsOptions - opts.Limit = 10 - opts.GroupID = gid - list, err := client.ListUserGroupMemberships(&opts) - assert.NoError(t, err, "List with GID") - assert.Len(t, list.Memberships, 1, "List with GID") - - // List sans GID - opts.GroupID = "" - opts.UserID = uid - list, err = client.ListUserGroupMemberships(&opts) - assert.NoError(t, err, "List sans GID") - assert.Len(t, list.Memberships, 1, "List sans GID") - - // Delete - err = client.DeleteUserGroupMembership(ugid, nil) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/user_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/user_test.go deleted file mode 100644 index 87ba54bfd5..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/user_test.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestUserCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/user") - defer client.Stop() - - // Create - var uids []string - for i := 0; i < 5; i++ { - id, err := helpers.CreateUser(client) - assert.NoError(t, err, "Create %v", i) - uids = append(uids, id) - } - - // TODO: Get - - // List with pagination - var options bm.ListOptions - options.Limit = 1 - lenUsers := 0 - for i := 0; i < 5; i++ { - list, err := client.ListUsers(&options) - assert.NoError(t, err, "List") - assert.NotNil(t, list, "List") - lenUsers += len(list.Users) - if list.NextPage == "" { - break - } - options.Page = list.NextPage - } - assert.Equal(t, 5, lenUsers, "List: len") - - // Update - id := uids[0] - opt := bm.UpdateIdentityOptions{ - Description: "new description", - } - u, err := client.UpdateUser(id, &opt) - assert.NoError(t, err, "Update") - assert.Equal(t, "new description", u.Description, "Update: Description") - - // Update State - state := bm.UpdateUserStateOptions{ - Blocked: helpers.BoolPtr(false), - } - u, err = client.UpdateUserState(id, &state) - assert.NoError(t, err, "UpdateState") - - // Delete - for i, id := range uids { - err := client.DeleteUser(id, nil) - assert.NoError(t, err, "Delete %v", i) - } -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/vcn_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/vcn_test.go deleted file mode 100644 index adb8c5f746..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/vcn_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestVCNCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/vcn") - defer client.Stop() - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - - // Create - id, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, id, "Create: ID") - - // Get - vcn, err := client.GetVirtualNetwork(id) - assert.NoError(t, err, "Get") - assert.Equal(t, id, vcn.ID, "Get: ID") - - // TODO: Update - - // List - vcns, err := client.ListVirtualNetworks(compartmentID, nil) - assert.NoError(t, err, "List") - found := false - for _, vcn := range vcns.VirtualNetworks { - if strings.Compare(vcn.ID, id) == 0 { - found = true - } - } - assert.True(t, found, "List: Created VCN not found") - - // Delete - _, err = helpers.DeleteVCN(client, id) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/vnic_attachment_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/vnic_attachment_test.go deleted file mode 100644 index cfce1b0f8a..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/vnic_attachment_test.go +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "time" - - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" - - bm "github.com/oracle/bmcs-go-sdk" -) - -func TestVnicAttachmentCRUD(t *testing.T) { - // Set up dependencies - actual VNIC tests are in helper methods. - // Note that this tests both VNICs and VNIC Attachments. - - client := helpers.GetClient("fixtures/vnic_attachment") - defer client.Stop() - - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - ads, err := client.ListAvailabilityDomains(compartmentID) - availabilityDomains := ads.AvailabilityDomains - require.NoError(t, err, "Setup AvailabilityDomains") - // Create VCN - vcnOptions := &bm.CreateVcnOptions{} - vcnOptions.DnsLabel = "gosdktestvcn" - vcnID, err := helpers.CreateVCNWithOptions(client, "172.16.0.0/16", compartmentID, vcnOptions) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err, "Teardown VCN") - }() - // Create Subnet - subnetOptions := &bm.CreateSubnetOptions{} - subnetOptions.DNSLabel = "gosdktestsubnet" - subnetID, err := helpers.CreateSubnetWithOptions(client, compartmentID, availabilityDomains[0].Name, vcnID, "172.16.0.0/16", subnetOptions) - require.NoError(t, err, "Setup Subnet") - defer func() { - _, err := helpers.DeleteSubnet(client, subnetID) - assert.NoError(t, err, "Teardown Subnet") - }() - // Create Instance - instanceID, err := helpers.CreateInstance(client, compartmentID, availabilityDomains[0].Name, helpers.FastestImageID, helpers.SmallestShapeName, subnetID) - require.NoError(t, err, "Setup Instance") - defer func() { - _, err := helpers.DeleteInstance(client, instanceID) - assert.NoError(t, err, "Teardown Instance") - }() - - VnicAttachmentCRUDTest(t, client, compartmentID, subnetID, instanceID) - MinParamVnicAttachmentTest(t, client, compartmentID, subnetID, instanceID) -} - -func VnicAttachmentCRUDTest(t *testing.T, client *helpers.TestClient, compartmentID string, subnetID string, instanceID string) { - vnicName := "gosdk_test_vnic" - vnicAttachmentName := "gosdk_test_vnic_attachment" - vnicHostnameLabel := "vnica" - assignPublicIp := false - skipSourceDestCheck := true - - vaOpts := &bm.AttachVnicOptions{} - vaOpts.DisplayName = vnicAttachmentName - - vnicOpts := &bm.CreateVnicOptions{} - vnicOpts.DisplayName = vnicName - vnicOpts.SubnetID = subnetID - - vnicOpts.AssignPublicIp = &assignPublicIp - vnicOpts.PrivateIp = "172.16.0.8" - vnicOpts.HostnameLabel = vnicHostnameLabel - vnicOpts.SkipSourceDestCheck = &skipSourceDestCheck - - vnicAttachment, err := client.AttachVnic(instanceID, vnicOpts, vaOpts) - require.NoError(t, err, "Attach VNIC") - - defer func() { - DetachVnic(t, client, vnicAttachment) - }() - - // Get VNIC Attachment (and wait until it's attached) - for { - vnicAttachment, _ = client.GetVnicAttachment(vnicAttachment.ID) - if vnicAttachment.State != bm.ResourceAttaching { - require.Equal(t, bm.ResourceAttached, vnicAttachment.State, "Attach VNIC: Wait for ATTACHED state") - break - } - helpers.Sleep(1 * time.Second) - } - - assert.NotEmpty(t, vnicAttachment.AvailabilityDomain, "Get: AvailabilityDomain") - assert.Equal(t, compartmentID, vnicAttachment.CompartmentID, "Get: CompartmentID") - assert.Equal(t, vnicAttachmentName, vnicAttachment.DisplayName, "Get: DisplayName") - assert.NotEmpty(t, vnicAttachment.ID, "Get: ID") - assert.NotEmpty(t, vnicAttachment.InstanceID, "Get: InstanceID") - assert.Equal(t, bm.ResourceAttached, vnicAttachment.State, "Get: State") - assert.Equal(t, subnetID, vnicAttachment.SubnetID, "Get: SubnetID") - assert.NotEmpty(t, vnicAttachment.TimeCreated, "Get: TimeCreated") - assert.NotEmpty(t, vnicAttachment.VlanTag, "Get: VlanTag") - assert.NotEmpty(t, vnicAttachment.VnicID, "Get: VnicID") - - // Get VNIC - vnic, err := client.GetVnic(vnicAttachment.VnicID) - require.NoError(t, err, "Get VNIC") - - assert.NotEmpty(t, vnic.AvailabilityDomain, "Get: AvailabilityDomain") - assert.Equal(t, compartmentID, vnic.CompartmentID, "Get: CompartmentID") - assert.Equal(t, vnicName, vnic.DisplayName, "Get: DisplayName") - assert.Equal(t, vnicHostnameLabel, vnic.HostnameLabel, "Get: HostnameLabel") - assert.NotEmpty(t, vnic.ID, "Get: ID") - assert.Equal(t, false, vnic.IsPrimary, "Get: IsPrimary") - assert.NotEmpty(t, vnic.MacAddress, "Get: MacAddress") - assert.Equal(t, bm.ResourceAvailable, vnic.State, "Get: State") - assert.NotEmpty(t, vnic.PrivateIPAddress, "Get: PrivateIPAddress") - assert.Equal(t, 0, len(vnic.PublicIPAddress), "Get: PublicIPAddress") - assert.Equal(t, skipSourceDestCheck, vnic.SkipSourceDestCheck, "Get: SkipSourceDestCheck") - assert.Equal(t, subnetID, vnic.SubnetID, "Get: SubnetID") - assert.NotEmpty(t, vnic.TimeCreated, "Get: TimeCreated") - - // Update VNIC - vnicName = "UPDATED_gosdk_test_vnic" - vnicHostnameLabel = "vnicb" - vnicUpdateOptions := &bm.UpdateVnicOptions{} - vnicUpdateOptions.DisplayName = vnicName - vnicUpdateOptions.HostnameLabel = vnicHostnameLabel - - vnic, err = client.UpdateVnic(vnicAttachment.VnicID, vnicUpdateOptions) - require.NoError(t, err, "Update VNIC") - assert.Equal(t, vnicName, vnic.DisplayName, "Get: DisplayName") - assert.Equal(t, vnicHostnameLabel, vnic.HostnameLabel, "Get: HostnameLabel") - // Make sure that SkipSourceDestCheck does not change, since it was not set. - assert.Equal(t, skipSourceDestCheck, vnic.SkipSourceDestCheck, "Get: SkipSourceDestCheck") - - // Update SkipSourceDestCheck - vnicName = "UPDATED_gosdk_test_vnic" - vnicHostnameLabel = "vnicb" - vnicUpdateOptions2 := &bm.UpdateVnicOptions{} - skipSourceDestCheck = false - vnicUpdateOptions2.SkipSourceDestCheck = &skipSourceDestCheck - - vnic, err = client.UpdateVnic(vnicAttachment.VnicID, vnicUpdateOptions2) - require.NoError(t, err, "Update VNIC") - assert.Equal(t, skipSourceDestCheck, vnic.SkipSourceDestCheck, "Get: SkipSourceDestCheck") - - // List VNIC Attachments - listVnicAttachmentsOpts := &bm.ListVnicAttachmentsOptions{} - listVnicAttachmentsOpts.InstanceID = instanceID - - vaList, err := client.ListVnicAttachments(compartmentID, listVnicAttachmentsOpts) - assert.Equal(t, 2, len(vaList.Attachments), "List VNIC Attachments") -} - -func MinParamVnicAttachmentTest(t *testing.T, client *helpers.TestClient, compartmentID string, subnetID string, instanceID string) { - vaOpts := &bm.AttachVnicOptions{} - - vnicOpts := &bm.CreateVnicOptions{} - vnicOpts.SubnetID = subnetID - - vnicAttachment, err := client.AttachVnic(instanceID, vnicOpts, vaOpts) - require.NoError(t, err, "Attach VNIC") - - defer func() { - DetachVnic(t, client, vnicAttachment) - }() - - // Get VNIC Attachment (and wait until it's attached) - for { - vnicAttachment, _ = client.GetVnicAttachment(vnicAttachment.ID) - if vnicAttachment.State != bm.ResourceAttaching { - require.Equal(t, bm.ResourceAttached, vnicAttachment.State, "Attach Vnic: Wait for ATTACHED state") - break - } - helpers.Sleep(1 * time.Second) - } - - assert.NotEmpty(t, vnicAttachment.AvailabilityDomain, "Get: AvailabilityDomain") - assert.Equal(t, compartmentID, vnicAttachment.CompartmentID, "Get: CompartmentID") - assert.Empty(t, vnicAttachment.DisplayName, "Get: DisplayName") - assert.NotEmpty(t, vnicAttachment.ID, "Get: ID") - assert.NotEmpty(t, vnicAttachment.InstanceID, "Get: InstanceID") - assert.Equal(t, bm.ResourceAttached, vnicAttachment.State, "Get: State") - assert.Equal(t, subnetID, vnicAttachment.SubnetID, "Get: SubnetID") - assert.NotEmpty(t, vnicAttachment.TimeCreated, "Get: TimeCreated") - assert.NotEmpty(t, vnicAttachment.VlanTag, "Get: VlanTag") - assert.NotEmpty(t, vnicAttachment.VnicID, "Get: VnicID") - - // Get VNIC - vnic, err := client.GetVnic(vnicAttachment.VnicID) - require.NoError(t, err, "Get VNIC") - - assert.NotEmpty(t, vnic.AvailabilityDomain, "Get: AvailabilityDomain") - assert.Equal(t, compartmentID, vnic.CompartmentID, "Get: CompartmentID") - assert.NotEmpty(t, vnic.DisplayName, "Get: DisplayName") - assert.Empty(t, vnic.HostnameLabel, "Get: HostnameLabel") - assert.NotEmpty(t, vnic.ID, "Get: ID") - assert.Equal(t, false, vnic.IsPrimary, "Get: IsPrimary") - assert.NotEmpty(t, vnic.MacAddress, "Get: MacAddress") - assert.Equal(t, bm.ResourceAvailable, vnic.State, "Get: State") - assert.NotEmpty(t, vnic.PrivateIPAddress, "Get: PrivateIPAddress") - assert.NotEmpty(t, vnic.PublicIPAddress, "Get: PublicIPAddress") - assert.Equal(t, false, vnic.SkipSourceDestCheck, "Get: SkipSourceDestCheck") - assert.Equal(t, subnetID, vnic.SubnetID, "Get: SubnetID") - assert.NotEmpty(t, vnic.TimeCreated, "Get: TimeCreated") -} - -func DetachVnic(t *testing.T, client *helpers.TestClient, vnicAttachment *bm.VnicAttachment) { - err := client.DetachVnic(vnicAttachment.ID, nil) - assert.NoError(t, err, "Detach VNIC") - - // Wait until VNIC Attachment is detached - for { - vnicAttachment, _ = client.GetVnicAttachment(vnicAttachment.ID) - if vnicAttachment.State != bm.ResourceDetaching { - require.Equal(t, bm.ResourceDetached, vnicAttachment.State, "Detach Vnic: Wait for DETACHED state") - break - } - helpers.Sleep(1 * time.Second) - } -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/volume_attachment_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/volume_attachment_test.go deleted file mode 100644 index 620193725d..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/volume_attachment_test.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestVolumeAttachmentCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/volume_attachment") - defer client.Stop() - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - ads, err := client.ListAvailabilityDomains(compartmentID) - availabilityDomains := ads.AvailabilityDomains - require.NoError(t, err, "Setup AvailabilityDomains") - // Create VCN - vcnID, err := helpers.CreateVCN(client, "172.16.0.0/16", compartmentID) - require.NoError(t, err, "Setup VCN") - require.NotEmpty(t, vcnID, "Setup VCN: ID") - defer func() { - _, err = helpers.DeleteVCN(client, vcnID) - assert.NoError(t, err, "Teardown VCN") - }() - // Create Subnet - subnetID, err := helpers.CreateSubnet(client, compartmentID, availabilityDomains[0].Name, vcnID) - require.NoError(t, err, "Setup Subnet") - defer func() { - _, err := helpers.DeleteSubnet(client, subnetID) - assert.NoError(t, err, "Teardown Subnet") - }() - // Create Instance - instanceID, err := helpers.CreateInstance(client, compartmentID, availabilityDomains[0].Name, helpers.FastestImageID, helpers.SmallestShapeName, subnetID) - require.NoError(t, err, "Setup Instance") - defer func() { - _, err := helpers.DeleteInstance(client, instanceID) - assert.NoError(t, err, "Teardown Instance") - }() - // Create Volume - v, err := client.CreateVolume( - availabilityDomains[0].Name, - compartmentID, - nil, - ) - require.NoError(t, err, "Setup Volume") - // Attachment must wait until volume is available - for { - v, _ := client.GetVolume(v.ID) - if v.State != bm.ResourceProvisioning { - require.Equal(t, bm.ResourceAvailable, v.State, "Setup Volume: State") - break - } - helpers.Sleep(2 * time.Second) - } - defer func() { - err = client.DeleteVolume(v.ID, nil) - assert.NoError(t, err, "Teardown Volume") - }() - - // Attach - opts := bm.CreateOptions{} - opts.DisplayName = "Test Volume Attachment" - va, err := client.AttachVolume("iscsi", instanceID, v.ID, &opts) - assert.NoError(t, err, "Attach") - - // Get - for { - va, _ = client.GetVolumeAttachment(va.ID) - if va.State != bm.ResourceAttaching { - assert.Equal(t, bm.ResourceAttached, va.State, "Get: State") - break - } - helpers.Sleep(2 * time.Second) - } - assert.Equal(t, compartmentID, va.CompartmentID, "Get: CompartmentID") - assert.Equal(t, availabilityDomains[0].Name, va.AvailabilityDomain, "Get: AvailabilityDomain") - assert.Equal(t, instanceID, va.InstanceID, "Get: InstanceID") - assert.Equal(t, v.ID, va.VolumeID, "Get: VolumeID") - assert.Equal(t, "iscsi", va.AttachmentType, "Get: AttachmentType") - assert.Equal(t, bm.ResourceAttached, va.State, "Get: State") - assert.NotEmpty(t, va.ID, "Get: ID") - assert.NotEmpty(t, va.TimeCreated, "Get: TimeCreated") - assert.NotEmpty(t, va.IPv4, "Get: IPv4") - assert.NotEmpty(t, va.IQN, "Get: IQN") - // TODO: create CHAP enabled test - assert.Empty(t, va.CHAPSecret, "Get: CHAPSecret") - assert.Empty(t, va.CHAPUsername, "Get: CHAPUsername") - // FIXME: broken API behaviour - // assert.Equal(t, "Test Volume Attachment", va.DisplayName, "Get: DisplayName") - - // TODO: List - - // Detatch - err = client.DetachVolume(va.ID, nil) - assert.NoError(t, err, "Detach") - // DeleteVolume must wait until volume is detachched - for { - va, _ = client.GetVolumeAttachment(va.ID) - if va.State != bm.ResourceDetaching { - assert.Equal(t, bm.ResourceDetached, va.State, "Detatch") - break - } - helpers.Sleep(2 * time.Second) // TODO: remove once state may be trusted - } -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/volume_test.go b/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/volume_test.go deleted file mode 100644 index 1a386733a9..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/acceptance-test/volume_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package acceptance - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - bm "github.com/oracle/bmcs-go-sdk" - "github.com/oracle/bmcs-go-sdk/acceptance-test/helpers" -) - -func TestVolumeCRUD(t *testing.T) { - client := helpers.GetClient("fixtures/volume") - defer client.Stop() - compartmentID, err := helpers.FindOrCreateCompartmentID(client) - require.NoError(t, err, "Setup Compartment") - ads, err := client.ListAvailabilityDomains(compartmentID) - require.NoError(t, err, "Setup AvailabilityDomains") - availabilityDomains := ads.AvailabilityDomains - - // Create - v, err := client.CreateVolume( - availabilityDomains[0].Name, - compartmentID, - nil, - ) - assert.NoError(t, err, "Create") - assert.NotEmpty(t, v.ID, "Create: ID") - - // Get - for { - vs, _ := client.GetVolume(v.ID) - if vs.State != bm.ResourceProvisioning { - break - } - helpers.Sleep(2 * time.Second) // wait until provisioning is complete - } - - // TODO: Update - // TODO: List - - // Delete - err = client.DeleteVolume(v.ID, nil) - assert.NoError(t, err, "Delete") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/client.go b/vendor/github.com/oracle/bmcs-go-sdk/client.go deleted file mode 100644 index 09923c9cb5..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/client.go +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -/* - Package baremetal provides access to the Oracle Bare Metal Cloud API's. See Readme for usage example. -*/ - -package baremetal - -import ( - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "errors" - "fmt" - "io/ioutil" - "math/rand" - "net/http" - "time" - "sync/atomic" -) - -var clientCounter int64 - -// Client is used to access Oracle BareMetal Services -type Client struct { - userAgent string - authInfo *authenticationInfo - identityApi requestor - coreApi requestor - databaseApi requestor - objectStorageApi requestor - loadBalancerApi requestor - identityEndPoint string -} - -type NewClientOptions struct { - Region string - Transport http.RoundTripper - UrlTemplate string - UserAgent string - keyPassword *string - keyPath *string - keyBytes []byte - ShortRetryTime time.Duration - LongRetryTime time.Duration - RandGen *rand.Rand - DisableAutoRetries bool - DisableNotFoundRetries bool -} - -type NewClientOptionsFunc func(o *NewClientOptions) - -// PrivateKeyPassword password to decrypt an encrypted private key -func PrivateKeyPassword(pwd string) func(o *NewClientOptions) { - return func(o *NewClientOptions) { - o.keyPassword = &pwd - } -} - -// PrivateKeyFilePath provide the path a file containing a private key. -func PrivateKeyFilePath(path string) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.keyPath = &path - } -} - -// PrivateKeyBytes supply bytes for private key -func PrivateKeyBytes(buff []byte) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.keyBytes = buff - } -} - -// CustomTransport can be used to assign a custom http.RoundTripper -// to the Bare Metal API connection. For example, you could wrap the default -// http transport in your own transport and log interactions for diagnostic -// purposes. -func CustomTransport(tr http.RoundTripper) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.Transport = tr - } -} - -// UserAgent assigns a custom user agent for API connection -func UserAgent(userAgent string) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.UserAgent = userAgent - } -} - -// Region assigns a region override for API connections -func Region(region string) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.Region = region - } -} - -// UrlTemplate lets you override the production url scheme of https://%s.%s.oraclecloud.com -func UrlTemplate(urlTemplate string) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.UrlTemplate = urlTemplate - } -} - -func ShortRetryTime(retryTime time.Duration) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.ShortRetryTime = retryTime - } -} - -func LongRetryTime(retryTime time.Duration) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.LongRetryTime = retryTime - } -} - -func DisableAutoRetries(disableAutoRetries bool) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.DisableAutoRetries = disableAutoRetries - } -} - -func DisableNotFoundRetries(disableNotFoundRetries bool) NewClientOptionsFunc { - return func(o *NewClientOptions) { - o.DisableNotFoundRetries = disableNotFoundRetries - } -} - -// NewClient creates and authenticates a BareMetal API client -func NewClient(userOCID, tenancyOCID, keyFingerprint string, opts ...NewClientOptionsFunc) (*Client, error) { - var err error - auth := &authenticationInfo{ - tenancyOCID: tenancyOCID, - userOCID: userOCID, - keyFingerPrint: keyFingerprint, - } - - /* Create random number generator for creating Retry Tokens - * Terraform operations create multiple clients. - * We need the clientCounter because some customers were seeing issues with using the same retry token for multiple requests (time granularity issue in env) - */ - newClientCounterValue := atomic.AddInt64(&clientCounter, 1) - seed := newClientCounterValue + time.Now().UnixNano() - randGen := rand.New(rand.NewSource(seed)) - - nco := &NewClientOptions{ - Transport: &http.Transport{}, - Region: us_phoenix_1, - UrlTemplate: baseUrlTemplate, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: randGen, - } - for _, opt := range opts { - opt(nco) - } - - if nco.keyPath != nil { - auth.privateRSAKey, err = PrivateKeyFromFile(*nco.keyPath, nco.keyPassword) - } else { - auth.privateRSAKey, err = PrivateKeyFromBytes(nco.keyBytes, nco.keyPassword) - } - if err != nil { - return nil, err - } - return &Client{ - userAgent: nco.UserAgent, - authInfo: auth, - identityApi: newIdentityAPIRequestor(auth, nco), - coreApi: newCoreAPIRequestor(auth, nco), - objectStorageApi: newObjectStorageAPIRequestor(auth, nco), - databaseApi: newDatabaseAPIRequestor(auth, nco), - loadBalancerApi: newLoadBalancerAPIRequestor(auth, nco), - }, nil -} - -// PrivateKeyFromBytes is a helper function that will produce a RSA private -// key from bytes. -func PrivateKeyFromBytes(pemData []byte, password *string) (key *rsa.PrivateKey, e error) { - if pemBlock, _ := pem.Decode(pemData); pemBlock != nil { - - decrypted := pemBlock.Bytes - - if x509.IsEncryptedPEMBlock(pemBlock) { - if password == nil { - e = fmt.Errorf("private_key_password is required for encrypted private keys") - return - } - if decrypted, e = x509.DecryptPEMBlock(pemBlock, []byte(*password)); e != nil { - return - } - } - - key, e = x509.ParsePKCS1PrivateKey(decrypted) - - } else { - e = errors.New("PEM data was not found in buffer") - return - } - - return -} - -func PrivateKeyFromFile(pemFilePath string, password *string) (key *rsa.PrivateKey, e error) { - var fileData []byte - if fileData, e = ioutil.ReadFile(pemFilePath); e != nil { - return - } - - key, e = PrivateKeyFromBytes(fileData, password) - - return - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/client_test.go b/vendor/github.com/oracle/bmcs-go-sdk/client_test.go deleted file mode 100644 index 92c54f3953..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/client_test.go +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "os" - "path" - "testing" - - "github.com/stretchr/testify/assert" -) - -var testPrivateKey = []byte( - `-----BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,9F4D00DEF02B2B75 - -IbSQEhNjPeRt49jUhZbhAEaAIG4L9IokDksw/P/QdCPXzZT008xzYK/zmxkz7so1 -ZwvIYHn07E0Ul6fIHR6kjw/+MD7AWluCN1FLHs3PHc4XF4THUCKFCC90FvGJ2PEs -kEh7oJ4azZA/PH51g4rSgWpYtH5B/S6ioE2eZ9jJ/prH+34pCuOpX4AvXEFl5zue -pjFm5FhsReAhZ/9eCvjgjIWDHKc7PRfinwSydVHQSzgDnuq+GTMzQh6eztS+EuAp -MLg7w0mazTqmPOuMT+mw9SHGaIePGzA9TcwB1y3QgkYsg3Ch20uN/sUymgQ4PEKI -njXLldWDYvFvv1Tv3/8IOjCEodQ4P/5oWz7msrLh3QF+EhF7lQPYO7132e9Hvz3C -hTmcygmVGrPCtOY1jzuqy+/Kmt4Gv8FQpSnO7i8wFvt5v0N26av18RO10CzYY1ut -EV6WvynimFUtg1Lo03cadh7bspNohSXfFLpbNTji5NwHrIa+UQqTw3h4/zSPZHJl -NwHwM2I8N5lcCsqmSbM01+uTRG3QZ5i1BS8fsArHaAcvPyLvOy4mZGKkpuNlLDXo -qrCCsb+0m9jHR2bzx5AGp4impdHm2Qi3vTV3dMe277wqKkU5qfd5yDbL2eTqAYzQ -hXpPmTjquOTNYdbvoNsOg4TCHZv7WCsGY0nNMPrRO7zXCDApA6cKDJzagbqhW5Zu -/yz7sDT2D3wzE2WXUbtIBLevXyF0OS3AL7AgfbcyAviByOfmEb7WCP9jmdCFaLwY -SgNh9AjeOgkEEr/cRg1kBAXt0kuE7By0w+/ODJHZYelG0wg5nxhseA9Kc596XIJl -NyjbL87CXGfXmMoSYYTA4rzbtCDMmee7xHtbWiYKF1VGxNaGkQ5nnZSJLhCaI6rH -AD0XYwxv92j4fIjHqonbY/dlIKPot1t3VRcdnebbZMjAcNZ63n+I/iVla3DJpWLO -1gT50A4H2uEAve+WWFWmDQe2rfg5wwUtVVkot+Tn3McB6RzNqgcs0c+7uNDnDcOB -WtQ1OfniE1TdoFCPfYcDw8ngimw7uMYwp4mZIYtwlk7Z5GFl4YpNQeLOgh368ao4 -8HL7EnTZmiU5cMbuaA8cZmUbgBqiQY0DtLF22VquThi0QOeUMJxJ6N1QUPckD3AU -dikEn0gilOsDQ51fnOsgk9J2uCz8rd5bnyUXlIguj5pyz6S7agyYFhRrXessVzHd -3889QM9V82+px5mv4qCvMn6ReYOvC+KSY1hn4ljXsndOM+6hQzD5CZKeL948pXRn -G7nqbG9D44wLklOz6mkIvqLn3qxEFWapl9UK7yfzjoezGoqeNFweadZ10Kp2+Umu -Sa759/2YDCZLDzaVVoLDTHLzi9ejpAkUIXgEFaPNGzQ8DYiL8N2klRozLSlnDEMr -xTHuOMkklNO7SiTluAUBvXrjxfGqe/gwJOHxXQGHC8W6vyhR2BdVx9PKFVebWjlr -gzRMpGgWnjsaz0ldu3uO7ozRxZg8FgdToIzAIaTytpHKI8HvONvPJlYywOMC1gRi -KwX6p26xaVtCV8PbDpF3RHuEJV1NU6PDIhaIHhdL374BiX/KmcJ6yv7tbkczpK+V ------END RSA PRIVATE KEY-----`, -) - -var testKeyFingerPrint = "b4:8a:7d:54:e6:81:04:b2:99:8e:b3:ed:10:e2:12:2b" -var testTenancyOCID = "ocid1.tenancy.oc1..aaaaaaaaq3hulfjvrouw3e6qx2ncxtp256aq7etiabqqtzunnhxjslzkfyxq" -var testUserOCID = "ocid1.user.oc1..aaaaaaaaflxvsdpjs5ztahmsf7vjxy5kdqnuzyqpvwnncbkfhavexwd4w5ra" -var password = "password" - -func createClientForTest() (c *Client) { - c, _ = NewClient( - testUserOCID, - testTenancyOCID, - testKeyFingerPrint, - PrivateKeyBytes([]byte(testPrivateKey)), - PrivateKeyPassword("password"), - ) - return -} - -func TestClientCreation(t *testing.T) { - c, err := NewClient( - testUserOCID, - testTenancyOCID, - testKeyFingerPrint, - PrivateKeyBytes([]byte(testPrivateKey)), - PrivateKeyPassword("password"), - ) - assert.Nil(t, err) - assert.NotNil(t, c) - assert.Equal(t, c.authInfo.keyFingerPrint, testKeyFingerPrint) - assert.Equal(t, c.authInfo.tenancyOCID, testTenancyOCID) - assert.Equal(t, c.authInfo.userOCID, testUserOCID) -} - -func getTestDataPEMPath() (testDataPath string) { - testDataPath = os.Getenv("BAREMETAL_SDK_PEM_DATA_PATH") - - if testDataPath == "" { - home := os.Getenv("HOME") - defaultPath := path.Join(home, ".oraclebmc", "bmcs_api_key.pem") - if _, err := os.Stat(defaultPath); !os.IsNotExist(err) { - return defaultPath - } - testDataPath = path.Join( - "testdata", - "private.pem", - ) - } - return -} - -func TestPrivateKeyCreationFromPemFile(t *testing.T) { - - key, e := PrivateKeyFromFile(getTestDataPEMPath(), &password) - assert.Nil(t, e) - assert.NotNil(t, key) - -} - -var testNoPasswordPK = []byte( - `-----BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEApX5BXxc/tmHFCpnad2NK3/pVccxf6CK12NCPT2YZjEgQR+9t -GF53RFHZlXOXb+aahbPE2O8gupbVur0Y2C6rqzRZpFUcvM+QdbGLL4WPQ+gtYrEC -IJRarQ5UWhgnelPI2kzw3RvZS977Fdr7QX19xIbeQqRtOH4eOkCJZgJuufM0Q6Yi -RWSHjzNYsvVbETfLsHOLNRN9xOYcUWPMi9qkGpytlV1eyiCAMYlxfjsvMat4gMeh -GPz6Sj1OJ8ZuT/6Hdy5HPKoyPQHwZpWq0fiOniyhnyp/1BjKKTHPdFL5Bt3dzk7h -nQPdfe6gSjbMyzbCaOrCvKY94V6VO+UzVf3SWQIDAQABAoIBACapw34CwXjLiKw8 -W4TO5rxDENlARRvHmDJqL0D+enOCloMn1ZX+4+BLOwkmczfKaUlZQWDpJP1SpeY1 -rWs8JBEgbtzsoYUe/QHyE7Frg5f60zeeYP/ZiQGrOlu+DuMOVftiRFdz3SVTl9d4 -TID1X3+dfqmVHos3M7qqPy9c3B+G6P7vr+HEh8hQpkWtEqZQxuqp1mdWhG732x+A -//KGUBzdS+GELEgHBxf71jS2VhljPUJo9zAWSoNYeXbQUmHN7dS4Ze6rL2Icj4WL -KQcyWpqXqsT9SwjWWHfcpm4CqXaN68jcm9qouyaurkdVo+hF/g8K1GQvM44D+HOP -49LwfI0CgYEAznrE8MtarPPKacCdczOxr+1hrXj+mgVvemiUrgHACH1Rt7cLzRAB -B3LNH/uo6RzcSVgLRqTf7lb9eMoc52g1njgoAMHa1CgRf3QMiP/+ssBlf87SGx2X -u4GX4NiN+KJ8rRpgM8mxiJw0+uXA0jNJzaKFKip5fa4RIjPdo7aDR0cCgYEAzS8L -UGJn/r3Yi9vD/r+fEUm0ENhF2YHUIRNkkmZ8aMQTjfk0GGL5HStd3Sm+4skpj85+ -fvxj5WIaatI4kDdiMINBSTh/HFEqZhxw+pbQcl0uBVy1bFF+AlQdx/lmaJZqjDtX -UUrgZ5Win46QLNJhY4LRA8eI/9mOt2hDoSpEKV8CgYBQhCdQDrxpPRftbSL4zWu4 -wsSYNNpzjTMPdMClqiEMLnIzRbngWSFNmkLK+gPAA3UTVLXw8lIwStPEymvDASwH -araOtQl0Obu5C7PnqIvVgJkT4b6kvEFy6PIkx81060fa6LIi/7+vGdq/C+DJFx7s -hTeQXcfKbppX0AnZ0U4X+QKBgQC6Qg5fNjV5RhUhQKo2wvQ+2U0gTXN68yQBsn0F -eQtOf0/Q/XuQ96d0Fz3p2k9xx3J3HNgvpiV4wQmCFrtKDzyPFVdahHK+3d9DOmZE -1Er8xiFUtMfsQD3HF1zBf2C7aG/oRKYLIZF79pXdiajPR1so3kOmzqdKuc+YJond -72RYuQKBgQCOSibFsiwqVdcFEAJcyaFeAt9OZPtlZXFd0Zk5G/gzTgGfHeDj3VKw -Bt0h0Tcgv6ERGXmcOijX7Bg9IpKDhb2ge/G/s8RQAVuXdWEcXbpg6voHVg+vKnZY -sAlNkj+qwrHRD/Xz6gREXXjbV9I0CKY4oxb9Ineu3BAxGS0J8uY7Og== ------END RSA PRIVATE KEY-----`, -) - -func TestPrivateKeyCreationNoPwd(t *testing.T) { - key, err := PrivateKeyFromBytes(testNoPasswordPK, nil) - assert.Nil(t, err) - assert.NotNil(t, key) -} - -func getTestDataPrivateKeyPath() (testDataPath string) { - testDataPath = os.Getenv("BAREMETAL_PRIVATE_KEY_PATH") - - if testDataPath == "" { - testDataPath = path.Join( - "testdata", - "mock-ssh-private-key", - ) - } - return -} - -func TestPrivateKeyFromUnencryptedFile(t *testing.T) { - key, err := PrivateKeyFromFile(getTestDataPrivateKeyPath(), nil) - assert.Nil(t, err) - assert.NotNil(t, key) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/cmd/obmc-container-clean/main.go b/vendor/github.com/oracle/bmcs-go-sdk/cmd/obmc-container-clean/main.go deleted file mode 100644 index cab95b4d4f..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/cmd/obmc-container-clean/main.go +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package main - -import ( - "flag" - "fmt" - "os" - "time" - - "github.com/joho/godotenv" - - bm "github.com/oracle/bmcs-go-sdk" -) - -var compartmentID string -var allCompartments bool - -func init() { - flag.StringVar(&compartmentID, "compartment", "", "compartment ID") - flag.BoolVar(&allCompartments, "all", false, "all compartments") -} - -func main() { - client := getUnrecordedClient() - - flag.Parse() - - if compartmentID == "" && !allCompartments { - fmt.Println("no compartment provided. Set with parameter -compartment=ocid1.compartment.oc1...") - os.Exit(1) - } - - var compartmentIDs []string - if allCompartments { - list, err := client.ListCompartments(nil) - if err != nil { - panic(fmt.Sprintf("could not list compartments: %v", err)) - } - compartmentIDs = make([]string, len(list.Compartments)) - for i := range list.Compartments { - compartmentIDs[i] = list.Compartments[i].ID - } - } else { - compartmentIDs = []string{compartmentID} - } - - for _, id := range compartmentIDs { - err := scrubCompartment(client, id) - if err != nil { - fmt.Printf("Failed to clean compartment:%v, reason: %v\n", id, err) - } - fmt.Printf("\n") - } - -} - -func scrubCompartment(client *bm.Client, compartmentID string) error { - fmt.Printf("CLEAN compartment:%v\n", compartmentID) - // TODO: - // - CPEs - // - DRGs - // - Images - // - IPSecConnections - // - InternetGateways - // - RouteGateways - // - VolumeAttachments - // - Volumes - // - Databases - // - LoadBalancers - - // instance - is, err := client.ListInstances(compartmentID, nil) - if err != nil { - return fmt.Errorf("Failed to list Instances, reason: %v", err) - } - terminatedCount := 0 - for _, i := range is.Instances { - if i.State == bm.ResourceTerminated { - terminatedCount += 1 - } - } - fmt.Printf("- instances: %d (incl %d terminated)\n", len(is.Instances), terminatedCount) - for _, i := range is.Instances { - if i.State != bm.ResourceTerminated { - fmt.Printf("DELETE instance:%v\n", i.ID) - err := client.TerminateInstance(i.ID, nil) - if err != nil { - fmt.Printf("Error deleting instance:%v, %v\n", i.ID, err) - } - } - } - - // TODO: is there anything we can do to clean these? - // vnic-attachment - // vas, err := client.ListVnicAttachments(compartmentID, nil) - // if err != nil { - // return fmt.Errorf("Failed to list VNIC Attachments, reason: %v", err) - // } - // fmt.Printf("%d vnic-attachments\n", len(vas.Attachments)) - // for _, va := range vas.Attachments { - // fmt.Printf("vnic-attachment:%v %#v\n", va.ID, va) - // } - - // scrub virtual-network - vcns, err := client.ListVirtualNetworks(compartmentID, nil) - if err != nil { - return fmt.Errorf("Failed to list Virtual Networks, reason: %v", err) - } - fmt.Printf("- virtual-networks: %d\n", len(vcns.VirtualNetworks)) - for _, vcn := range vcns.VirtualNetworks { - fmt.Printf("CLEAN virtual-network:%v\n", vcn.ID) - - // virtual-network/subnet - subnets, err := client.ListSubnets(compartmentID, vcn.ID, nil) - if err != nil { - return err - } - fmt.Printf("-- subnets: %d\n", len(subnets.Subnets)) - for _, sub := range subnets.Subnets { - fmt.Printf("DELETE subnet:%v\n", sub.ID) - err := client.DeleteSubnet(sub.ID, nil) - if err != nil { - fmt.Printf("Failed to delete subnet:%v, %v\n", sub.ID, err) - } - } - - // virtual-network/route-table - rts, err := client.ListRouteTables(compartmentID, vcn.ID, nil) - if err != nil { - return err - } - fmt.Printf("-- route-tables: %d (incl 1 default)\n", len(rts.RouteTables)) - for _, rt := range rts.RouteTables { - if rt.ID != vcn.DefaultRouteTableID { - fmt.Printf("DELETE route-table:%v\n", rt.ID) - err := client.DeleteRouteTable(rt.ID, nil) - if err != nil { - fmt.Printf("Failed to delete route-table:%v, %v\n", rt.ID, err) - } - } - } - // virtual-network/security-lists - ss, err := client.ListSecurityLists(compartmentID, vcn.ID, nil) - if err != nil { - return err - } - fmt.Printf("-- security-lists: %d (incl 1 default)\n", len(ss.SecurityLists)) - for _, s := range ss.SecurityLists { - if s.ID != vcn.DefaultSecurityListID { - fmt.Printf("DELETE security-list:%v\n", s.ID) - err := client.DeleteSecurityList(s.ID, nil) - if err != nil { - fmt.Printf("Failed to delete security-lists:%v, %v\n", s.ID, err) - } - } - } - - // virtual-network - time.Sleep(10 * time.Second) - fmt.Printf("DELETE virtual-networks:%v\n", vcn.ID) - err = client.DeleteVirtualNetwork(vcn.ID, nil) - if err != nil { - fmt.Printf("Failed to delete virtual-network:%v, %v\n", vcn.ID, err) - } - } - return nil -} - -func getUnrecordedClient() *bm.Client { - var apiParams = map[string]string{} - if err := godotenv.Load(); err != nil { - fmt.Printf("No .env file found, let's hope everything is already in environment variables!\n") - } - - keys := []string{ - "OBMCS_PRIVATE_KEY_PATH", - "OBMCS_TENANCY_OCID", - "OBMCS_USER_OCID", - "OBMCS_FINGERPRINT", - "OBMCS_KEY_PASSWORD", - } - - for _, key := range keys { - val := os.Getenv(key) - fmt.Println(key, "=>", val) - apiParams[key] = val - } - - c, err := bm.NewClient( - apiParams["OBMCS_USER_OCID"], - apiParams["OBMCS_TENANCY_OCID"], - apiParams["OBMCS_FINGERPRINT"], - bm.PrivateKeyFilePath(apiParams["OBMCS_PRIVATE_KEY_PATH"]), - bm.PrivateKeyPassword(apiParams["OBMCS_KEY_PASSWORD"]), - ) - - if err != nil { - panic(fmt.Sprintf("could not create new client: %v", err)) - } - return c -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/constants.go b/vendor/github.com/oracle/bmcs-go-sdk/constants.go deleted file mode 100644 index 2735934544..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/constants.go +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "time" - -type resourceName string - -type InstanceActions string -type instanceStates string -type NetworkEntityType string -type DBNodeAction string -type DatabaseEdition string -type DiskRedundancy string -type LicenseModel string -type ListObjectOptionField string -type BucketAccessType string -type PARAccessType 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" - ResourceWaitingForWorkRequest = "WAITING_FOR_WORK_REQUEST" - ResourceSucceededWorkRequest = "SUCCEEDED_WORK_REQUEST" - - WorkRequestAccepted = "ACCEPTED" - WorkRequestInProgress = "IN_PROGRESS" - WorkRequestFailed = "FAILED" - WorkRequestSucceeded = "SUCCEEDED" - - // Error codes - UserAlreadyExists = "UserAlreadyExists" - InvalidParameter = "InvalidParameter" - NotAuthorizedOrNotFound = "NotAuthorizedOrNotFound" - - SDKVersion = "20160918" - SDKVersion2 = "20170115" - - us_ashburn_1 string = "us-ashburn-1" - us_phoenix_1 string = "us-phoenix-1" - - // - baseUrlTemplate = "https://%s.%s.oraclecloud.com" - urlPrefix = "https://" - - identityServiceAPI = "identity" - identityServiceAPIVersion = SDKVersion - - coreServiceAPI = "iaas" - coreServiceAPIVersion = SDKVersion - - databaseServiceAPI = "database" - databaseServiceAPIVersion = SDKVersion - - objectStorageServiceAPI = "objectstorage" - objectStorageServiceAPIVersion = SDKVersion - - loadBalancerServiceAPI = "iaas" - loadBalancerServiceAPIVersion = SDKVersion2 - - // Header Keys - headerBytesRemaining = "opc-bytes-remaining" - headerContentEncoding = "Content-Encoding" - headerContentLanguage = "Content-Language" - headerContentLength = "Content-Length" - headerContentMD5 = "Content-MD5" - headerContentType = "Content-Type" - headerETag = "ETag" - headerLastModified = "last-modified" - headerOPCClientRequestID = "opc-client-request-id" - headerOPCWorkRequestID = "opc-work-request-id" - headerOPCNextPage = "opc-next-page" - headerOPCRequestID = "opc-request-id" - - // Actions that can be applied to compute instances - actionStart InstanceActions = "START" - actionStop InstanceActions = "STOP" - actionReset InstanceActions = "RESET" - - // Network entity types for routing rules - networkEntityVnic NetworkEntityType = "VNIC" - networkEntityInternetGateway NetworkEntityType = "INTERNET_GATEWAY" - networkEntityDynamicallyRoutingGateway NetworkEntityType = "DYNAMICALLY_ROUTING_GATEWAY" - - // Database Node actions - DBNodeActionStart DBNodeAction = "START" - DBNodeActionStop DBNodeAction = "STOP" - DBNodeActionReset DBNodeAction = "RESET" - DBNodeActionSoftReset DBNodeAction = "SOFTRESET" - - // Database editions - DatabaseEditionEnterprise DatabaseEdition = "ENTERPRISE_EDITION" - DatabaseEditionExtreme DatabaseEdition = "ENTERPRISE_EDITION_EXTREME_PERFORMANCE" - DatabaseEditionHigh DatabaseEdition = "ENTERPRISE_EDITION_HIGH_PERFORMANCE" - DatabaseEditionStandard DatabaseEdition = "STANDARD_EDITION" - - // Database disk redundancy levels - DiskRedundancyHigh DiskRedundancy = "HIGH" - DiskRedundancyNormal DiskRedundancy = "NORMAL" - - // License models - LicenseIncluded LicenseModel = "LICENSE_INCLUDED" - BringYourOwnLicense LicenseModel = "BRING_YOUR_OWN_LICENSE" - - // DB Resources - resourceDBHomes resourceName = "dbHomes" - resourceDBNodes resourceName = "dbNodes" - resourceDBSystems resourceName = "dbSystems" - resourceDBSystemShapes resourceName = "dbSystemShapes" - resourceDBVersions resourceName = "dbVersions" - resourceDatabases resourceName = "databases" - resourceDBSupportedOperations resourceName = "supportedOperations" - - // Identity Resources - resourceAvailabilityDomains resourceName = "availabilityDomains" - resourceCompartments resourceName = "compartments" - resourceGroups resourceName = "groups" - resourcePolicies resourceName = "policies" - resourceUiPassword resourceName = "uiPassword" - resourceUsers resourceName = "users" - resourceUserGroupMemberships resourceName = "userGroupMemberships" - resourceSwiftPasswords resourceName = "swiftPasswords" - resourceTenancies resourceName = "tenancies" - resourceRegions resourceName = "regions" - - // Core Resources - resourceCustomerPremiseEquipment resourceName = "cpes" - resourceDHCPOptions resourceName = "dhcps" - resourceDrgAttachments resourceName = "drgAttachments" - resourceDrgs resourceName = "drgs" - resourceImages resourceName = "images" - resourceInstanceConsoleHistories resourceName = "instanceConsoleHistories" - resourceInstances resourceName = "instances" - resourceInternetGateways resourceName = "internetGateways" - resourceIPSecConnections resourceName = "ipsecConnections" - resourcePrivateIPs resourceName = "privateIps" - resourceRouteTables resourceName = "routeTables" - resourceSecurityLists resourceName = "securityLists" - resourceShapes resourceName = "shapes" - resourceSubnets resourceName = "subnets" - resourceVirtualNetworks resourceName = "vcns" - resourceVnics resourceName = "vnics" - resourceVnicAttachments resourceName = "vnicAttachments" - resourceVolumes resourceName = "volumes" - 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" - deviceStatus = "deviceStatus" - dataURLPart = "data" - - // Object Storage Resources - resourceNamespaces = "n" - resourceBuckets = "b" - resourceObjects = "o" - resourcePAR = "p" - - //Object Storage Access Type - NoPublicAccess BucketAccessType = "NoPublicAccess" - ObjectRead BucketAccessType = "ObjectRead" - - //Retry Logic - retryTokenKey = "opc-retry-token" - shortRetryTime = time.Duration(2) * time.Minute - longRetryTime = time.Duration(10) * time.Minute - generatedRetryTokenLength = 30 - - //PAR(pre-authenticated request) access type - PARObjectRead PARAccessType = "ObjectRead" - PARObjectWrite PARAccessType = "ObjectWrite" - PARObjectReadWrite PARAccessType = "ObjectReadWrite" - PARAnyObjectWrite PARAccessType = "AnyObjectWrite" -) diff --git a/vendor/github.com/oracle/bmcs-go-sdk/container.go b/vendor/github.com/oracle/bmcs-go-sdk/container.go deleted file mode 100644 index 9ec2a5364e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/container.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -type Container interface { - GetList() interface{} -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_console_history_metadata.go b/vendor/github.com/oracle/bmcs-go-sdk/core_console_history_metadata.go deleted file mode 100644 index 78ca21d788..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_console_history_metadata.go +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "strconv" - "time" -) - -// ConsoleHistoryMetadata describes console history metadata -// -// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/ConsoleHistory/ -type ConsoleHistoryMetadata struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - AvailabilityDomain string `json:"availabilityDomain"` - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - InstanceID string `json:"instanceId"` - State string `json:"lifecycleState"` - TimeCreated time.Time `json:"TimeCreated"` -} - -// ConsoleHistoryData contains all or part of an instance console history -// snapshot. If BytesRemaining is greater than zero, Data is only part of the -// total history. The remainder may be fetched on subsequent calls to -// ShowConsoleHistoryData, populating Offset and Limit options. -type ConsoleHistoryData struct { - BytesRemaining int - Data string -} - -// ListConsoleHistories contains a list of Console History Metadata -type ListConsoleHistories struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - ConsoleHistories []ConsoleHistoryMetadata -} - -func (l *ListConsoleHistories) GetList() interface{} { - return &l.ConsoleHistories -} - -// ListConsoleHistories shows the metadata for the specified compartment or instance -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/ConsoleHistory/ListConsoleHistories -func (c *Client) ListConsoleHistories(compartmentID string, opts *ListConsoleHistoriesOptions) (icHistories *ListConsoleHistories, e error) { - required := listOCIDRequirement{CompartmentID: compartmentID} - - details := &requestDetails{ - name: resourceInstanceConsoleHistories, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - icHistories = &ListConsoleHistories{} - e = resp.unmarshal(icHistories) - return -} - -// CaptureConsoleHistory captures the most recent serial console data (up to a megabyte) for the specified instance. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/ConsoleHistory/CaptureConsoleHistory -func (c *Client) CaptureConsoleHistory(instanceID string, opts *RetryTokenOptions) (icHistory *ConsoleHistoryMetadata, e error) { - required := struct { - InstanceID string `header:"-" json:"instanceId" url:"-"` - }{ - InstanceID: instanceID, - } - - details := &requestDetails{ - name: resourceInstanceConsoleHistories, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - icHistory = &ConsoleHistoryMetadata{} - e = resp.unmarshal(icHistory) - return -} - -// GetConsoleHistory shows the metadata for the specified console history -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/ConsoleHistory/GetConsoleHistory -func (c *Client) GetConsoleHistory(instanceID string) (consoleHistoryMetadata *ConsoleHistoryMetadata, e error) { - details := &requestDetails{ - name: resourceInstanceConsoleHistories, - ids: urlParts{instanceID}, - } - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - consoleHistoryMetadata = &ConsoleHistoryMetadata{} - e = resp.unmarshal(consoleHistoryMetadata) - return -} - -// ShowConsoleHistoryData gets the actual console history data (not the metadata). -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/ConsoleHistory/GetConsoleHistoryContent -func (c *Client) ShowConsoleHistoryData(instanceConsoleHistoryID string, opts *ConsoleHistoryDataOptions) (hist *ConsoleHistoryData, e error) { - details := &requestDetails{ - name: resourceInstanceConsoleHistories, - ids: urlParts{instanceConsoleHistoryID, dataURLPart}, - optional: opts, - } - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - hist = &ConsoleHistoryData{Data: string(resp.body[:])} - s := resp.header.Get(headerBytesRemaining) - - if s != "" { - if hist.BytesRemaining, e = strconv.Atoi(s); e != nil { - return - } - } - - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_console_history_metadata_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_console_history_metadata_test.go deleted file mode 100644 index c73cc4d407..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_console_history_metadata_test.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" -) - -func (s *CoreTestSuite) TestListInstanceConsoleHistories() { - instanceID := "instanceid" - - opts := &ListConsoleHistoriesOptions{} - opts.InstanceID = instanceID - opts.AvailabilityDomain = "domainid" - opts.Limit = 100 - opts.Page = "pageid" - - compartmentID := "compartmentid" - - reqOpts := &requestDetails{ - name: resourceInstanceConsoleHistories, - optional: opts, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - expected := []ConsoleHistoryMetadata{ - { - AvailabilityDomain: "availabilityDomain", - CompartmentID: compartmentID, - DisplayName: "cpe1", - ID: "id1", - InstanceID: instanceID, - State: ResourceRequested, - }, - { - AvailabilityDomain: "availabilityDomain", - CompartmentID: compartmentID, - DisplayName: "cpe1", - ID: "id2", - InstanceID: instanceID, - State: ResourceRequested, - }, - } - - responseHeaders := http.Header{} - s.requestor.On("getRequest", reqOpts).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListConsoleHistories(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.ConsoleHistories)) -} - -func (s *CoreTestSuite) TestCaptureConsoleHistory() { - instanceID := "instanceid" - - consoleHistoryMetadata := ConsoleHistoryMetadata{ - AvailabilityDomain: "availabilityDomain", - CompartmentID: "compartmentid", - DisplayName: "cpe1", - ID: "id1", - InstanceID: instanceID, - State: "REQUESTED", - } - - required := struct { - InstanceID string `header:"-" json:"instanceId" url:"-"` - }{ - InstanceID: instanceID, - } - - details := &requestDetails{ - name: resourceInstanceConsoleHistories, - optional: (*RetryTokenOptions)(nil), - required: required, - } - - s.requestor.On("postRequest", details).Return( - &response{ - header: http.Header{}, - body: marshalObjectForTest(consoleHistoryMetadata), - }, - nil, - ) - - actual, err := s.requestor.CaptureConsoleHistory(instanceID, nil) - - s.Nil(err) - s.NotNil(actual) - s.Equal(consoleHistoryMetadata.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetConsoleHistory() { - instanceID := "instanceid" - - details := &requestDetails{ - name: resourceInstanceConsoleHistories, - ids: urlParts{instanceID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - - expected := &ConsoleHistoryMetadata{ - AvailabilityDomain: "availabilityDomain", - CompartmentID: "compartmentid", - DisplayName: "cpe1", - ID: "id1", - InstanceID: instanceID, - State: "REQUESTED", - } - - resp := &response{ - body: marshalObjectForTest(expected), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetConsoleHistory(instanceID) - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(expected.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestShowConsoleHistoryData() { - opts := &ConsoleHistoryDataOptions{ - Length: 1000, - Offset: 1, - } - - details := &requestDetails{ - name: resourceInstanceConsoleHistories, - ids: urlParts{"id", dataURLPart}, - optional: opts, - } - - h := http.Header{} - h.Set(headerBytesRemaining, "1000") - - resp := &response{ - body: marshalObjectForTest("wubalubadubdub"), - header: h, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ShowConsoleHistoryData("id", opts) - s.Nil(e) - s.NotNil(actual) - s.Equal("\"wubalubadubdub\"\n", actual.Data) - s.Equal(1000, actual.BytesRemaining) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_cpe.go b/vendor/github.com/oracle/bmcs-go-sdk/core_cpe.go deleted file mode 100644 index 0b6a38ef15..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_cpe.go +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// Cpe describes customer premise equipment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Cpe/ -type Cpe struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - ID string `json:"id"` - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - IPAddress string `json:"ipAddress"` - TimeCreated Time `json:"timeCreated"` -} - -// ListCpes contains a list of customer premise equipment -// -type ListCpes struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Cpes []Cpe -} - -func (l *ListCpes) GetList() interface{} { - return &l.Cpes -} - -// ListCpes returns a list of customer premise equipment for a particular compartment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Cpe/ListCpes -func (c *Client) ListCpes(compartmentID string, opts *ListOptions) (cpes *ListCpes, e error) { - details := &requestDetails{ - name: resourceCustomerPremiseEquipment, - required: listOCIDRequirement{CompartmentID: compartmentID}, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - cpes = &ListCpes{} - e = resp.unmarshal(cpes) - return -} - -// CreateCpe is used to define customer premise equipment such as routers -// in the Bare Metal cloud -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Cpe/CreateCpe -func (c *Client) CreateCpe(compartmentID, ipAddress string, opts *CreateOptions) (cpe *Cpe, e error) { - required := struct { - ocidRequirement - IPAddress string `header:"-" json:"ipAddress" url:"-"` - }{ - IPAddress: ipAddress, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceCustomerPremiseEquipment, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - cpe = &Cpe{} - e = resp.unmarshal(cpe) - return -} - -// GetCpe retrieves information on a customer premise equipment resource. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Cpe/GetCpe -func (c *Client) GetCpe(id string) (cpe *Cpe, e error) { - details := &requestDetails{ - name: resourceCustomerPremiseEquipment, - ids: urlParts{id}, - } - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - cpe = &Cpe{} - e = resp.unmarshal(cpe) - return -} - -// UpdateCpe updates the specified CPE's display name. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Cpe/UpdateCpe -func (c *Client) UpdateCpe(id string, opts *IfMatchDisplayNameOptions) (cpe *Cpe, e error) { - details := &requestDetails{ - name: resourceCustomerPremiseEquipment, - ids: urlParts{id}, - optional: opts, - } - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - cpe = &Cpe{} - e = resp.unmarshal(cpe) - - return -} - -// DeleteCpe removes customer premise equipment resource -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Cpe/DeleteCpe -func (c *Client) DeleteCpe(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - name: resourceCustomerPremiseEquipment, - ids: urlParts{id}, - optional: opts, - } - return c.coreApi.deleteRequest(details) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_cpe_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_cpe_test.go deleted file mode 100644 index dd61e4ea1b..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_cpe_test.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestListCpes() { - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - compartmentID := "compartmentid" - created := Time{Time: time.Now()} - - details := &requestDetails{ - name: resourceCustomerPremiseEquipment, - optional: opts, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - expected := []Cpe{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "cpe1", - IPAddress: "120.121.122.123", - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "cpe1", - IPAddress: "120.121.122.124", - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListCpes(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Cpes)) - -} - -func (s *CoreTestSuite) TestCreateCpe() { - created := Time{Time: time.Now()} - - compartmentID := "compartmentid" - displayName := "cpe1" - ip := "123.123.123.123" - - cpe := &Cpe{ - ID: "id1", - CompartmentID: compartmentID, - DisplayName: displayName, - IPAddress: ip, - TimeCreated: created, - } - - opts := &CreateOptions{} - opts.DisplayName = displayName - - required := struct { - ocidRequirement - IPAddress string `header:"-" json:"ipAddress" url:"-"` - }{ - IPAddress: "123.123.123.123", - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceCustomerPremiseEquipment, - optional: opts, - required: required, - } - - s.requestor.On("postRequest", details).Return( - &response{ - header: http.Header{}, - body: marshalObjectForTest(cpe), - }, - nil, - ) - - actual, err := s.requestor.CreateCpe(compartmentID, ip, opts) - - s.Nil(err) - s.NotNil(actual) - s.Equal(cpe.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestDeleteCpe() { - s.testDeleteResource(resourceCustomerPremiseEquipment, "cpeid", s.requestor.DeleteCpe) -} - -func (s *CoreTestSuite) TestGetCpe() { - id := "cpeid" - - details := &requestDetails{ - name: resourceCustomerPremiseEquipment, - ids: urlParts{id}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - - created := Time{Time: time.Now()} - - expected := &Cpe{ - ID: id, - TimeCreated: created, - } - resp := &response{ - body: marshalObjectForTest(expected), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetCpe(id) - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(expected.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_dhcp_options.go b/vendor/github.com/oracle/bmcs-go-sdk/core_dhcp_options.go deleted file mode 100644 index f4cebf397b..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_dhcp_options.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// DHCPDNSOption specifies how DNS (host name resolution) is handled in the VCN -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DhcpDnsOption/ -type DHCPDNSOption struct { - Type string `json:"type"` - CustomDNSServers []string `json:"customDnsServers,omitempty"` - ServerType string `json:"serverType,omitempty"` - SearchDomainNames []string `json:"searchDomainNames,omitempty"` -} - -// DHCPOptions contains a set of dhcp options -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DhcpOptions/ -type DHCPOptions struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - Options []DHCPDNSOption `json:"options"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - VcnID string `json:"vcnId"` -} - -// ListDHCPOptions contains a list of dhcp options -// -type ListDHCPOptions struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - DHCPOptions []DHCPOptions -} - -func (l *ListDHCPOptions) GetList() interface{} { - return &l.DHCPOptions -} - -// CreateDHCPOptions creates a new set of DHCP options for the specified VCN -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DhcpOptions/CreateDhcpOptions -func (c *Client) CreateDHCPOptions(compartmentID, vcnID string, dhcpOptions []DHCPDNSOption, opts *CreateOptions) (res *DHCPOptions, e error) { - required := struct { - ocidRequirement - Options []DHCPDNSOption `header:"-" json:"options" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - Options: dhcpOptions, - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDHCPOptions, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - res = &DHCPOptions{} - e = resp.unmarshal(res) - return -} - -// GetDHCPOptions gets the specified set of DHCP options -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DhcpOptions/GetDhcpOptions -func (c *Client) GetDHCPOptions(id string) (res *DHCPOptions, e error) { - details := &requestDetails{ - name: resourceDHCPOptions, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &DHCPOptions{} - e = resp.unmarshal(res) - return -} - -// UpdateDHCPOptions updates the specified set of DHCP options -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DhcpOptions/UpdateDhcpOptions -func (c *Client) UpdateDHCPOptions(id string, opts *UpdateDHCPDNSOptions) (res *DHCPOptions, e error) { - details := &requestDetails{ - name: resourceDHCPOptions, - ids: urlParts{id}, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - res = &DHCPOptions{} - e = resp.unmarshal(res) - return -} - -// DeleteDHCPOptions deletes the specified set of DHCP options, but only if it's -// not in use by a subnet -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DhcpOptions/DeleteDhcpOptions -func (c *Client) DeleteDHCPOptions(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - name: resourceDHCPOptions, - ids: urlParts{id}, - optional: opts, - } - return c.coreApi.deleteRequest(details) -} - -// ListDHCPOptions gets a list of the sets of DHCP options in the specified VCN -// and specified compartment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DhcpOptions/ListDhcpOptions -func (c *Client) ListDHCPOptions(compartmentID, vcnID string, opts *ListOptions) (res *ListDHCPOptions, e error) { - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcnId"` - }{ - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDHCPOptions, - required: required, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &ListDHCPOptions{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_dhcp_options_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_dhcp_options_test.go deleted file mode 100644 index aad3dae1b6..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_dhcp_options_test.go +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestCreateDHCPOptions() { - dhcpDnsOptions := []DHCPDNSOption{{}} - expectedResponse := &DHCPOptions{ - CompartmentID: "compartmentID", - DisplayName: "displayName", - ID: "id1", - Options: dhcpDnsOptions, - State: ResourceAvailable, - TimeCreated: Time{Time: time.Now()}, - VcnID: "vcn_id", - } - - opts := &CreateOptions{} - opts.DisplayName = expectedResponse.DisplayName - - required := struct { - ocidRequirement - Options []DHCPDNSOption `header:"-" json:"options" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - Options: expectedResponse.Options, - VcnID: "vcn_id", - } - required.CompartmentID = "compartmentID" - - reqDetails := &requestDetails{ - name: resourceDHCPOptions, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(expectedResponse), - } - s.requestor.On("postRequest", reqDetails).Return(resp, nil) - - actualResponse, err := s.requestor.CreateDHCPOptions(expectedResponse.CompartmentID, expectedResponse.VcnID, expectedResponse.Options, opts) - - s.Nil(err) - s.NotNil(actualResponse) - s.Equal(expectedResponse.CompartmentID, actualResponse.CompartmentID) - s.Equal(expectedResponse.VcnID, actualResponse.VcnID) - s.Equal(expectedResponse.ID, actualResponse.ID) - s.Equal(expectedResponse.DisplayName, actualResponse.DisplayName) -} - -func (s *CoreTestSuite) TestGetDHCPOptions() { - expectedResponse := &DHCPOptions{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - VcnID: "vcn_id", - } - - reqDetails := &requestDetails{ - name: resourceDHCPOptions, - ids: urlParts{expectedResponse.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(expectedResponse), - header: headers, - } - - s.requestor.On("getRequest", reqDetails).Return(resp, nil) - - actualResponse, e := s.requestor.GetDHCPOptions(expectedResponse.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actualResponse) - s.Equal(expectedResponse.ID, actualResponse.ID) - s.Equal(expectedResponse.VcnID, actualResponse.VcnID) - s.Equal("ETAG", actualResponse.ETag) -} - -func (s *CoreTestSuite) TestUpdateDHCPOptions() { - dhcpDnsOptions := []DHCPDNSOption{{}} - expectedResponse := &DHCPOptions{ - ID: "id", - Options: dhcpDnsOptions, - TimeCreated: Time{Time: time.Now()}, - VcnID: "vcn_id", - } - - opts := &UpdateDHCPDNSOptions{ - Options: expectedResponse.Options, - } - - reqDetails := &requestDetails{ - name: resourceDHCPOptions, - ids: urlParts{expectedResponse.ID}, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(expectedResponse), - header: headers, - } - - s.requestor.On("request", http.MethodPut, reqDetails).Return(resp, nil) - - actualResponse, e := s.requestor.UpdateDHCPOptions(expectedResponse.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actualResponse) - s.Equal(expectedResponse.Options, actualResponse.Options) - s.Equal("ETAG!", actualResponse.ETag) - s.Equal(expectedResponse.VcnID, actualResponse.VcnID) -} - -func (s *CoreTestSuite) TestDeleteDHCPOptions() { - s.testDeleteResource(resourceDHCPOptions, "id", s.requestor.DeleteDHCPOptions) -} - -func (s *CoreTestSuite) TestListDHCPOptions() { - compartmentID := "compartmentid" - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcnId"` - }{ - VcnID: "vcn_id", - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDHCPOptions, - optional: opts, - required: required, - } - - created := Time{Time: time.Now()} - expected := []DHCPOptions{ - { - ID: "id1", - CompartmentID: compartmentID, - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListDHCPOptions(compartmentID, "vcn_id", opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.DHCPOptions)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_drg.go b/vendor/github.com/oracle/bmcs-go-sdk/core_drg.go deleted file mode 100644 index 84db4e7b10..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_drg.go +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// Drg describes a dynamic routing gateway -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Drg/ -type Drg struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` -} - -// ListDrgs contains a list of gateways -// -type ListDrgs struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Drgs []Drg -} - -func (l *ListDrgs) GetList() interface{} { - return &l.Drgs -} - -// CreateDrg is used to create a gateway -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Drg/CreateDrg -func (c *Client) CreateDrg(compartmentID string, opts *CreateOptions) (res *Drg, e error) { - details := &requestDetails{ - name: resourceDrgs, - optional: opts, - required: ocidRequirement{compartmentID}, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - res = &Drg{} - e = resp.unmarshal(res) - return -} - -// GetDrg retrieves information about a gateway -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Drg/GetDrg -func (c *Client) GetDrg(id string) (res *Drg, e error) { - details := &requestDetails{ - name: resourceDrgs, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &Drg{} - e = resp.unmarshal(res) - return -} - -// UpdateDrg updates the specified DRG's display name. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Drg/UpdateDrg -func (c *Client) UpdateDrg(id string, opts *IfMatchDisplayNameOptions) (drg *Drg, e error) { - details := &requestDetails{ - name: resourceDrgs, - ids: urlParts{id}, - optional: opts, - } - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - drg = &Drg{} - e = resp.unmarshal(drg) - - return -} - -// DeleteDrg removes a gateway -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Drg/DeleteDrg -func (c *Client) DeleteDrg(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - name: resourceDrgs, - ids: urlParts{id}, - optional: opts, - } - return c.coreApi.deleteRequest(details) -} - -// ListDrgs returns a list of gateways for a compartment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Drg/ListDrgs -func (c *Client) ListDrgs(compartmentID string, opts *ListOptions) (res *ListDrgs, e error) { - details := &requestDetails{ - name: resourceDrgs, - required: listOCIDRequirement{compartmentID}, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &ListDrgs{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_drg_attachment.go b/vendor/github.com/oracle/bmcs-go-sdk/core_drg_attachment.go deleted file mode 100644 index dd1d0ccec5..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_drg_attachment.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// DrgAttachment describes a Drg attachment to a Vcn -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DrgAttachment/ -type DrgAttachment struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - DrgID string `json:"drgId"` - ID string `json:"id"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - VcnID string `json:"vcnId"` -} - -// ListDrgAttachments contains a list of volume attachments -// -type ListDrgAttachments struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - DrgAttachments []DrgAttachment -} - -func (l *ListDrgAttachments) GetList() interface{} { - return &l.DrgAttachments -} - -// CreateDrgAttachment attaches a drg to a vcn. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DrgAttachment/CreateDrgAttachment -func (c *Client) CreateDrgAttachment(drgID, vcnID string, opts *CreateOptions) (res *DrgAttachment, e error) { - required := struct { - DrgID string `header:"-" json:"drgId" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - DrgID: drgID, - VcnID: vcnID, - } - - details := &requestDetails{ - name: resourceDrgAttachments, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - res = &DrgAttachment{} - e = resp.unmarshal(res) - return -} - -// GetDrgAttachment gets information about the specified drg attachment -// -// Seehttps://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DrgAttachment/GetDrgAttachment -func (c *Client) GetDrgAttachment(id string) (res *DrgAttachment, e error) { - details := &requestDetails{ - name: resourceDrgAttachments, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &DrgAttachment{} - e = resp.unmarshal(res) - return -} - -// UpdateDrgAttachment updates the display name for the specified DrgAttachment. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DrgAttachment/UpdateDrgAttachment -func (c *Client) UpdateDrgAttachment(id string, opts *IfMatchDisplayNameOptions) (drg *DrgAttachment, e error) { - details := &requestDetails{ - name: resourceDrgAttachments, - ids: urlParts{id}, - optional: opts, - } - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - drg = &DrgAttachment{} - e = resp.unmarshal(drg) - - return -} - -// DeleteDrgAttachment detaches a drg from its vcn -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DrgAttachment/DeleteDrgAttachment -func (c *Client) DeleteDrgAttachment(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - name: resourceDrgAttachments, - ids: urlParts{id}, - optional: opts, - } - return c.coreApi.deleteRequest(details) -} - -// ListDrgAttachments gets a list of the drgs in the specified compartment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/DrgAttachment/ListDrgAttachments -func (c *Client) ListDrgAttachments(compartmentID string, opts *ListDrgAttachmentsOptions) (res *ListDrgAttachments, e error) { - details := &requestDetails{ - name: resourceDrgAttachments, - required: listOCIDRequirement{compartmentID}, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &ListDrgAttachments{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_drg_attachment_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_drg_attachment_test.go deleted file mode 100644 index f84d7e060d..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_drg_attachment_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestCreateDrgAttachment() { - res := &DrgAttachment{ - CompartmentID: "compartmentID", - DisplayName: "displayName", - DrgID: "drgID", - ID: "id1", - State: ResourceAttached, - TimeCreated: Time{Time: time.Now()}, - VcnID: "vcnID", - } - - opts := &CreateOptions{} - opts.DisplayName = res.DisplayName - - required := struct { - DrgID string `header:"-" json:"drgId" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - DrgID: res.DrgID, - VcnID: res.VcnID, - } - - details := &requestDetails{ - name: resourceDrgAttachments, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateDrgAttachment(res.DrgID, res.VcnID, opts) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetDrgAttachment() { - res := &DrgAttachment{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - name: resourceDrgAttachments, - ids: urlParts{res.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetDrgAttachment(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestDeleteDrgAttachment() { - s.testDeleteResource(resourceDrgAttachments, "id", s.requestor.DeleteDrgAttachment) -} - -func (s *CoreTestSuite) TestListDrgAttachments() { - compartmentID := "compartment_id" - opts := &ListDrgAttachmentsOptions{} - opts.DrgID = "drg_id" - opts.Limit = 1 - opts.Page = "page" - opts.VcnID = "vcn_id" - - details := &requestDetails{ - name: resourceDrgAttachments, - optional: opts, - required: listOCIDRequirement{compartmentID}, - } - - created := Time{Time: time.Now()} - expected := []DrgAttachment{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "drg1", - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "drg2", - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListDrgAttachments(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.DrgAttachments)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_drg_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_drg_test.go deleted file mode 100644 index e990186dff..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_drg_test.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestCreateDrg() { - res := &Drg{ - CompartmentID: "compartmentID", - DisplayName: "displayName", - ID: "id1", - State: ResourceProvisioning, - TimeCreated: Time{Time: time.Now()}, - } - - opts := &CreateOptions{} - opts.DisplayName = res.DisplayName - - details := &requestDetails{ - name: resourceDrgs, - optional: opts, - required: ocidRequirement{"compartmentID"}, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateDrg(res.CompartmentID, opts) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetDrg() { - res := &Drg{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - name: resourceDrgs, - ids: urlParts{res.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetDrg(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestDeleteDrg() { - s.testDeleteResource(resourceDrgs, "id", s.requestor.DeleteDrg) -} - -func (s *CoreTestSuite) TestListDrgs() { - compartmentID := "compartmentid" - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - details := &requestDetails{ - name: resourceDrgs, - optional: opts, - required: listOCIDRequirement{compartmentID}, - } - - created := Time{Time: time.Now()} - expected := []Drg{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "drg1", - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "drg2", - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListDrgs(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Drgs)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_image.go b/vendor/github.com/oracle/bmcs-go-sdk/core_image.go deleted file mode 100644 index 172a8cac8d..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_image.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// Image describes a boot disk image for launching an instance -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Image/ -type Image struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - BaseImageID string `json:"baseImageId"` - CompartmentID string `json:"compartmentId"` - CreateImageAllowed bool `json:"createImageAllowed"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - State string `json:"lifecycleState"` - OperatingSystem string `json:"operatingSystem"` - OperatingSystemVersion string `json:"operatingSystemVersion"` - TimeCreated Time `json:"timeCreated"` -} - -// ListImages contains a list of images -// -type ListImages struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Images []Image -} - -func (l *ListImages) GetList() interface{} { - return &l.Images -} - -// CreateImage is used to create an image -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Image/CreateImage -func (c *Client) CreateImage(compartmentID, instanceID string, opts *CreateOptions) (res *Image, e error) { - required := struct { - ocidRequirement - InstanceID string `header:"-" json:"instanceId" url:"-"` - }{ - InstanceID: instanceID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceImages, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - res = &Image{} - e = resp.unmarshal(res) - return -} - -// GetImage retrieves information about an image -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Image/GetImage -func (c *Client) GetImage(id string) (res *Image, e error) { - details := &requestDetails{ - name: resourceImages, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &Image{} - e = resp.unmarshal(res) - return -} - -// UpdateImage updates an images display name -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Image/UpdateImage -func (c *Client) UpdateImage(id string, opts *UpdateOptions) (res *Image, e error) { - details := &requestDetails{ - name: resourceImages, - ids: urlParts{id}, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - res = &Image{} - e = resp.unmarshal(res) - return -} - -// DeleteImage removes an image -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Image/DeleteImage -func (c *Client) DeleteImage(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - name: resourceImages, - ids: urlParts{id}, - optional: opts, - } - return c.coreApi.deleteRequest(details) -} - -// ListImages returns a list of images -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Image/ListImages -func (c *Client) ListImages(compartmentID string, opts *ListImagesOptions) (res *ListImages, e error) { - details := &requestDetails{ - name: resourceImages, - required: listOCIDRequirement{compartmentID}, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &ListImages{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_image_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_image_test.go deleted file mode 100644 index d6565d6f36..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_image_test.go +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestCreateImage() { - res := &Image{ - BaseImageID: "base_image_id", - CompartmentID: "compartmentID", - CreateImageAllowed: true, - DisplayName: "displayName", - ID: "id1", - State: ResourceProvisioning, - OperatingSystem: "operatingSystem", - OperatingSystemVersion: "operatingSystemVersion", - TimeCreated: Time{Time: time.Now()}, - } - - required := struct { - ocidRequirement - InstanceID string `header:"-" json:"instanceId" url:"-"` - }{ - InstanceID: "instance_id", - } - required.CompartmentID = res.CompartmentID - - opts := &CreateOptions{} - opts.DisplayName = res.DisplayName - - details := &requestDetails{ - name: resourceImages, - required: required, - optional: opts, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateImage(res.CompartmentID, "instance_id", opts) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetImage() { - res := &Image{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - name: resourceImages, - ids: urlParts{res.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetImage(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestUpdateImage() { - res := &Image{ - ID: "id", - DisplayName: "displayName", - TimeCreated: Time{Time: time.Now()}, - } - - opts := &UpdateOptions{} - opts.DisplayName = res.DisplayName - - details := &requestDetails{ - name: resourceImages, - ids: urlParts{res.ID}, - optional: opts, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateImage(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.DisplayName, actual.DisplayName) - s.Equal("ETAG!", actual.ETag) -} - -func (s *CoreTestSuite) TestDeleteImage() { - s.testDeleteResource(resourceImages, "id", s.requestor.DeleteImage) -} - -func (s *CoreTestSuite) TestListImages() { - compartmentID := "compartmentid" - opts := &ListImagesOptions{} - opts.Limit = 100 - opts.Page = "pageid" - opts.OperatingSystem = "operating_system" - opts.OperatingSystemVersion = "operating_system_version" - - details := &requestDetails{ - name: resourceImages, - optional: opts, - required: listOCIDRequirement{compartmentID}, - } - - created := Time{Time: time.Now()} - expected := []Image{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "res1", - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "res2", - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListImages(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Images)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_instance.go b/vendor/github.com/oracle/bmcs-go-sdk/core_instance.go deleted file mode 100644 index 8503a4b17a..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_instance.go +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// Instance contains information about a compute host. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Instance/ -type Instance struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - AvailabilityDomain string `json:"availabilityDomain"` - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - ImageID string `json:"imageId"` - Metadata map[string]string `json:"metadata"` - ExtendedMetadata map[string]interface{} `json:"extendedMetadata"` - Region string `json:"region"` - Shape string `json:"shape"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - IpxeScript string `json:"ipxeScript"` -} - -// InstanceCredentials contains first run windows instance credentials -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/InstanceCredentials/GetWindowsInstanceInitialCredentials -type InstanceCredentials struct { - Username string - Password string -} - -// ListInstances contains a list of instances. -type ListInstances struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Instances []Instance -} - -func (l *ListInstances) GetList() interface{} { - return &l.Instances -} - -// LaunchInstance initializes and starts a compute instance. Display name is -// set in the opts parameter. See Oracle documentation for more information -// on other arguments. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Instance/LaunchInstance -func (c *Client) LaunchInstance( - availabilityDomain, - compartmentID, - image, - shape, - subnetID string, - opts *LaunchInstanceOptions) (inst *Instance, e error) { - - required := struct { - ocidRequirement - AvailabilityDomain string `header:"-" json:"availabilityDomain" url:"-"` - ImageID string `header:"-" json:"imageId" url:"-"` - Shape string `header:"-" json:"shape" url:"-"` - SubnetID string `header:"-" json:"subnetId,omitempty" url:"-"` - }{ - AvailabilityDomain: availabilityDomain, - ImageID: image, - Shape: shape, - SubnetID: subnetID, - } - required.CompartmentID = compartmentID - - req := &requestDetails{ - name: resourceInstances, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(req); e != nil { - return - } - - inst = &Instance{} - e = resp.unmarshal(inst) - return -} - -// GetInstance retrieves a compute instance with instanceID -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Instance/GetInstance -func (c *Client) GetInstance(id string) (inst *Instance, e error) { - details := &requestDetails{ - name: resourceInstances, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - inst = &Instance{} - e = resp.unmarshal(inst) - return -} - -// UpdateInstance can be used to change the display name of a compute instance -// by assigning the new name to Options.DisplayName -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Instance/UpdateInstance -func (c *Client) UpdateInstance(id string, opts *UpdateOptions) (inst *Instance, e error) { - details := &requestDetails{ - name: resourceInstances, - ids: urlParts{id}, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - inst = &Instance{} - e = resp.unmarshal(inst) - return -} - -// TerminateInstance terminates the compute instance with an ID matching -// instanceID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Instance/TerminateInstance -func (c *Client) TerminateInstance(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceInstances, - optional: opts, - } - - return c.coreApi.deleteRequest(details) -} - -// ListInstances returns a list of compute instances hosted in a compartment. AvailabilityDomain -// may be included in Options to further refine results. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Instance/ListInstances -func (c *Client) ListInstances(compartmentID string, opts *ListInstancesOptions) (insts *ListInstances, e error) { - details := &requestDetails{ - name: resourceInstances, - required: listOCIDRequirement{CompartmentID: compartmentID}, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - insts = &ListInstances{} - e = resp.unmarshal(insts) - return -} - -// InstanceAction starts, stops, or resets a compute instance identified by -// instanceID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Instance/InstanceAction -func (c *Client) InstanceAction(id string, action InstanceActions, opts *HeaderOptions) (inst *Instance, e error) { - required := struct { - Action string `header:"-" json:"-" url:"action"` - }{ - Action: string(action), - } - - details := &requestDetails{ - name: resourceInstances, - ids: urlParts{id}, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - inst = &Instance{} - e = resp.unmarshal(inst) - return -} - -// Returns the initial credentials for a Windows instance. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/InstanceCredentials/ -func (c *Client) GetWindowsInstanceInitialCredentials(instanceId string) (creds *InstanceCredentials, e error) { - details := &requestDetails{ - name: resourceInstances, - ids: urlParts{instanceId, "initialCredentials"}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - creds = &InstanceCredentials{} - e = resp.unmarshal(creds) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_instance_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_instance_test.go deleted file mode 100644 index 67ce3527a8..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_instance_test.go +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestLaunchInstance() { - metadata := map[string]string{"foo": "bar"} - extendedMetadata := make(map[string]interface{}) - extendedMetadata["key"] = map[string]string{"key1": "value1"} - created := Time{Time: time.Now()} - ipxeScript := "#!ipxe\nchain http://boot.ipxe.org/demo/boot.php" - - res := &Instance{ - AvailabilityDomain: "availabilityDomain", - CompartmentID: "compartmentID", - DisplayName: "displayName", - ID: "id1", - ImageID: "image1", - Metadata: metadata, - ExtendedMetadata: extendedMetadata, - IpxeScript: ipxeScript, - Region: "Perth", - Shape: "x5-2.36.512.nvme-6.4", - State: ResourceAvailable, - TimeCreated: created, - } - - opts := &LaunchInstanceOptions{} - opts.DisplayName = res.DisplayName - opts.Metadata = res.Metadata - opts.ExtendedMetadata = res.ExtendedMetadata - opts.IpxeScript = res.IpxeScript - - required := struct { - ocidRequirement - AvailabilityDomain string `header:"-" json:"availabilityDomain" url:"-"` - ImageID string `header:"-" json:"imageId" url:"-"` - Shape string `header:"-" json:"shape" url:"-"` - SubnetID string `header:"-" json:"subnetId,omitempty" url:"-"` - }{ - AvailabilityDomain: res.AvailabilityDomain, - ImageID: res.ImageID, - Shape: res.Shape, - SubnetID: "subnetid", - } - required.CompartmentID = res.CompartmentID - - details := &requestDetails{ - name: resourceInstances, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.LaunchInstance( - res.AvailabilityDomain, - res.CompartmentID, - res.ImageID, - res.Shape, - "subnetid", - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) - s.Equal(res.IpxeScript, actual.IpxeScript) -} - -func (s *CoreTestSuite) TestGetInstance() { - res := &Instance{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - name: resourceInstances, - ids: urlParts{res.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetInstance(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestGetWindowsInstanceInitialCredentials() { - res := &InstanceCredentials{ - Username: "username", - Password: "password", - } - details := &requestDetails{ - name: resourceInstances, - ids: urlParts{"instanceId", "initialCredentials"}, - } - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - s.requestor.On("getRequest", details).Return(resp, nil) - actual, e := s.requestor.GetWindowsInstanceInitialCredentials("instanceId") - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal("username", actual.Username) -} - -func (s *CoreTestSuite) TestInstanceAction() { - res := &Instance{ - ID: "id", - DisplayName: "displayName", - TimeCreated: Time{Time: time.Now()}, - } - - required := struct { - Action string `header:"-" json:"-" url:"action"` - }{ - Action: string(actionStart), - } - - details := &requestDetails{ - name: resourceInstances, - ids: urlParts{res.ID}, - required: required, - optional: (*HeaderOptions)(nil), - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.InstanceAction(res.ID, actionStart, nil) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *CoreTestSuite) TestUpdateInstance() { - res := &Instance{ - ID: "id", - DisplayName: "displayName", - TimeCreated: Time{Time: time.Now()}, - } - - opts := &UpdateOptions{} - opts.DisplayName = res.DisplayName - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceInstances, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateInstance(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.DisplayName, actual.DisplayName) - s.Equal("ETAG!", actual.ETag) -} - -func (s *CoreTestSuite) TestTerminateInstance() { - s.testDeleteResource(resourceInstances, "id", s.requestor.TerminateInstance) -} - -func (s *CoreTestSuite) TestListInstances() { - compartmentID := "compartmentid" - opts := &ListInstancesOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - details := &requestDetails{ - name: resourceInstances, - optional: opts, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - created := Time{Time: time.Now()} - expected := []Instance{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "one", - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "two", - TimeCreated: created, - }, - } - - headers := http.Header{} - headers.Set(headerOPCNextPage, "nextpage") - headers.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: headers, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListInstances(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Instances)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_internet_gateway.go b/vendor/github.com/oracle/bmcs-go-sdk/core_internet_gateway.go deleted file mode 100644 index 8cda802265..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_internet_gateway.go +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// InternetGateway information on an internet gateway hosted in a -// virtual cloud network -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/InternetGateway/ -type InternetGateway struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName,omitempty"` - ID string `json:"id"` - IsEnabled bool `json:"isEnabled"` - ModifiedTime Time `json:"modifiedTime"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - VcnID string `json:"vcnId"` -} - -// ListInternetGateways contains a set of internet gateways -type ListInternetGateways struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Gateways []InternetGateway -} - -func (ig *ListInternetGateways) GetList() interface{} { - return &ig.Gateways -} - -// CreateInternetGateway creates an internet gateway. compartmentID is the compartment -// hosting the gateway, vcnID is the ID of the virtual cloud network, isEnabled -// determines if the gateway is enabled on creation. An optional display name may -// be provided in opts. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/InternetGateway/CreateInternetGateway -func (c *Client) CreateInternetGateway(compartmentID, vcnID string, isEnabled bool, opts *CreateOptions) (gw *InternetGateway, e error) { - required := struct { - ocidRequirement - IsEnabled bool `header:"-" json:"isEnabled" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - IsEnabled: isEnabled, - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceInternetGateways, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - gw = &InternetGateway{} - e = resp.unmarshal(gw) - return -} - -// GetInternetGateway retrieves information for the Internet Gateway identified -// by id. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/InternetGateway/GetInternetGateway -func (c *Client) GetInternetGateway(id string) (gw *InternetGateway, e error) { - details := &requestDetails{ - name: resourceInternetGateways, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - gw = &InternetGateway{} - e = resp.unmarshal(gw) - return - -} - -// UpdateInternetGateway enables or disables internet gateway -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/InternetGateway/UpdateInternetGateway -func (c *Client) UpdateInternetGateway(id string, opts *UpdateGatewayOptions) (gw *InternetGateway, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceInternetGateways, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - gw = &InternetGateway{} - e = resp.unmarshal(gw) - return -} - -// DeleteInternetGateway removes internet gateway -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/InternetGateway/DeleteInternetGateway -func (c *Client) DeleteInternetGateway(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - name: resourceInternetGateways, - ids: urlParts{id}, - optional: opts, - } - return c.coreApi.deleteRequest(details) -} - -// ListInternetGateways is used to fetch a list of internet gateways. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/InternetGateway/ListInternetGateways -func (c *Client) ListInternetGateways(compartmentID, vcnID string, opts *ListOptions) (list *ListInternetGateways, e error) { - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcnId"` - }{ - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceInternetGateways, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - list = &ListInternetGateways{} - e = resp.unmarshal(list) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_internet_gateway_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_internet_gateway_test.go deleted file mode 100644 index fb1952df62..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_internet_gateway_test.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func getTestInternetGateway(id string) *InternetGateway { - conn := &InternetGateway{ - CompartmentID: "compartmentID", - DisplayName: "displayName", - ID: id, - IsEnabled: true, - State: ResourceAvailable, - TimeCreated: Time{Time: time.Now()}, - } - conn.ETag = "etag" - conn.RequestID = "requestid" - - return conn -} - -func (s *CoreTestSuite) TestCreateInternetGateway() { - res := getTestInternetGateway("id") - - opts := &CreateOptions{} - opts.DisplayName = res.DisplayName - - required := struct { - ocidRequirement - IsEnabled bool `header:"-" json:"isEnabled" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - IsEnabled: res.IsEnabled, - VcnID: "vcnID", - } - required.CompartmentID = res.CompartmentID - - details := &requestDetails{ - name: resourceInternetGateways, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateInternetGateway( - res.CompartmentID, - "vcnID", - res.IsEnabled, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetInternetGateway() { - res := getTestInternetGateway("id") - - details := &requestDetails{ - name: resourceInternetGateways, - ids: urlParts{res.ID}, - } - - resp := &response{ - body: marshalObjectForTest(res), - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetInternetGateway(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) -} - -func (s *CoreTestSuite) TestDeleteInternetGateway() { - s.testDeleteResource(resourceInternetGateways, "id", s.requestor.DeleteInternetGateway) -} - -func (s *CoreTestSuite) TestUpdateInternetGateway() { - res := getTestInternetGateway("id") - - opts := &UpdateGatewayOptions{} - opts.IsEnabled = new(bool) - *opts.IsEnabled = true - opts.IfMatch = "etag" - - details := &requestDetails{ - ids: urlParts{"id"}, - name: resourceInternetGateways, - optional: opts, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateInternetGateway("id", opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.IsEnabled, actual.IsEnabled) -} - -func (s *CoreTestSuite) TestListInternetGateways() { - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcnId"` - }{ - VcnID: "vcnid", - } - required.CompartmentID = "compartmentid" - - details := &requestDetails{ - name: resourceInternetGateways, - optional: opts, - required: required, - } - - expected := []InternetGateway{*getTestInternetGateway("id1")} - - headers := http.Header{} - headers.Set(headerOPCNextPage, "nextpage") - headers.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: headers, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListInternetGateways("compartmentid", "vcnid", opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Gateways)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_ipsec.go b/vendor/github.com/oracle/bmcs-go-sdk/core_ipsec.go deleted file mode 100644 index 344c96273c..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_ipsec.go +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// TunnelConfig represents the coniguration for one end of an IPSec tunnel. -type TunnelConfig struct { - IPAddress string `json:"ipAddress"` - SharedSecret string `json:"sharedSecret"` - TimeCreated Time `json:"timeCreated"` -} - -// TunnelStatus represents the status of one end of an IPSec tunnel. -type TunnelStatus struct { - IPAddress string `json:"ipAddress"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - TimeStateModified Time `json:"timeStateModified"` -} - -type IPSecConnectionDevice struct { - CompartmentID string `json:"compartmentId"` - ID string `json:"id"` - TimeCreated Time `json:"timeCreated"` -} - -// IPSecConnectionDeviceConfig information to set up an IPSec tunnel. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnectionDeviceConfig/ -type IPSecConnectionDeviceConfig struct { - OPCRequestIDUnmarshaller - IPSecConnectionDevice - Tunnels []TunnelConfig `json:"tunnels"` -} - -// IPSecConnectionDeviceStatus information on a IPSec tunnel status -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnectionDeviceStatus/ -type IPSecConnectionDeviceStatus struct { - OPCRequestIDUnmarshaller - IPSecConnectionDevice - Tunnels []TunnelStatus `json:"tunnels"` -} - -// IPSecConnection information about an IPSec connection -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnection/ -type IPSecConnection struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - CpeID string `json:"cpeId"` - DisplayName string `json:"displayName"` - DrgID string `json:"drgId"` - ID string `json:"id"` - State string `json:"lifecycleState"` - StaticRoutes []string `json:"staticRoutes"` - TimeCreated Time `json:"timeCreated"` -} - -// ListIPSecConnections contains a list of IPSec connections as well as -// a NextPage tag that can be passed to a subsequent request for paging. -type ListIPSecConnections struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Connections []IPSecConnection -} - -func (l *ListIPSecConnections) GetList() interface{} { - return &l.Connections -} - -// CreateIPSecConnection create an IPSec connection. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnection/CreateIPSecConnection -func (c *Client) CreateIPSecConnection(compartmentID, cpeID, drgID string, staticRoutes []string, opts *CreateOptions) (conn *IPSecConnection, e error) { - required := struct { - ocidRequirement - CpeID string `header:"-" json:"cpeId" url:"-"` - DrgID string `header:"-" json:"drgId" url:"-"` - StaticRoutes []string `header:"-" json:"staticRoutes" url:"-"` - }{ - CpeID: cpeID, - DrgID: drgID, - StaticRoutes: staticRoutes, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceIPSecConnections, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - conn = &IPSecConnection{} - e = resp.unmarshal(conn) - return -} - -// ListIPSecConnections retrieves a list of IPSec connections in a compartment. -// Results can be further refined by optional parameters DrgID and/or CpeID. Paging -// is supported by providing optional Page and Limit parameters. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnection/ListIPSecConnections -func (c *Client) ListIPSecConnections(compartmentID string, opts *ListIPSecConnsOptions) (conns *ListIPSecConnections, e error) { - details := &requestDetails{ - name: resourceIPSecConnections, - optional: opts, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - conns = &ListIPSecConnections{} - e = resp.unmarshal(conns) - return -} - -// GetIPSecConnection retrieves the IPSec connection identified by id -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnection/GetIPSecConnection -func (c *Client) GetIPSecConnection(id string) (conn *IPSecConnection, e error) { - details := &requestDetails{ - name: resourceIPSecConnections, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - conn = &IPSecConnection{} - e = resp.unmarshal(conn) - return -} - -// UpdateIPSecConnection updates the display name for the specified IPSec connection. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnection/UpdateIPSecConnection -func (c *Client) UpdateIPSecConnection(id string, opts *IfMatchDisplayNameOptions) (conn *IPSecConnection, e error) { - details := &requestDetails{ - name: resourceIPSecConnections, - ids: urlParts{id}, - optional: opts, - } - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - conn = &IPSecConnection{} - e = resp.unmarshal(conn) - - return -} - -// DeleteIPSecConnection deletes an IPSec connection. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnection/DeleteIPSecConnection -func (c *Client) DeleteIPSecConnection(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceIPSecConnections, - optional: opts, - } - - return c.coreApi.deleteRequest(details) -} - -// GetIPSecConnectionDeviceConfig retrieves router configuration to set up -// IPSec tunnel on customer premise device. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnectionDeviceConfig/GetIPSecConnectionDeviceConfig -func (c *Client) GetIPSecConnectionDeviceConfig(id string) (config *IPSecConnectionDeviceConfig, e error) { - details := &requestDetails{ - name: resourceIPSecConnections, - ids: urlParts{id, deviceConfig}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - config = &IPSecConnectionDeviceConfig{} - e = resp.unmarshal(config) - return -} - -// GetIPSecConnectionDeviceStatus get status on an IPSec tunnel. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IPSecConnectionDeviceStatus/GetIPSecConnectionDeviceStatus -func (c *Client) GetIPSecConnectionDeviceStatus(id string) (status *IPSecConnectionDeviceStatus, e error) { - details := &requestDetails{ - name: resourceIPSecConnections, - ids: urlParts{id, deviceStatus}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - status = &IPSecConnectionDeviceStatus{} - e = resp.unmarshal(status) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_ipsec_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_ipsec_test.go deleted file mode 100644 index c9bfac56eb..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_ipsec_test.go +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "os/exec" - "time" -) - -func getTestIPSecConnection() *IPSecConnection { - buff, _ := exec.Command("uuidgen").Output() - conn := &IPSecConnection{ - CompartmentID: "compartmentID", - CpeID: "cpeid", - DisplayName: "displayName", - DrgID: "drgid", - ID: string(buff), - State: ResourceUp, - StaticRoutes: []string{"route1", "route2", "route3"}, - TimeCreated: Time{Time: time.Now()}, - } - conn.ETag = "etag" - conn.RequestID = "requestid" - - return conn -} - -func (s *CoreTestSuite) TestCreateIPSecConnection() { - res := getTestIPSecConnection() - - opts := &CreateOptions{} - opts.DisplayName = res.DisplayName - - required := struct { - ocidRequirement - CpeID string `header:"-" json:"cpeId" url:"-"` - DrgID string `header:"-" json:"drgId" url:"-"` - StaticRoutes []string `header:"-" json:"staticRoutes" url:"-"` - }{ - CpeID: res.CpeID, - DrgID: res.DrgID, - StaticRoutes: res.StaticRoutes, - } - required.CompartmentID = res.CompartmentID - - details := &requestDetails{ - name: resourceIPSecConnections, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateIPSecConnection( - res.CompartmentID, - res.CpeID, - res.DrgID, - res.StaticRoutes, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetIPSecConnection() { - res := getTestIPSecConnection() - - details := &requestDetails{ - name: resourceIPSecConnections, - ids: urlParts{res.ID}, - } - - resp := &response{ - body: marshalObjectForTest(res), - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetIPSecConnection(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) -} - -func (s *CoreTestSuite) TestDeleteIPSecConnection() { - s.testDeleteResource(resourceIPSecConnections, "id", s.requestor.DeleteIPSecConnection) -} - -func (s *CoreTestSuite) TestListIPSecConnections() { - opts := &ListIPSecConnsOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - details := &requestDetails{ - name: resourceIPSecConnections, - optional: opts, - required: listOCIDRequirement{CompartmentID: "compartmentid"}, - } - - expected := []IPSecConnection{*getTestIPSecConnection()} - - headers := http.Header{} - headers.Set(headerOPCNextPage, "nextpage") - headers.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: headers, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListIPSecConnections("compartmentid", opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Connections)) -} - -func (s *CoreTestSuite) TestGetIPConnectionDeviceConfig() { - res := &IPSecConnectionDeviceConfig{ - OPCRequestIDUnmarshaller: OPCRequestIDUnmarshaller{ - RequestID: "requestid", - }, - IPSecConnectionDevice: IPSecConnectionDevice{ - CompartmentID: "compartmentId", - ID: "id", - TimeCreated: Time{Time: time.Now()}, - }, - Tunnels: []TunnelConfig{ - { - IPAddress: "10.10.10.2", - SharedSecret: "bobdobbs", - TimeCreated: Time{Time: time.Now()}, - }, - { - IPAddress: "10.10.10.3", - SharedSecret: "fsm", - TimeCreated: Time{Time: time.Now()}, - }, - }, - } - - details := &requestDetails{ - name: resourceIPSecConnections, - ids: urlParts{"id", deviceConfig}, - } - - resp := &response{body: marshalObjectForTest(res)} - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetIPSecConnectionDeviceConfig("id") - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal(len(res.Tunnels), len(actual.Tunnels)) - -} - -func (s *CoreTestSuite) TestGetIPConnectionDeviceStatus() { - res := &IPSecConnectionDeviceStatus{ - OPCRequestIDUnmarshaller: OPCRequestIDUnmarshaller{ - RequestID: "requestid", - }, - IPSecConnectionDevice: IPSecConnectionDevice{ - CompartmentID: "compartmentId", - ID: "id", - TimeCreated: Time{Time: time.Now()}, - }, - Tunnels: []TunnelStatus{ - { - IPAddress: "10.10.10.2", - State: ResourceUp, - TimeCreated: Time{Time: time.Now()}, - TimeStateModified: Time{Time: time.Now()}, - }, - { - IPAddress: "10.10.10.3", - State: ResourceDown, - TimeCreated: Time{Time: time.Now()}, - TimeStateModified: Time{Time: time.Now()}, - }, - }, - } - - details := &requestDetails{ - name: resourceIPSecConnections, - ids: urlParts{"id", deviceStatus}, - } - - resp := &response{body: marshalObjectForTest(res)} - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetIPSecConnectionDeviceStatus("id") - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal(len(res.Tunnels), len(actual.Tunnels)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_private_ip.go b/vendor/github.com/oracle/bmcs-go-sdk/core_private_ip.go deleted file mode 100644 index d2b409d636..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_private_ip.go +++ /dev/null @@ -1,111 +0,0 @@ -package baremetal - -import ( - "net/http" -) - -type PrivateIP struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - AvailabilityDomain string `json:"availabilityDomain"` - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - HostnameLabel string `json:"hostnameLabel"` - ID string `json:"id"` - IPAddress string `json:"ipAddress"` - IsPrimary bool `json:"isPrimary"` - SubnetID string `json:"subnetId"` - TimeCreated Time `json:"timeCreated"` - VnicID string `json:"vnicId"` -} - -type ListPrivateIPs struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - PrivateIPs []PrivateIP -} - -func (l *ListPrivateIPs) GetList() interface{} { - return &l.PrivateIPs -} - -func (c *Client) CreatePrivateIP(vnicID string, opts *CreatePrivateIPOptions) (privateIP *PrivateIP, e error) { - required := struct { - VnicId string `header:"-" json:"vnicId" url:"-"` - }{ - VnicId: vnicID, - } - - details := &requestDetails{ - name: resourcePrivateIPs, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - privateIP = &PrivateIP{} - e = resp.unmarshal(privateIP) - return -} - -func (c *Client) GetPrivateIP(id string) (privateIP *PrivateIP, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourcePrivateIPs, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - privateIP = &PrivateIP{} - e = resp.unmarshal(privateIP) - return -} - -func (c *Client) UpdatePrivateIP(id string, opts *UpdatePrivateIPOptions) (privateIP *PrivateIP, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourcePrivateIPs, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - privateIP = &PrivateIP{} - e = resp.unmarshal(privateIP) - return -} - -func (c *Client) DeletePrivateIP(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourcePrivateIPs, - optional: opts, - } - return c.coreApi.deleteRequest(details) -} - -func (c *Client) ListPrivateIPs(opts *ListPrivateIPsOptions) (privateIPs *ListPrivateIPs, e error) { - details := &requestDetails{ - name: resourcePrivateIPs, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - privateIPs = &ListPrivateIPs{} - e = resp.unmarshal(privateIPs) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_private_ip_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_private_ip_test.go deleted file mode 100644 index 0d9e46d8d3..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_private_ip_test.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestCreatePrivateIP() { - res := &PrivateIP{ - AvailabilityDomain: "availabilityDomain", - CompartmentID: "compartmentID", - DisplayName: "displayName", - HostnameLabel: "hostnameLabel", - ID: "id", - IPAddress: "ipAddress", - IsPrimary: false, - SubnetID: "subnetID", - TimeCreated: Time{Time: time.Now()}, - VnicID: "vnicID", - } - - opts := &CreatePrivateIPOptions{} - opts.DisplayName = res.DisplayName - opts.HostnameLabel = res.HostnameLabel - opts.IPAddress = res.IPAddress - - required := struct { - VnicId string `header:"-" json:"vnicId" url:"-"` - }{ - VnicId: res.VnicID, - } - - details := &requestDetails{ - name: resourcePrivateIPs, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreatePrivateIP( - res.VnicID, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetPrivateIP() { - res := &PrivateIP{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourcePrivateIPs, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetPrivateIP(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestUpdatePrivateIP() { - res := &PrivateIP{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - DisplayName: "displayName2", - HostnameLabel: "hostnameLabel2", - VnicID: "vnicID2", - } - - opts := &UpdatePrivateIPOptions{} - opts.DisplayNameOptions = DisplayNameOptions{DisplayName: res.DisplayName} - opts.IfMatchOptions = IfMatchOptions{IfMatch: "ETAG"} - opts.HostnameLabel = res.HostnameLabel - opts.VnicID = res.VnicID - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourcePrivateIPs, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdatePrivateIP(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal(res.DisplayName, actual.DisplayName) - s.Equal(res.HostnameLabel, actual.HostnameLabel) - s.Equal(res.VnicID, actual.VnicID) -} - -func (s *CoreTestSuite) TestDeletePrivateIP() { - s.testDeleteResource(resourcePrivateIPs, "id", s.requestor.DeletePrivateIP) -} - -func (s *CoreTestSuite) TestListPrivateIPs() { - opts := &ListPrivateIPsOptions{} - opts.Limit = 100 - opts.Page = "pageid" - opts.IPAddress = "ipAddress" - opts.SubnetID = "subnetId" - opts.VnicID = "vnicId" - - details := &requestDetails{ - name: resourcePrivateIPs, - optional: opts, - } - - created := Time{Time: time.Now()} - expected := []PrivateIP{ - { - ID: "id1", - DisplayName: "privateIP1", - TimeCreated: created, - }, - { - ID: "id2", - DisplayName: "PrivateIP2", - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListPrivateIPs(opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.PrivateIPs)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_route_table.go b/vendor/github.com/oracle/bmcs-go-sdk/core_route_table.go deleted file mode 100644 index 5ac5a91fd0..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_route_table.go +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -type RouteRule struct { - CidrBlock string `json:"cidrBlock"` - NetworkEntityID string `json:"networkEntityId"` -} - -// RouteTable describes a route table -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/RouteTable/ -type RouteTable struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - TimeModified Time `json:"timeModified"` - RouteRules []RouteRule `json:"routeRules"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - VcnID string `json:"vcnId"` -} - -// ListRouteTables contains a list of route tables -type ListRouteTables struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - RouteTables []RouteTable -} - -func (l *ListRouteTables) GetList() interface{} { - return &l.RouteTables -} - -// CreateRouteTable is used to create a route table -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/RouteTable/CreateRouteTable -func (c *Client) CreateRouteTable(compartmentID, vcnID string, routeRules []RouteRule, opts *CreateOptions) (res *RouteTable, e error) { - required := struct { - ocidRequirement - RouteRules []RouteRule `header:"-" json:"routeRules" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - RouteRules: routeRules, - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceRouteTables, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - res = &RouteTable{} - e = resp.unmarshal(res) - return -} - -// GetRouteTable is used to get information about a route table -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/RouteTable/GetRouteTable -func (c *Client) GetRouteTable(id string) (res *RouteTable, e error) { - details := &requestDetails{ - name: resourceRouteTables, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &RouteTable{} - e = resp.unmarshal(res) - return -} - -// UpdateRouteTable is used to update a route table -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/RouteTable/UpdateRouteTable -func (c *Client) UpdateRouteTable(id string, opts *UpdateRouteTableOptions) (res *RouteTable, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceRouteTables, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - res = &RouteTable{} - e = resp.unmarshal(res) - return -} - -// DeleteRouteTable is used to delete a route table -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/RouteTable/DeleteRouteTable -func (c *Client) DeleteRouteTable(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceRouteTables, - optional: opts, - } - - return c.coreApi.deleteRequest(details) -} - -// ListRouteTables is used to list route tables in a given compartment and vcn -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/RouteTable/ListRouteTables -func (c *Client) ListRouteTables(compartmentID, vcnID string, opts *ListOptions) (res *ListRouteTables, e error) { - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcnId"` - }{ - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceRouteTables, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &ListRouteTables{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_route_table_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_route_table_test.go deleted file mode 100644 index a7123b5565..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_route_table_test.go +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestCreateRouteTable() { - t := Time{Time: time.Now()} - rule := RouteRule{ - CidrBlock: "cidr_block", - NetworkEntityID: "network_entity_id", - } - - expectedResponse := &RouteTable{ - CompartmentID: "compartmentID", - DisplayName: "displayName", - ID: "id1", - TimeModified: t, - RouteRules: []RouteRule{rule}, - State: ResourceProvisioning, - TimeCreated: t, - VcnID: "vcn_id", - } - - opts := &CreateOptions{} - opts.DisplayName = expectedResponse.DisplayName - - required := struct { - ocidRequirement - RouteRules []RouteRule `header:"-" json:"routeRules" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - RouteRules: expectedResponse.RouteRules, - VcnID: "vcnID", - } - required.CompartmentID = "compartmentID" - - details := &requestDetails{ - name: resourceRouteTables, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(expectedResponse), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actualResponse, err := s.requestor.CreateRouteTable( - expectedResponse.CompartmentID, - "vcnID", - expectedResponse.RouteRules, - opts, - ) - - s.Nil(err) - s.NotNil(actualResponse) - s.Equal(expectedResponse.CompartmentID, actualResponse.CompartmentID) - s.Equal(expectedResponse.VcnID, actualResponse.VcnID) -} - -func (s *CoreTestSuite) TestGetRouteTable() { - expectedResponse := &RouteTable{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - VcnID: "vcn_id", - } - - details := &requestDetails{ - name: resourceRouteTables, - ids: urlParts{expectedResponse.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(expectedResponse), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actualResponse, e := s.requestor.GetRouteTable(expectedResponse.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actualResponse) - s.Equal(expectedResponse.ID, actualResponse.ID) - s.Equal(expectedResponse.VcnID, actualResponse.VcnID) - s.Equal("ETAG", actualResponse.ETag) -} - -func (s *CoreTestSuite) TestUpdateRouteTable() { - t := Time{Time: time.Now()} - rules := []RouteRule{ - { - CidrBlock: "cidr_block", - NetworkEntityID: "network_entity_id", - }, - } - - expectedResponse := &RouteTable{ - ID: "id", - RouteRules: rules, - TimeCreated: t, - VcnID: "vcn_id", - } - - opts := &UpdateRouteTableOptions{RouteRules: rules} - - details := &requestDetails{ - ids: urlParts{expectedResponse.ID}, - name: resourceRouteTables, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(expectedResponse), - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actualResponse, e := s.requestor.UpdateRouteTable(expectedResponse.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actualResponse) - s.Equal(1, len(actualResponse.RouteRules)) - s.Equal("cidr_block", actualResponse.RouteRules[0].CidrBlock) - s.Equal("ETAG!", actualResponse.ETag) - s.Equal(expectedResponse.VcnID, actualResponse.VcnID) -} - -func (s *CoreTestSuite) TestDeleteRouteTable() { - s.testDeleteResource(resourceRouteTables, "id", s.requestor.DeleteRouteTable) -} - -func (s *CoreTestSuite) TestListRouteTables() { - created := Time{Time: time.Now()} - compartmentID := "compartment_id" - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "page_id" - - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcnId"` - }{ - VcnID: "vcnId", - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceRouteTables, - optional: opts, - required: required, - } - - expectedResponse := []RouteTable{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "res1", - TimeCreated: created, - VcnID: "vcnId", - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "res2", - TimeCreated: created, - VcnID: "vcnId", - }, - } - - headers := http.Header{} - headers.Set(headerOPCNextPage, "nextpage") - headers.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: headers, - body: marshalObjectForTest(expectedResponse), - }, - nil, - ) - - actualResponse, e := s.requestor.ListRouteTables(compartmentID, "vcnId", opts) - s.Nil(e) - s.NotNil(actualResponse) - s.Equal(len(expectedResponse), len(actualResponse.RouteTables)) - s.Equal(expectedResponse[0].VcnID, actualResponse.RouteTables[0].VcnID) - s.Equal(expectedResponse[1].VcnID, actualResponse.RouteTables[1].VcnID) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_security_list.go b/vendor/github.com/oracle/bmcs-go-sdk/core_security_list.go deleted file mode 100644 index 762ec2a92e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_security_list.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// PortRange specifies a set of ports for UDPOptions or TCPOptions -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/PortRange/ -type PortRange struct { - Max uint64 `header:"-" json:"max" url:"-"` - Min uint64 `header:"-" json:"min" url:"-"` -} - -// UDPOptions specifies ports for a UDP rule -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/UdpOptions/ -type UDPOptions struct { - DestinationPortRange *PortRange `header:"-" json:"destinationPortRange" url:"-"` - SourcePortRange *PortRange `header:"-" json:"sourcePortRange" url:"-"` -} - -// TCPOptions specifies ports for a TCP rule -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/TcpOptions/ -type TCPOptions struct { - DestinationPortRange *PortRange `header:"-" json:"destinationPortRange" url:"-"` - SourcePortRange *PortRange `header:"-" json:"sourcePortRange" url:"-"` -} - -// ICMPOptions specifies a particular ICMP type and code -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IcmpOptions/ -type ICMPOptions struct { - Code uint64 `header:"-" json:"code,omitempty" url:"-"` - Type uint64 `header:"-" json:"type" url:"-"` -} - -// IngressSecurityRule is a rule for allowing inbound IP packets. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IngressSecurityRule/ -type IngressSecurityRule struct { - ICMPOptions *ICMPOptions `header:"-" json:"icmpOptions,omitempty" url:"-"` - Protocol string `header:"-" json:"protocol" url:"-"` - 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. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/EgressSecurityRule/ -type EgressSecurityRule struct { - Destination string `header:"-" json:"destination" url:"-"` - ICMPOptions *ICMPOptions `header:"-" json:"icmpOptions,omitempty" url:"-"` - Protocol string `header:"-" json:"protocol" url:"-"` - TCPOptions *TCPOptions `header:"-" json:"tcpOptions,omitempty" url:"-"` - UDPOptions *UDPOptions `header:"-" json:"udpOptions,omitempty" url:"-"` - IsStateless bool `header:"-" json:"isStateless" url:"-"` -} - -// SecurityList describes a set of virtual, stateful firewall rules for your VCN -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/SecurityList/ -type SecurityList struct { - ETagUnmarshaller - OPCRequestIDUnmarshaller - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - EgressSecurityRules []EgressSecurityRule `json:"egressSecurityRules"` - ID string `json:"id"` - IngressSecurityRules []IngressSecurityRule `json:"ingressSecurityRules"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - VcnID string `json:"vcnId"` -} - -// ListSecurityLists is the response from a ListSecurityLists() request -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/SecurityList/ListSecurityLists -type ListSecurityLists struct { - NextPageUnmarshaller - OPCRequestIDUnmarshaller - SecurityLists []SecurityList -} - -func (l *ListSecurityLists) GetList() interface{} { - return &l.SecurityLists -} - -// CreateSecurityList creates a new security list for the specified VCN -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/SecurityList/CreateSecurityList -func (c *Client) CreateSecurityList( - compartmentID, vcnID string, - egressRules []EgressSecurityRule, - ingressRules []IngressSecurityRule, - opts *CreateOptions, -) (res *SecurityList, e error) { - required := struct { - ocidRequirement - EgressRules []EgressSecurityRule `header:"-" json:"egressSecurityRules" url:"-"` - IngressRules []IngressSecurityRule `header:"-" json:"ingressSecurityRules" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - EgressRules: egressRules, - IngressRules: ingressRules, - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceSecurityLists, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - res = &SecurityList{} - e = resp.unmarshal(res) - return -} - -// GetSecurityList gets the specified security list's information -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/SecurityList/GetSecurityList -func (c *Client) GetSecurityList(id string) (res *SecurityList, e error) { - details := &requestDetails{ - name: resourceSecurityLists, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &SecurityList{} - e = resp.unmarshal(res) - return -} - -// UpdateSecurityList updates the specified security list's rules -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/SecurityList/UpdateSecurityList -func (c *Client) UpdateSecurityList( - id string, - opts *UpdateSecurityListOptions, -) (res *SecurityList, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceSecurityLists, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - res = &SecurityList{} - e = resp.unmarshal(res) - return -} - -// DeleteSecurityList deletes the specified security list, but only if it's not -// in use -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/SecurityList/DeleteSecurityList -func (c *Client) DeleteSecurityList(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceSecurityLists, - optional: opts, - } - return c.coreApi.deleteRequest(details) -} - -// ListSecurityLists gets a list of the security lists in the specified VCN and -// compartment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/SecurityList/ListSecurityLists -func (c *Client) ListSecurityLists(compartmentID, vcnID string, opts *ListOptions) (res *ListSecurityLists, e error) { - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcnId"` - }{ - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceSecurityLists, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &ListSecurityLists{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_security_list_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_security_list_test.go deleted file mode 100644 index 9acf49883c..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_security_list_test.go +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -var testSecurityList = SecurityList{ - CompartmentID: "compartmentID", - DisplayName: "displayName", - EgressSecurityRules: []EgressSecurityRule{ - { - Destination: "destination", - ICMPOptions: &ICMPOptions{ - Code: 0, - Type: 1, - }, - Protocol: "protocol", - TCPOptions: &TCPOptions{ - DestinationPortRange: &PortRange{Max: 2, Min: 1}, - SourcePortRange: &PortRange{Max: 4, Min: 3}, - }, - UDPOptions: &UDPOptions{ - DestinationPortRange: &PortRange{Max: 2, Min: 1}, - SourcePortRange: &PortRange{Max: 4, Min: 3}, - }, - }, - }, - ID: "id1", - IngressSecurityRules: []IngressSecurityRule{ - { - ICMPOptions: &ICMPOptions{ - Code: 0, - Type: 1, - }, - Protocol: "protocol", - Source: "source", - TCPOptions: &TCPOptions{ - DestinationPortRange: &PortRange{Max: 2, Min: 1}, - }, - UDPOptions: &UDPOptions{ - DestinationPortRange: &PortRange{Max: 2, Min: 1}, - }, - }, - }, - State: ResourceProvisioning, - TimeCreated: Time{Time: time.Now()}, - VcnID: "vcn_id", -} - -func (s *CoreTestSuite) TestCreateSecurityList() { - res := testSecurityList - - required := struct { - ocidRequirement - EgressRules []EgressSecurityRule `header:"-" json:"egressSecurityRules" url:"-"` - IngressRules []IngressSecurityRule `header:"-" json:"ingressSecurityRules" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - EgressRules: res.EgressSecurityRules, - IngressRules: res.IngressSecurityRules, - VcnID: res.VcnID, - } - required.CompartmentID = res.CompartmentID - - opts := &CreateOptions{} - opts.DisplayName = res.DisplayName - - details := &requestDetails{ - name: resourceSecurityLists, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateSecurityList( - res.CompartmentID, - res.VcnID, - res.EgressSecurityRules, - res.IngressSecurityRules, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetSecurityList() { - expected := &SecurityList{ID: "id", TimeCreated: Time{Time: time.Now()}} - - details := &requestDetails{ - name: resourceSecurityLists, - ids: urlParts{expected.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(expected), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetSecurityList(expected.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(expected.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestUpdateSecurityList() { - res := testSecurityList - - opts := &UpdateSecurityListOptions{} - opts.DisplayName = res.DisplayName - opts.EgressRules = res.EgressSecurityRules - opts.IngressRules = res.IngressSecurityRules - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceSecurityLists, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateSecurityList(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.DisplayName, actual.DisplayName) - s.Equal("ETAG!", actual.ETag) -} - -func (s *CoreTestSuite) TestDeleteSecurityList() { - s.testDeleteResource(resourceSecurityLists, "id", s.requestor.DeleteSecurityList) -} - -func (s *CoreTestSuite) TestListSecurityLists() { - compartmentID := "compartmentid" - - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcnId"` - }{ - VcnID: "vcn_id", - } - required.CompartmentID = compartmentID - - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - details := &requestDetails{ - name: resourceSecurityLists, - optional: opts, - required: required, - } - - res := testSecurityList - res2 := res - res2.ID = "id2" - - expected := []SecurityList{res, res2} - - headers := http.Header{} - headers.Set(headerOPCNextPage, "nextpage") - headers.Set(headerOPCRequestID, "requestid") - s.requestor.On("getRequest", details).Return( - &response{ - header: headers, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListSecurityLists(compartmentID, "vcn_id", opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.SecurityLists)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_shapes.go b/vendor/github.com/oracle/bmcs-go-sdk/core_shapes.go deleted file mode 100644 index 7c87b011e0..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_shapes.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -type Shape struct { - Name string `json:"shape"` -} - -// ListShapes contains a list of shapes as well as optional OPCNextPage which -// can be used to pass as the Page field of CoreOptions in subsequent List calls. -// In conjunction with Limit is used in paginating result. -// OPCRequestID is used to identify the request for support issues. -type ListShapes struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Shapes []Shape -} - -func (l *ListShapes) GetList() interface{} { - return &l.Shapes -} - -// ListShapes retrieves a list of shapes. compartmentID is a required parameter. -// Additional optional parameters may be assigned and passed in as options. -// These include AvailabilityDomain, Limit and Page for pagination support, and -// an ImageID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Shape/ListShapes -func (c *Client) ListShapes(compartmentID string, opts *ListShapesOptions) (shapes *ListShapes, e error) { - details := &requestDetails{ - name: resourceShapes, - optional: opts, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - shapes = &ListShapes{} - e = resp.unmarshal(shapes) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_shapes_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_shapes_test.go deleted file mode 100644 index ae8f0186e1..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_shapes_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *CoreTestSuite) TestListShapes() { - compartmentID := "compartmentid" - opts := &ListShapesOptions{} - opts.AvailabilityDomain = "domainid" - opts.ImageID = "imageid" - opts.Limit = 100 - opts.Page = "pageid" - - details := &requestDetails{ - name: resourceShapes, - optional: opts, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - expected := []Shape{ - {Name: "shape1"}, - {Name: "shape2"}, - } - - headers := http.Header{} - headers.Set(headerOPCNextPage, "nextpage") - headers.Set(headerOPCRequestID, "requestid") - s.requestor.On("getRequest", details).Return( - &response{ - header: headers, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListShapes(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Shapes)) - s.Equal("nextpage", actual.NextPage) - s.Equal("requestid", actual.RequestID) - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_subnet.go b/vendor/github.com/oracle/bmcs-go-sdk/core_subnet.go deleted file mode 100644 index 5610513c00..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_subnet.go +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// Subnet represents a network subnet -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Subnet/ -type Subnet struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - AvailabilityDomain string `json:"availabilityDomain"` - 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"` - SubnetDomainName string `json:"subnetDomainName"` - TimeCreated Time `json:"timeCreated"` - VcnID string `json:"vcnId"` - ProhibitPublicIpOnVnic bool `json:"prohibitPublicIpOnVnic"` - VirtualRouterIP string `json:"virtualRouterIp"` - VirtualRouterMac string `json:"virtualRouterMac"` -} - -// ListSubnets contains a list of Subnet -type ListSubnets struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Subnets []Subnet -} - -func (l *ListSubnets) GetList() interface{} { - return &l.Subnets -} - -// CreateSubnet will create a new subnet. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Subnet/CreateSubnet -func (c *Client) CreateSubnet( - availabilityDomain, - cidrBlock, - compartmentID, - vcnID string, - opts *CreateSubnetOptions, -) (sn *Subnet, e error) { - - required := struct { - ocidRequirement - AvailabilityDomain string `header:"-" json:"availabilityDomain" url:"-"` - CIDRBlock string `header:"-" json:"cidrBlock" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - AvailabilityDomain: availabilityDomain, - CIDRBlock: cidrBlock, - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceSubnets, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - sn = &Subnet{} - e = resp.unmarshal(sn) - return -} - -// GetSubnet will retrieve Subnet for subnetID -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Subnet/GetSubnet -func (c *Client) GetSubnet(id string) (subnet *Subnet, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceSubnets, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - subnet = &Subnet{} - e = resp.unmarshal(subnet) - return -} - -// UpdateSubnet updates the display name for the specified Subnet -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Subnet/UpdateSubnet -func (c *Client) UpdateSubnet(id string, opts *IfMatchDisplayNameOptions) (subnet *Subnet, e error) { - details := &requestDetails{ - name: resourceSubnets, - ids: urlParts{id}, - optional: opts, - } - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - subnet = &Subnet{} - e = resp.unmarshal(subnet) - - return -} - -// DeleteSubnet will delete a subnet with subnetID -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Subnet/DeleteSubnet -func (c *Client) DeleteSubnet(id string, opts *IfMatchOptions) error { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceSubnets, - optional: opts, - } - - return c.coreApi.deleteRequest(details) -} - -// ListSubnets returns a list of subnets in compartment for a virtual cloud network. -// The size of results may be limited by assigning values to the Limit field of -// Options. Results may be paged by assigning the NewPage from the last -// response to the Page member of Options. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Subnet/ListSubnets -func (c *Client) ListSubnets(compartmentID, vcnID string, opts *ListOptions) (subnets *ListSubnets, e error) { - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcn"` - }{ - VcnID: vcnID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceSubnets, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - subnets = &ListSubnets{} - e = resp.unmarshal(subnets) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_subnet_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_subnet_test.go deleted file mode 100644 index e782fd0f09..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_subnet_test.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "os/exec" - "time" -) - -func getTestSubnet() *Subnet { - buff, _ := exec.Command("uuidgen").Output() - sn := &Subnet{ - AvailabilityDomain: "availabilityDomain", - CompartmentID: "compartmentID", - CIDRBlock: "10.10.10.0/24", - DisplayName: "displayName", - ID: string(buff), - RouteTableID: "routetableid", - SecurityListIDs: []string{"id1", "id2"}, - State: ResourceAvailable, - TimeCreated: Time{Time: time.Now()}, - VcnID: "vcnid", - VirtualRouterIP: "routerid", - VirtualRouterMac: "routermac", - } - sn.ETag = "etag" - sn.RequestID = "requestid" - return sn -} - -func (s *CoreTestSuite) TestCreateSubnet() { - res := getTestSubnet() - - opts := &CreateSubnetOptions{} - opts.DisplayName = res.DisplayName - opts.RouteTableID = res.RouteTableID - opts.SecurityListIDs = res.SecurityListIDs - - required := struct { - ocidRequirement - AvailabilityDomain string `header:"-" json:"availabilityDomain" url:"-"` - CIDRBlock string `header:"-" json:"cidrBlock" url:"-"` - VcnID string `header:"-" json:"vcnId" url:"-"` - }{ - AvailabilityDomain: res.AvailabilityDomain, - CIDRBlock: res.CIDRBlock, - VcnID: res.VcnID, - } - required.CompartmentID = res.CompartmentID - - details := &requestDetails{ - name: resourceSubnets, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateSubnet( - res.AvailabilityDomain, - res.CIDRBlock, - res.CompartmentID, - res.VcnID, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetSubnet() { - res := getTestSubnet() - - details := &requestDetails{ - name: resourceSubnets, - ids: urlParts{res.ID}, - } - - resp := &response{body: marshalObjectForTest(res)} - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetSubnet(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) -} - -func (s *CoreTestSuite) TestDeleteSubnet() { - s.testDeleteResource(resourceSubnets, "id", s.requestor.DeleteSubnet) -} - -func (s *CoreTestSuite) TestListSubnets() { - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - required := struct { - listOCIDRequirement - VcnID string `header:"-" json:"-" url:"vcn"` - }{ - VcnID: "vcnID", - } - required.CompartmentID = "compartmentID" - - details := &requestDetails{ - name: resourceSubnets, - optional: opts, - required: required, - } - - expected := []Subnet{ - *getTestSubnet(), - *getTestSubnet(), - *getTestSubnet(), - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListSubnets("compartmentID", "vcnID", opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Subnets)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_test.go deleted file mode 100644 index ef990b1219..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "testing" - - "github.com/stretchr/testify/suite" -) - -type CoreTestSuite struct { - suite.Suite - requestor *mockRequestor - nilHeader http.Header -} - -func (s *CoreTestSuite) SetupTest() { - s.requestor = newMockRequestor(s) -} - -func TestRunCoreTests(t *testing.T) { - suite.Run(t, new(CoreTestSuite)) -} - -func (s *CoreTestSuite) testDeleteResource(name resourceName, id string, funcUnderTest func(string, *IfMatchOptions) error) { - option := &IfMatchOptions{IfMatch: "abcd"} - - details := &requestDetails{ - ids: urlParts{id}, - name: name, - optional: option, - } - s.requestor.On("deleteRequest", details).Return(nil) - - e := funcUnderTest(id, option) - s.requestor.AssertExpectations(s.T()) - s.Nil(e) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_virtual_network.go b/vendor/github.com/oracle/bmcs-go-sdk/core_virtual_network.go deleted file mode 100644 index 7fb4dc24c5..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_virtual_network.go +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" -) - -// VirtualNetwork describes virtual cloud network -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vcn/ -type VirtualNetwork struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CidrBlock string `json:"cidrBlock"` - CompartmentID string `json:"compartmentId"` - DefaultRouteTableID string `json:"defaultRouteTableId"` - DefaultSecurityListID string `json:"defaultSecurityListId"` - DefaultDHCPOptionsID string `json:"defaultDhcpOptionsId"` - DisplayName string `json:"displayName"` - DnsLabel string `json:"dnsLabel"` - ID string `json:"id"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - VcnDomainName string `json:"vcnDomainName"` -} - -// ListVirtualNetworks contains a list of virtual networks -// -type ListVirtualNetworks struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - VirtualNetworks []VirtualNetwork -} - -func (l *ListVirtualNetworks) GetList() interface{} { - return &l.VirtualNetworks -} - -// CreateVirtualNetwork is used to create a virtual network -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vcn/CreateVcn -func (c *Client) CreateVirtualNetwork(cidrBlock, compartmentID string, opts *CreateVcnOptions) (vcn *VirtualNetwork, e error) { - required := struct { - ocidRequirement - CidrBlock string `header:"-" json:"cidrBlock,omitempty" url:"-"` - }{ - CidrBlock: cidrBlock, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceVirtualNetworks, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - vcn = &VirtualNetwork{} - e = resp.unmarshal(vcn) - return -} - -// GetVirtualNetwork retrieves information about a virtual network -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vcn/GetVcn -func (c *Client) GetVirtualNetwork(id string) (vcn *VirtualNetwork, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVirtualNetworks, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - vcn = &VirtualNetwork{} - e = resp.unmarshal(vcn) - return -} - -// UpdateVirtualNetwork updates information about a virtual network -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vcn/UpdateVcn -func (c *Client) UpdateVirtualNetwork(id string, opts *IfMatchDisplayNameOptions) (vcn *VirtualNetwork, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVirtualNetworks, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - vcn = &VirtualNetwork{} - e = resp.unmarshal(vcn) - return -} - -// DeleteVirtualNetwork removes a virtual network -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vcn/DeleteVcn -func (c *Client) DeleteVirtualNetwork(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVirtualNetworks, - optional: opts, - } - return c.coreApi.deleteRequest(details) -} - -// ListVirtualNetworks returns a list of virtual networks for a particular -// compartment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vcn/ListVcns -func (c *Client) ListVirtualNetworks(compartmentID string, opts *ListOptions) (vcns *ListVirtualNetworks, e error) { - details := &requestDetails{ - name: resourceVirtualNetworks, - optional: opts, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - vcns = &ListVirtualNetworks{} - e = resp.unmarshal(vcns) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_virtual_network_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_virtual_network_test.go deleted file mode 100644 index 02ae4dc3d8..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_virtual_network_test.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestCreateVirtualNetwork() { - res := &VirtualNetwork{ - CidrBlock: "cidrBlock", - CompartmentID: "compartmentID", - DefaultRouteTableID: "defaultRouteTableId", - DefaultSecurityListID: "defaultSecurityListId", - DisplayName: "displayName", - DnsLabel: "dnsLabel", - ID: "id1", - State: ResourceProvisioning, - TimeCreated: Time{Time: time.Now()}, - VcnDomainName: "vcnDomainName", - } - - opts := &CreateVcnOptions{} - opts.DisplayName = res.DisplayName - opts.DnsLabel = res.DnsLabel - - required := struct { - ocidRequirement - CidrBlock string `header:"-" json:"cidrBlock,omitempty" url:"-"` - }{ - CidrBlock: res.CidrBlock, - } - required.CompartmentID = res.CompartmentID - - details := &requestDetails{ - name: resourceVirtualNetworks, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateVirtualNetwork( - res.CidrBlock, - res.CompartmentID, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetVirtualNetwork() { - res := &VirtualNetwork{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceVirtualNetworks, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetVirtualNetwork(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestUpdateVirtualNetwork() { - res := &VirtualNetwork{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - DisplayName: "displayName", - } - - opts := &IfMatchDisplayNameOptions{ - DisplayNameOptions: DisplayNameOptions{DisplayName: res.DisplayName}, - IfMatchOptions: IfMatchOptions{IfMatch: "ETAG"}, - } - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceVirtualNetworks, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateVirtualNetwork(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal(res.DisplayName, actual.DisplayName) -} - -func (s *CoreTestSuite) TestDeleteVirtualNetwork() { - s.testDeleteResource(resourceVirtualNetworks, "id", s.requestor.DeleteVirtualNetwork) -} - -func (s *CoreTestSuite) TestListVirtualNetworks() { - compartmentID := "compartmentid" - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - details := &requestDetails{ - name: resourceVirtualNetworks, - optional: opts, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - created := Time{Time: time.Now()} - expected := []VirtualNetwork{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "vcn1", - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "vcn2", - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListVirtualNetworks(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.VirtualNetworks)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_vnic.go b/vendor/github.com/oracle/bmcs-go-sdk/core_vnic.go deleted file mode 100644 index af046feb13..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_vnic.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// Vnic describes a virtual network interface. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vnic/ -type Vnic struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - AvailabilityDomain string `json:"availabilityDomain"` - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - HostnameLabel string `json:"hostnameLabel"` - ID string `json:"id"` - IsPrimary bool `json:"isPrimary"` - MacAddress string `json:"macAddress"` - State string `json:"lifecycleState"` - PrivateIPAddress string `json:"privateIp"` - PublicIPAddress string `json:"publicIp"` - SkipSourceDestCheck bool `json:"skipSourceDestCheck"` - SubnetID string `json:"subnetId"` - TimeCreated Time `json:"timeCreated"` -} - -// GetVnic retrieves information about a virtual network interface identified -// by vnicID. ListVnicAttachments can be used to retrieve Vnic IDs. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vnic/GetVnic -func (c *Client) GetVnic(id string) (vnic *Vnic, e error) { - details := &requestDetails{ - name: resourceVnics, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - vnic = &Vnic{} - e = resp.unmarshal(vnic) - return -} - -// UpdateVnic updates the specified VNIC. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Vnic/UpdateVnic -func (c *Client) UpdateVnic(id string, opts *UpdateVnicOptions) (res *Vnic, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVnics, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - res = &Vnic{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_vnic_attachments.go b/vendor/github.com/oracle/bmcs-go-sdk/core_vnic_attachments.go deleted file mode 100644 index 04615cec3e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_vnic_attachments.go +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "time" - -// VnicAttachment Vnic information for a particular instance -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VnicAttachment/ -type VnicAttachment struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - AvailabilityDomain string `json:"availabilityDomain"` - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - InstanceID string `json:"instanceId"` - State string `json:"lifecycleState"` - SubnetID string `json:"subnetId"` - TimeCreated time.Time `json:"TimeCreated"` - VlanTag int `json:"vlanTag"` - VnicID string `json:"vnicId"` -} - -// ListVnicAttachments list of VnicAttachments as well as optional OPCNextPage which -// can be used to pass as the Page field of CoreOptions in subsequent List calls. -// In conjunction with Limit is used in paginating results. -// OPCRequestID is used to identify the request for support issues. -type ListVnicAttachments struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Attachments []VnicAttachment -} - -func (l *ListVnicAttachments) GetList() interface{} { - return &l.Attachments -} - -// ListVnicAttachments returns a list of VnicAttachments with matching compartmentID -// and optionally instanceId, vnicId, and/or availabilityDomain. Optional parameters -// are assigned to the optional CoreOptions argument. Page and Limit can also -// be supplied to support pagination. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VnicAttachment/ListVnicAttachments -func (c *Client) ListVnicAttachments(compartmentID string, opts *ListVnicAttachmentsOptions) (res *ListVnicAttachments, e error) { - details := &requestDetails{ - name: resourceVnicAttachments, - optional: opts, - required: ocidRequirement{compartmentID}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &ListVnicAttachments{} - e = resp.unmarshal(res) - return -} - -// GetVnicAttachment gets information about the specified VNIC attachment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VnicAttachment/GetVnicAttachment -func (c *Client) GetVnicAttachment(id string) (res *VnicAttachment, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVnicAttachments, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &VnicAttachment{} - e = resp.unmarshal(res) - return -} - -// AttachVnic will create a new VnicAttachment and Vnic. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VnicAttachment/AttachVnic -func (c *Client) AttachVnic( - instanceId string, - vnicOpts *CreateVnicOptions, - attachmentOpts *AttachVnicOptions, -) (va *VnicAttachment, e error) { - - required := struct { - InstanceId string `header:"-" json:"instanceId" url:"-"` - CreateVnicDetails *CreateVnicOptions `header:"-" json:"createVnicDetails" url:"-"` - }{ - InstanceId: instanceId, - CreateVnicDetails: vnicOpts, - } - - details := &requestDetails{ - name: resourceVnicAttachments, - optional: attachmentOpts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - va = &VnicAttachment{} - e = resp.unmarshal(va) - return -} - -// DetachVnic detaches and deletes the specified secondary VNIC. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VnicAttachment/DetachVnic -func (c *Client) DetachVnic(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVnicAttachments, - optional: opts, - } - - return c.coreApi.deleteRequest(details) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_vnic_attachments_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_vnic_attachments_test.go deleted file mode 100644 index 57d5b38bca..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_vnic_attachments_test.go +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestListVnicAttachments() { - compartmentID := "compartmentid" - opts := &ListVnicAttachmentsOptions{} - opts.AvailabilityDomain = "domainid" - opts.VnicID = "vnicid" - opts.InstanceID = "instanceid" - opts.Limit = 100 - opts.Page = "pageid" - - details := &requestDetails{ - name: resourceVnicAttachments, - optional: opts, - required: ocidRequirement{compartmentID}, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - expected := []VnicAttachment{ - { - AvailabilityDomain: opts.AvailabilityDomain, - CompartmentID: compartmentID, - DisplayName: "name1", - ID: "id1", - InstanceID: "my_instance_id", - State: ResourceAttached, - SubnetID: "subnetid", - TimeCreated: time.Now(), - VlanTag: 0, - VnicID: opts.VnicID, - }, - { - AvailabilityDomain: opts.AvailabilityDomain, - CompartmentID: compartmentID, - DisplayName: "name2", - ID: "id2", - InstanceID: "my_instance_id", - State: ResourceAttached, - SubnetID: "subnetid", - TimeCreated: time.Now(), - VlanTag: 1, - VnicID: opts.VnicID, - }, - } - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListVnicAttachments(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Attachments)) - s.Equal("nextpage", actual.NextPage) - s.Equal("requestid", actual.RequestID) - s.Equal("name1", actual.Attachments[0].DisplayName) - s.Equal("name2", actual.Attachments[1].DisplayName) -} - -func (s *CoreTestSuite) TestAttachVnic() { - instanceId := "my_instance_id" - - res := &VnicAttachment{ - AvailabilityDomain: "my_ad", - CompartmentID: "my_compartment", - DisplayName: "name1", - ID: "id1", - InstanceID: instanceId, - State: ResourceAttached, - SubnetID: "subnetid", - TimeCreated: time.Now(), - VlanTag: 0, - VnicID: "my_vnic", - } - - vnicOpts := &CreateVnicOptions{} - assignPublicIp := true - skipSourceDestCheck := false - vnicOpts.AssignPublicIp = &assignPublicIp - vnicOpts.SkipSourceDestCheck = &skipSourceDestCheck - attachmentOpts := &AttachVnicOptions{} - - required := struct { - InstanceId string `header:"-" json:"instanceId" url:"-"` - CreateVnicDetails *CreateVnicOptions `header:"-" json:"createVnicDetails" url:"-"` - }{ - InstanceId: instanceId, - CreateVnicDetails: vnicOpts, - } - - details := &requestDetails{ - name: resourceVnicAttachments, - optional: attachmentOpts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.AttachVnic( - instanceId, - vnicOpts, - attachmentOpts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) - s.Equal(instanceId, actual.InstanceID) - s.Equal(ResourceAttached, actual.State) -} - -func (s *CoreTestSuite) TestGetVnicAttachment() { - instanceId := "my_instance_id" - - res := &VnicAttachment{ - AvailabilityDomain: "my_ad", - CompartmentID: "my_compartment", - DisplayName: "name1", - ID: "id1", - InstanceID: instanceId, - State: ResourceAttached, - SubnetID: "subnetid", - TimeCreated: time.Now(), - VlanTag: 0, - VnicID: "my_vnic", - } - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceVnicAttachments, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, err := s.requestor.GetVnicAttachment(res.ID) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) - s.Equal(instanceId, actual.InstanceID) - s.Equal(ResourceAttached, actual.State) -} - -func (s *CoreTestSuite) TestDetachVnic() { - s.testDeleteResource(resourceVnicAttachments, "id", s.requestor.DetachVnic) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_vnic_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_vnic_test.go deleted file mode 100644 index 55ad92546b..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_vnic_test.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestGetVnic() { - vnicID := "vnicid" - res := &Vnic{ - AvailabilityDomain: "availabilitydomain", - CompartmentID: "compartmentid", - DisplayName: "displayname", - ID: vnicID, - IsPrimary: true, - MacAddress: "00:00:17:B6:4D:DD", - State: ResourceAvailable, - PrivateIPAddress: "10.10.10.10", - PublicIPAddress: "54.55.56.57", - SkipSourceDestCheck: false, - SubnetID: "subnetid", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - name: resourceVnics, - ids: urlParts{res.ID}, - } - - resp := &response{body: marshalObjectForTest(res)} - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetVnic(vnicID) - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal(res.PublicIPAddress, actual.PublicIPAddress) - s.Equal(res.PrivateIPAddress, actual.PrivateIPAddress) -} - -func (s *CoreTestSuite) TestUpdateVnic() { - vnicID := "vnicid" - res := &Vnic{ - AvailabilityDomain: "availabilitydomain", - CompartmentID: "compartmentid", - DisplayName: "displayname", - ID: vnicID, - IsPrimary: true, - MacAddress: "00:00:17:B6:4D:DD", - State: ResourceAvailable, - PrivateIPAddress: "10.10.10.10", - PublicIPAddress: "54.55.56.57", - SkipSourceDestCheck: true, - SubnetID: "subnetid", - TimeCreated: Time{Time: time.Now()}, - } - - opts := &UpdateVnicOptions{} - opts.DisplayNameOptions = DisplayNameOptions{DisplayName: res.DisplayName} - skipSourceDestCheck := res.SkipSourceDestCheck - opts.SkipSourceDestCheck = &skipSourceDestCheck - opts.IfMatchOptions = IfMatchOptions{IfMatch: "my_tag"} - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceVnics, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "my_tag_update") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateVnic(vnicID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal(res.PublicIPAddress, actual.PublicIPAddress) - s.Equal(res.PrivateIPAddress, actual.PrivateIPAddress) - s.Equal(res.SkipSourceDestCheck, actual.SkipSourceDestCheck) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_volume.go b/vendor/github.com/oracle/bmcs-go-sdk/core_volume.go deleted file mode 100644 index 2f24bf0a37..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_volume.go +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// Volume describes cloud block storage -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Volume/ -type Volume struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - VolumeSourceDetails *VolumeSourceDetails `json:"sourceDetails,omitempty"` - AvailabilityDomain string `json:"availabilityDomain"` - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - IsHydrated bool `json:"isHydrated"` - SizeInMBs int `json:"sizeInMBs"` - SizeInGBs int `json:"sizeInGBs"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` -} - -// ListVolumes contains a list of block volumes -// -type ListVolumes struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Volumes []Volume -} - -func (l *ListVolumes) GetList() interface{} { - return &l.Volumes -} - -// CreateVolume is used to create a cloud block storage device -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Volume/CreateVolume -func (c *Client) CreateVolume(availabilityDomain, compartmentID string, opts *CreateVolumeOptions) (res *Volume, e error) { - required := struct { - ocidRequirement - AvailabilityDomain string `header:"-" json:"availabilityDomain" url:"-"` - }{ - AvailabilityDomain: availabilityDomain, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceVolumes, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - res = &Volume{} - e = resp.unmarshal(res) - return -} - -// GetVolume retrieves information about a block volume -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Volume/GetVolume -func (c *Client) GetVolume(id string) (res *Volume, e error) { - details := &requestDetails{ - name: resourceVolumes, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &Volume{} - e = resp.unmarshal(res) - return -} - -// UpdateVolume updates a volume's display name -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Volume/UpdateVolume -func (c *Client) UpdateVolume(id string, opts *UpdateOptions) (res *Volume, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVolumes, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - res = &Volume{} - e = resp.unmarshal(res) - return -} - -// DeleteVolume removes a cloud block storage volume -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Volume/DeleteVolume -func (c *Client) DeleteVolume(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVolumes, - optional: opts, - } - - return c.coreApi.deleteRequest(details) -} - -// ListVolumes returns a list of volumes for a particular compartment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Volume/ListVolumes -func (c *Client) ListVolumes(compartmentID string, opts *ListVolumesOptions) (res *ListVolumes, e error) { - details := &requestDetails{ - name: resourceVolumes, - optional: opts, - required: ocidRequirement{compartmentID}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &ListVolumes{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_attachment.go b/vendor/github.com/oracle/bmcs-go-sdk/core_volume_attachment.go deleted file mode 100644 index c41e832a28..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_attachment.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// VolumeAttachment describes a cloud block storage attachment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeAttachment/ -type VolumeAttachment struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - AttachmentType string `json:"attachmentType"` - AvailabilityDomain string `json:"availabilityDomain"` - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - InstanceID string `json:"instanceId"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - VolumeID string `json:"volumeId"` - // IScsiVolumeAttachment extended attributes - // See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/IScsiVolumeAttachment/ - CHAPSecret string `json:"chapSecret,omitempty"` - CHAPUsername string `json:"chapUsername,omitempty"` - IPv4 string `json:"ipv4,omitempty"` - IQN string `json:"iqn,omitempty"` // iSCSI Qualified Name per RFC 3720 - Port int `json:"port,omitempty"` -} - -// ListVolumeAttachments contains a list of volume attachments -// -type ListVolumeAttachments struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - VolumeAttachments []VolumeAttachment -} - -func (l *ListVolumeAttachments) GetList() interface{} { - return &l.VolumeAttachments -} - -//AttachVolume attaches a storage volume to the specified instance -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeAttachment/AttachVolume -func (c *Client) AttachVolume(attachmentType, instanceID, volumeID string, opts *CreateOptions) (res *VolumeAttachment, e error) { - required := struct { - AttachmentType string `header:"-" json:"type" url:"-"` - InstanceID string `header:"-" json:"instanceId" url:"-"` - VolumeID string `header:"-" json:"volumeId" url:"-"` - }{ - AttachmentType: attachmentType, - InstanceID: instanceID, - VolumeID: volumeID, - } - - details := &requestDetails{ - name: resourceVolumeAttachments, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - res = &VolumeAttachment{} - e = resp.unmarshal(res) - return -} - -// GetVolumeAttachment gets information about the specified volume attachment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeAttachment/GetVolumeAttachment -func (c *Client) GetVolumeAttachment(id string) (res *VolumeAttachment, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVolumeAttachments, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &VolumeAttachment{} - e = resp.unmarshal(res) - return -} - -// DetachVolume detaches a storage volume from the specified instance -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Volume/DetachVolume -func (c *Client) DetachVolume(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVolumeAttachments, - optional: opts, - } - - return c.coreApi.deleteRequest(details) -} - -// ListVolumeAttachments gets a list of the volume attachments in the specified -// compartment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeAttachment/ListVolumeAttachments -func (c *Client) ListVolumeAttachments(compartmentID string, opts *ListVolumeAttachmentsOptions) (res *ListVolumeAttachments, e error) { - details := &requestDetails{ - name: resourceVolumeAttachments, - optional: opts, - required: ocidRequirement{compartmentID}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - res = &ListVolumeAttachments{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_attachment_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_volume_attachment_test.go deleted file mode 100644 index 08208719e2..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_attachment_test.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestAttachVolume() { - res := &VolumeAttachment{ - AttachmentType: "attachmentType", - AvailabilityDomain: "availabilityDomain", - CompartmentID: "compartmentID", - DisplayName: "displayName", - ID: "id1", - InstanceID: "instance", - State: ResourceProvisioning, - TimeCreated: Time{Time: time.Now()}, - VolumeID: "volumeID", - } - - opts := &CreateOptions{} - opts.DisplayName = res.DisplayName - - required := struct { - AttachmentType string `header:"-" json:"type" url:"-"` - InstanceID string `header:"-" json:"instanceId" url:"-"` - VolumeID string `header:"-" json:"volumeId" url:"-"` - }{ - AttachmentType: res.AttachmentType, - InstanceID: res.InstanceID, - VolumeID: res.VolumeID, - } - - details := &requestDetails{ - name: resourceVolumeAttachments, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.AttachVolume( - res.AttachmentType, - res.InstanceID, - res.VolumeID, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetVolumeAttachment() { - res := &VolumeAttachment{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceVolumeAttachments, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetVolumeAttachment(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestDetachVolumet() { - s.testDeleteResource(resourceVolumeAttachments, "id", s.requestor.DetachVolume) -} - -func (s *CoreTestSuite) TestListVolumeAttachments() { - compartmentID := "compartmentid" - - opts := &ListVolumeAttachmentsOptions{} - opts.AvailabilityDomain = "availability_domain" - opts.Limit = 100 - opts.Page = "page" - opts.InstanceID = "instance_id" - opts.VolumeID = "volume_id" - - details := &requestDetails{ - name: resourceVolumeAttachments, - optional: opts, - required: ocidRequirement{compartmentID}, - } - - created := Time{Time: time.Now()} - expected := []VolumeAttachment{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "vol1", - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "vol2", - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListVolumeAttachments(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.VolumeAttachments)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_backup.go b/vendor/github.com/oracle/bmcs-go-sdk/core_volume_backup.go deleted file mode 100644 index 583e3d8138..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_backup.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -// VolumeBackup describe a point-in-time copy of a volume -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeBackup/ -type VolumeBackup struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - SizeInMBs uint64 `json:"sizeInMBs"` - SizeInGBs uint64 `json:"sizeInGBs"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - TimeRequestReceived Time `json:"timeRequestReceived"` - UniqueSizeInMBs uint64 `json:"uniqueSizeInMBs"` - UniqueSizeInGBs uint64 `json:"uniqueSizeInGBs"` - VolumeID string `json:"volumeId"` -} - -// ListVolumeBackups contains a list of volume backups -// -type ListVolumeBackups struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - VolumeBackups []VolumeBackup -} - -func (l *ListVolumeBackups) GetList() interface{} { - return &l.VolumeBackups -} - -// CreateVolumeBackup Creates a new backup of the specified volume -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeBackup/CreateVolumeBackup -func (c *Client) CreateVolumeBackup(volumeID string, opts *CreateOptions) (vol *VolumeBackup, e error) { - required := struct { - VolumeID string `header:"-" json:"volumeId" url:"-"` - }{ - VolumeID: volumeID, - } - - details := &requestDetails{ - name: resourceVolumeBackups, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.coreApi.postRequest(details); e != nil { - return - } - - vol = &VolumeBackup{} - e = resp.unmarshal(vol) - return -} - -// GetVolumeBackup gets information for the specified volumeBackup -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeBackup/GetVolumeBackup -func (c *Client) GetVolumeBackup(id string) (vol *VolumeBackup, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVolumeBackups, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - vol = &VolumeBackup{} - e = resp.unmarshal(vol) - return -} - -// UpdateVolumeBackup updates a volume's display name -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeBackup/UpdateVolumeBackup -func (c *Client) UpdateVolumeBackup(id string, opts *IfMatchDisplayNameOptions) (vol *VolumeBackup, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVolumeBackups, - optional: opts, - } - - var resp *response - if resp, e = c.coreApi.request(http.MethodPut, details); e != nil { - return - } - - vol = &VolumeBackup{} - e = resp.unmarshal(vol) - return -} - -// DeleteVolumeBackup deletes a volumeBackup -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeBackup/DeleteVolumeBackup -func (c *Client) DeleteVolumeBackup(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceVolumeBackups, - optional: opts, - } - - return c.coreApi.deleteRequest(details) -} - -// ListVolumeBackups returns a list of volumes for a particular compartment -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeBackup/ListVolumeBackups -func (c *Client) ListVolumeBackups(compartmentID string, opts *ListBackupsOptions) (vols *ListVolumeBackups, e error) { - details := &requestDetails{ - name: resourceVolumeBackups, - optional: opts, - required: ocidRequirement{compartmentID}, - } - - var resp *response - if resp, e = c.coreApi.getRequest(details); e != nil { - return - } - - vols = &ListVolumeBackups{} - e = resp.unmarshal(vols) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_backup_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_volume_backup_test.go deleted file mode 100644 index 25c5bf4290..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_backup_test.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestCreateVolumeBackup() { - res := &VolumeBackup{ - CompartmentID: "compartmentID", - DisplayName: "displayName", - ID: "id1", - SizeInGBs: 50, - State: ResourceProvisioning, - TimeCreated: Time{Time: time.Now()}, - TimeRequestReceived: Time{Time: time.Now()}, - UniqueSizeInGBs: 49, - VolumeID: "volumd_id", - } - - opts := &CreateOptions{} - opts.DisplayName = res.DisplayName - - required := struct { - VolumeID string `header:"-" json:"volumeId" url:"-"` - }{ - VolumeID: res.VolumeID, - } - - details := &requestDetails{ - name: resourceVolumeBackups, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateVolumeBackup(res.VolumeID, opts) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetVolumeBackup() { - res := &VolumeBackup{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceVolumeBackups, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetVolumeBackup(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestUpdateVolumeBackup() { - res := &VolumeBackup{ - ID: "id", - DisplayName: "displayName", - TimeCreated: Time{Time: time.Now()}, - } - - opts := &IfMatchDisplayNameOptions{} - opts.DisplayName = res.DisplayName - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceVolumeBackups, - optional: opts, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateVolumeBackup(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.DisplayName, actual.DisplayName) - s.Equal("ETAG!", actual.ETag) -} - -func (s *CoreTestSuite) TestDeleteVolumeBackup() { - s.testDeleteResource(resourceVolumeBackups, "id", s.requestor.DeleteVolumeBackup) -} - -func (s *CoreTestSuite) TestListVolumeBackups() { - compartmentID := "compartmentid" - - opts := &ListBackupsOptions{} - opts.Limit = 100 - opts.Page = "pageid" - opts.VolumeID = "volume_id" - - details := &requestDetails{ - name: resourceVolumeBackups, - optional: opts, - required: ocidRequirement{compartmentID}, - } - - created := Time{Time: time.Now()} - expected := []VolumeBackup{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "vol1", - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "vol2", - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListVolumeBackups(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.VolumeBackups)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_test.go b/vendor/github.com/oracle/bmcs-go-sdk/core_volume_test.go deleted file mode 100644 index 6979dd7445..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/core_volume_test.go +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *CoreTestSuite) TestCreateVolume() { - res := &Volume{ - AvailabilityDomain: "availabilityDomain", - CompartmentID: "compartmentID", - DisplayName: "displayName", - ID: "id1", - SizeInGBs: 50, - State: ResourceProvisioning, - TimeCreated: Time{Time: time.Now()}, - } - - opts := &CreateVolumeOptions{} - opts.DisplayName = res.DisplayName - - required := struct { - ocidRequirement - AvailabilityDomain string `header:"-" json:"availabilityDomain" url:"-"` - }{ - AvailabilityDomain: res.AvailabilityDomain, - } - required.CompartmentID = res.CompartmentID - - details := &requestDetails{ - name: resourceVolumes, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(res), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateVolume( - res.AvailabilityDomain, - res.CompartmentID, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *CoreTestSuite) TestGetVolume() { - res := &Volume{ - ID: "id", - TimeCreated: Time{Time: time.Now()}, - } - - details := &requestDetails{ - name: resourceVolumes, - ids: urlParts{res.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetVolume(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *CoreTestSuite) TestUpdateVolume() { - res := &Volume{ - ID: "id", - DisplayName: "displayName", - TimeCreated: Time{Time: time.Now()}, - } - - opts := &UpdateOptions{} - opts.DisplayName = res.DisplayName - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceVolumes, - optional: opts, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateVolume(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.DisplayName, actual.DisplayName) - s.Equal("ETAG!", actual.ETag) -} - -func (s *CoreTestSuite) TestDeleteVolume() { - s.testDeleteResource(resourceVolumes, "id", s.requestor.DeleteVolume) -} - -func (s *CoreTestSuite) TestListVolumes() { - compartmentID := "compartmentid" - opts := &ListVolumesOptions{} - opts.Limit = 100 - opts.Page = "pageid" - - details := &requestDetails{ - name: resourceVolumes, - optional: opts, - required: ocidRequirement{compartmentID}, - } - - created := Time{Time: time.Now()} - expected := []Volume{ - { - ID: "id1", - CompartmentID: compartmentID, - DisplayName: "vol1", - TimeCreated: created, - }, - { - ID: "id2", - CompartmentID: compartmentID, - DisplayName: "vol2", - TimeCreated: created, - }, - } - - responseHeaders := http.Header{} - responseHeaders.Set(headerOPCNextPage, "nextpage") - responseHeaders.Set(headerOPCRequestID, "requestid") - - s.requestor.On("getRequest", details).Return( - &response{ - header: responseHeaders, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListVolumes(compartmentID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.Volumes)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_database.go b/vendor/github.com/oracle/bmcs-go-sdk/database_database.go deleted file mode 100644 index 07ad1dcd7d..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_database.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "time" - -type Database struct { - ETagUnmarshaller - OPCRequestIDUnmarshaller - ocidRequirement - CharacterSet string `json:"characterSet"` - DBHomeID string `json:"dbHomeId"` - DBName string `json:"dbName"` - DBUniqueName string `json:"dbUniqueName"` - DBWorkload string `json:"dbWorkload"` - ID string `json:"id"` - LifecycleDetails string `json:"lifecycleDetails"` - NcharacterSet string `json:"ncharacterSet"` - PDBName string `json:"pdbName"` - State string `json:"lifecycleState"` - TimeCreated time.Time `json:"timeCreated"` -} - -type ListDatabases struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Databases []Database -} - -func (l *ListDatabases) GetList() interface{} { - return &l.Databases -} - -// GetDatabase retrieves information about a Database -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/Database/GetDatabase -func (c *Client) GetDatabase(id string) (res *Database, e error) { - details := &requestDetails{ - name: resourceDatabases, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - res = &Database{} - e = resp.unmarshal(res) - return -} - -// ListDatabases returns a list of supported Oracle database versions. The request MAY contain optional paging arguments. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/Database/ListDatabases -func (c *Client) ListDatabases(compartmentID, dbHomeID string, limit uint64, opts *PageListOptions) (resources *ListDatabases, e error) { - required := struct { - listOCIDRequirement - DBHomeID string `header:"-" json:"-" url:"dbHomeId"` - Limit uint64 `header:"-" json:"-" url:"limit"` - }{ - DBHomeID: dbHomeID, - Limit: limit, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDatabases, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - resources = &ListDatabases{} - e = resp.unmarshal(resources) - return -} - -type CreateDatabaseDetails struct { - AdminPassword string `header:"-" json:"adminPassword" url:"-"` - DBName string `header:"-" json:"dbName" url:"-"` - DBWorkload string `header:"-" json:"dbWorkload,omitempty" url:"-"` - CharacterSet string `header:"-" json:"characterSet,omitempty" url:"-"` - NCharacterSet string `header:"-" json:"ncharacterSet,omitempty" url:"-"` - PDBName string `header:"-" json:"pdbName,omitempty" url:"-"` -} - -func NewCreateDatabaseDetails(adminPassword, dbName string, opts *CreateDatabaseOptions) (db CreateDatabaseDetails) { - db = CreateDatabaseDetails{ - AdminPassword: adminPassword, - DBName: dbName, - } - if opts != nil { - if opts.DBWorkload != "" { - db.DBWorkload = opts.DBWorkload - } - if opts.CharacterSet != "" { - db.CharacterSet = opts.CharacterSet - } - if opts.NCharacterSet != "" { - db.NCharacterSet = opts.NCharacterSet - } - if opts.PDBName != "" { - db.PDBName = opts.PDBName - } - } - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_database_test.go b/vendor/github.com/oracle/bmcs-go-sdk/database_database_test.go deleted file mode 100644 index ca7676a11f..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_database_test.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *DatabaseTestSuite) TestGetDatabase() { - res := &Database{ - DBHomeID: "homeID1", - DBName: "dbName", - DBUniqueName: "dbUniq1", - ID: "id1", - State: ResourceAvailable, - TimeCreated: time.Now(), - } - - details := &requestDetails{ - name: resourceDatabases, - ids: urlParts{res.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetDatabase(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *DatabaseTestSuite) TestListDatabases() { - reqs := struct { - listOCIDRequirement - DBHomeID string `header:"-" json:"-" url:"dbHomeId"` - Limit uint64 `header:"-" json:"-" url:"limit"` - }{ - DBHomeID: "homeID", - Limit: 100, - } - reqs.CompartmentID = "compartmentID" - opts := &PageListOptions{} - - details := &requestDetails{ - name: resourceDatabases, - optional: opts, - required: reqs, - } - - expected := ListDatabases{ - Databases: []Database{ - { - DBHomeID: "homeID1", - DBName: "dbName", - DBUniqueName: "dbUniq1", - ID: "id1", - State: ResourceAvailable, - TimeCreated: time.Now(), - }, - { - DBHomeID: "homeID2", - DBName: "dbName", - DBUniqueName: "dbUniq2", - ID: "id2", - State: ResourceAvailable, - TimeCreated: time.Now(), - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.Databases), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListDatabases(reqs.CompartmentID, reqs.DBHomeID, reqs.Limit, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.Databases), len(actual.Databases)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_home.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_home.go deleted file mode 100644 index d9e74be077..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_home.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "time" -) - -type DBHome struct { - ocidRequirement - OPCRequestIDUnmarshaller - ETagUnmarshaller - DBSystemID string `json:"dbSystemId"` - DBVersion string `json:"dbVersion"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - State string `json:"lifecycleState"` - TimeCreated time.Time `json:"timeCreated"` -} - -type ListDBHomes struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - DBHomes []DBHome -} - -func (l *ListDBHomes) GetList() interface{} { - return &l.DBHomes -} - -// GetDBHome retrieves information about a DBHome -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbHome/GetDbHome -func (c *Client) GetDBHome(id string) (res *DBHome, e error) { - details := &requestDetails{ - name: resourceDBHomes, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - res = &DBHome{} - e = resp.unmarshal(res) - return -} - -// ListDBHomes returns a list of database homes in the specified DB System. The request MAY contain optional paging arguments. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbHome/ListDbHomes -func (c *Client) ListDBHomes(compartmentID, dbSystemID string, opts *ListOptions) (resources *ListDBHomes, e error) { - required := struct { - listOCIDRequirement - DBSystemID string `header:"-" json:"-" url:"dbSystemId"` - }{ - DBSystemID: dbSystemID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDBHomes, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - resources = &ListDBHomes{} - e = resp.unmarshal(resources) - return -} - -type CreateDBHomeDetails struct { - Database CreateDatabaseDetails `header:"-" json:"database" url:"-"` - DBVersion string `header:"-" json:"dbVersion" url:"-"` - DisplayName string `header:"-" json:"displayName,omitempty" url:"-"` -} - -// NewCreateDBHomeDetails is used to create the DBHome argument to -// LaunchDBSystem. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/requests/CreateDbHomeDetails -func NewCreateDBHomeDetails(createDatabaseDetails CreateDatabaseDetails, dbVersion string, opts *CreateDBHomeOptions) (dbHome CreateDBHomeDetails) { - dbHome = CreateDBHomeDetails{ - Database: createDatabaseDetails, - DBVersion: dbVersion, - } - - if opts != nil { - if opts.DisplayName != "" { - dbHome.DisplayName = opts.DisplayName - } - } - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_home_test.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_home_test.go deleted file mode 100644 index bfca961bc3..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_home_test.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *DatabaseTestSuite) TestGetDBHome() { - res := &DBHome{ - DBSystemID: "id1", - DBVersion: "vers1", - DisplayName: "blah-home", - ID: "id1", - State: ResourceAvailable, - TimeCreated: time.Now(), - } - - details := &requestDetails{ - name: resourceDBHomes, - ids: urlParts{res.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetDBHome(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *DatabaseTestSuite) TestListDBHomes() { - reqs := struct { - listOCIDRequirement - DBSystemID string `header:"-" json:"-" url:"dbSystemId"` - }{ - DBSystemID: "blahID", - } - reqs.CompartmentID = "compartmentID" - opts := ListOptions{} - opts.Limit = 100 - - details := &requestDetails{ - name: resourceDBHomes, - optional: &opts, - required: reqs, - } - - expected := ListDBHomes{ - DBHomes: []DBHome{ - { - DBSystemID: "id1", - DBVersion: "vers1", - DisplayName: "blah-home", - ID: "id1", - State: ResourceAvailable, - TimeCreated: time.Now(), - }, - { - DBSystemID: "id1", - DBVersion: "vers2", - DisplayName: "blah-home", - ID: "id2", - State: ResourceAvailable, - TimeCreated: time.Now(), - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.DBHomes), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListDBHomes(reqs.CompartmentID, reqs.DBSystemID, &opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.DBHomes), len(actual.DBHomes)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_node.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_node.go deleted file mode 100644 index fa269d2184..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_node.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "time" -) - -type DBNode struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - DBSystemID string `json:"dbSystemId"` - Hostname string `json:"hostname"` - ID string `json:"id"` - State string `json:"lifecycleState"` - TimeCreated time.Time `json:"timeCreated"` - VnicID string `json:"vnicId"` - BackupVnicID string `json:"backupVnicId"` -} - -type ListDBNodes struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - DBNodes []DBNode -} - -func (l *ListDBNodes) GetList() interface{} { - return &l.DBNodes -} - -// GetDBNode retrieves information about a DBNode -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbNode/GetDbNode -func (c *Client) GetDBNode(id string) (res *DBNode, e error) { - details := &requestDetails{ - name: resourceDBNodes, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - res = &DBNode{} - e = resp.unmarshal(res) - return -} - -// DBNodeAction starts, stops, or resets a compute instance identified by -// instanceID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbNode/DbNodeAction -func (c *Client) DBNodeAction(id string, action DBNodeAction, opts *HeaderOptions) (inst *DBNode, e error) { - required := struct { - Action string `header:"-" json:"-" url:"action"` - }{ - Action: string(action), - } - - details := &requestDetails{ - name: resourceDBNodes, - ids: urlParts{id}, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.databaseApi.postRequest(details); e != nil { - return - } - - inst = &DBNode{} - e = resp.unmarshal(inst) - return -} - -// ListDBNodes returns a list of database nodes in the specified DB System. The request MAY contain optional paging arguments. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbNode/ListDbNodes -func (c *Client) ListDBNodes(compartmentID, dbSystemID string, opts *ListOptions) (resources *ListDBNodes, e error) { - required := struct { - listOCIDRequirement - DBSystemID string `header:"-" json:"-" url:"dbSystemId"` - }{ - DBSystemID: dbSystemID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDBNodes, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - resources = &ListDBNodes{} - e = resp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_node_test.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_node_test.go deleted file mode 100644 index 66111eb9be..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_node_test.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *DatabaseTestSuite) TestGetDBNode() { - res := &DBNode{ - DBSystemID: "id1", - Hostname: "host1", - ID: "id1", - State: ResourceProvisioning, - TimeCreated: time.Now(), - VnicID: "vnic1", - } - - details := &requestDetails{ - name: resourceDBNodes, - ids: urlParts{res.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetDBNode(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *DatabaseTestSuite) TestDBNodeAction() { - res := &DBNode{ - DBSystemID: "id1", - Hostname: "host1", - ID: "id1", - State: ResourceActive, - TimeCreated: time.Now(), - VnicID: "vnic1", - } - - required := struct { - Action string `header:"-" json:"-" url:"action"` - }{ - Action: string(DBNodeActionStart), - } - - details := &requestDetails{ - name: resourceDBNodes, - ids: urlParts{res.ID}, - required: required, - optional: (*HeaderOptions)(nil), - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.DBNodeAction(res.ID, DBNodeActionStart, nil) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *DatabaseTestSuite) TestListDBNodes() { - reqs := struct { - listOCIDRequirement - DBSystemID string `header:"-" json:"-" url:"dbSystemId"` - }{ - DBSystemID: "blahID", - } - reqs.CompartmentID = "compartmentID" - opts := ListOptions{} - opts.Limit = 100 - - details := &requestDetails{ - name: resourceDBNodes, - optional: &opts, - required: reqs, - } - - expected := ListDBNodes{ - DBNodes: []DBNode{ - { - DBSystemID: "id1", - Hostname: "host1", - ID: "id1", - State: ResourceProvisioning, - TimeCreated: time.Now(), - VnicID: "vnic1", - }, - { - DBSystemID: "id2", - Hostname: "host2", - ID: "id2", - State: ResourceActive, - TimeCreated: time.Now(), - VnicID: "vnic2", - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.DBNodes), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListDBNodes(reqs.CompartmentID, reqs.DBSystemID, &opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.DBNodes), len(actual.DBNodes)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_system.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_system.go deleted file mode 100644 index fc4ca56eb3..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_system.go +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// DBSystem described a dedicated bare metal instance running Oracle Linux 6.8. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbSystem/ -type DBSystem struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - AvailabilityDomain string `json:"availabilityDomain"` - BackupSubnetID string `json:"backupSubnetId"` - ClusterName string `json:"clusterName"` - CompartmentID string `json:"compartmentId"` - CPUCoreCount uint64 `json:"cpuCoreCount"` - DatabaseEdition DatabaseEdition `json:"databaseEdition"` - DataStoragePercentage int `json:"dataStoragePercentage"` - DataStorageSizeInGBs int `json:"dataStorageSizeInGBs"` - DBHome CreateDBHomeDetails `json:"dbHome"` - DiskRedundancy DiskRedundancy `json:"diskRedundancy"` - DisplayName string `json:"displayName"` - Domain string `json:"domain"` - Hostname string `json:"hostname"` - ID string `json:"id"` - LicenseModel LicenseModel `json:"licenseModel"` - LifecycleDetails string `json:"lifecycleDetails"` - ListenerPort uint64 `json:"listenerPort"` - NodeCount int `json:"nodeCount"` - RecoStorageSizeInGB int `json:"recoStorageSizeInGB"` - ScanDnsRecordId string `json:"scanDnsRecordId"` - ScanIpIds []string `json:"scanIpIds"` - Shape string `json:"shape"` - SSHPublicKeys []string `json:"sshPublicKeys"` - State string `json:"lifecycleState"` - SubnetID string `json:"subnetId"` - TimeCreated Time `json:"timeCreated"` - Version string `json:"version"` - VipIds []string `json:"vipIds"` -} - -// ListDBSystems contains a list of DBSystems. -// -type ListDBSystems struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - DBSystems []DBSystem -} - -func (l *ListDBSystems) GetList() interface{} { - return &l.DBSystems -} - -// LaunchDBSystem launches a new DB System in the specified compartment and -// Availability Domain. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbSystem/LaunchDbSystem -func (c *Client) LaunchDBSystem( - availabilityDomain string, - compartmentID string, - cpuCoreCount uint64, - databaseEdition DatabaseEdition, - dbHome CreateDBHomeDetails, - hostname string, - shape string, - sshPublicKeys []string, - subnetID string, - opts *LaunchDBSystemOptions, -) (res *DBSystem, e error) { - required := struct { - ocidRequirement - AvailabilityDomain string `header:"-" json:"availabilityDomain" url:"-"` - CPUCoreCount uint64 `header:"-" json:"cpuCoreCount" url:"-"` - DatabaseEdition DatabaseEdition `header:"-" json:"databaseEdition" url:"-"` - DBHome CreateDBHomeDetails `header:"-" json:"dbHome" url:"-"` - Hostname string `header:"-" json:"hostname" url:"-"` - Shape string `header:"-" json:"shape" url:"-"` - SSHPublicKeys []string `header:"-" json:"sshPublicKeys" url:"-"` - SubnetID string `header:"-" json:"subnetId" url:"-"` - }{ - AvailabilityDomain: availabilityDomain, - CPUCoreCount: cpuCoreCount, - DatabaseEdition: databaseEdition, - DBHome: dbHome, - Hostname: hostname, - Shape: shape, - SSHPublicKeys: sshPublicKeys, - SubnetID: subnetID, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDBSystems, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.databaseApi.postRequest(details); e != nil { - return - } - - res = &DBSystem{} - e = resp.unmarshal(res) - return -} - -// GetDBSystem gets information about the specified DB System. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbSystem/GetDbSystem -func (c *Client) GetDBSystem(id string) (res *DBSystem, e error) { - details := &requestDetails{ - name: resourceDBSystems, - ids: urlParts{id}, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - res = &DBSystem{} - e = resp.unmarshal(res) - return -} - -// TerminateDBSystem terminates a DB System and permanently deletes it and any -// databases running on it. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbSystem/TerminateDbSystem -func (c *Client) TerminateDBSystem(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceDBSystems, - optional: opts, - } - return c.databaseApi.deleteRequest(details) -} - -// ListDBSystems gets a list of the DB Systems in the specified compartment. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbSystem/ListDbSystems -func (c *Client) ListDBSystems(compartmentID string, opts *ListOptions) (res *ListDBSystems, e error) { - required := struct { - listOCIDRequirement - }{} - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDBSystems, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - res = &ListDBSystems{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_system_shape.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_system_shape.go deleted file mode 100644 index 253a459d82..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_system_shape.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// DBSystemShape describes the shape of the DB System. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbSystemShape/ -type DBSystemShape struct { - AvailableCoreCount uint64 `json:"availableCoreCount"` - Name string `json:"name"` - Shape string `json:"shape"` -} - -// ListDBSystemShapes contains a list of DBSystemShapes. -type ListDBSystemShapes struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - DBSystemShapes []DBSystemShape -} - -// GetList returns the list of DBSystemShapes. -func (l *ListDBSystemShapes) GetList() interface{} { - return &l.DBSystemShapes -} - -// ListDBSystemShapes returns a set of DBSystemShapes. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbSystemShape/ListDbSystemShapes -func (c *Client) ListDBSystemShapes( - availabilityDomain, compartmentID string, - opts *ListOptions, -) (resources *ListDBSystemShapes, e error) { - - required := struct { - listOCIDRequirement - AvailabilityDomain string `header:"-" json:"-" url:"availabilityDomain"` - }{ - AvailabilityDomain: availabilityDomain, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDBSystemShapes, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - resources = &ListDBSystemShapes{} - e = resp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_system_shape_test.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_system_shape_test.go deleted file mode 100644 index 1abfb170e4..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_system_shape_test.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *DatabaseTestSuite) TestListDBSystemShapes() { - availabilityDomain := "availabilitydomain" - compartmentID := "compartmentid" - - opts := &ListOptions{} - opts.Page = "pageid" - opts.Limit = 100 - - required := struct { - listOCIDRequirement - AvailabilityDomain string `header:"-" json:"-" url:"availabilityDomain"` - }{ - AvailabilityDomain: availabilityDomain, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDBSystemShapes, - optional: opts, - required: required, - } - - expected := []DBSystemShape{ - {Name: "shape1"}, - {Name: "shape2"}, - } - - headers := http.Header{} - headers.Set(headerOPCNextPage, "nextpage") - headers.Set(headerOPCRequestID, "requestid") - s.requestor.On("getRequest", details).Return( - &response{ - header: headers, - body: marshalObjectForTest(expected), - }, - nil, - ) - - actual, e := s.requestor.ListDBSystemShapes( - availabilityDomain, - compartmentID, - opts, - ) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected), len(actual.DBSystemShapes)) - s.Equal("nextpage", actual.NextPage) - s.Equal("requestid", actual.RequestID) - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_system_test.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_system_test.go deleted file mode 100644 index 4580fce77a..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_system_test.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *DatabaseTestSuite) TestGetDBSystem() { - res := &DBSystem{ID: "id1"} - - details := &requestDetails{ - name: resourceDBSystems, - ids: urlParts{res.ID}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetDBSystem(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG", actual.ETag) -} - -func (s *DatabaseTestSuite) TestTerminateDBSystem() { - s.testDeleteResource(resourceDBSystems, "id", s.requestor.TerminateDBSystem) -} - -func (s *DatabaseTestSuite) TestListDBSystems() { - required := struct { - listOCIDRequirement - }{} - required.CompartmentID = "compartmentID" - - opts := &ListOptions{} - opts.Limit = 100 - - details := &requestDetails{ - name: resourceDBSystems, - optional: opts, - required: required, - } - - expected := ListDBSystems{ - DBSystems: []DBSystem{{ID: "id1"}, {ID: "id2"}}, - } - - resp := &response{ - body: marshalObjectForTest(expected.DBSystems), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListDBSystems(required.CompartmentID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.DBSystems), len(actual.DBSystems)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_version.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_version.go deleted file mode 100644 index ddcdb646a1..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_version.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -type DBVersion struct { - Version string `json:"version"` - SupportsPDB bool `json:"supportsPdb"` -} - -type ListDBVersions struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - DBVersions []DBVersion -} - -func (l *ListDBVersions) GetList() interface{} { - return &l.DBVersions -} - -// ListDBVersions returns a list of supported Oracle database versions. The request MAY contain optional paging arguments. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/database/20160918/DbVersion/ListDbVersions -func (c *Client) ListDBVersions(compartmentID string, opts *ListOptions) (resources *ListDBVersions, e error) { - required := struct { - listOCIDRequirement - }{} - required.CompartmentID = compartmentID - - details := &requestDetails{ - name: resourceDBVersions, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.databaseApi.getRequest(details); e != nil { - return - } - - resources = &ListDBVersions{} - e = resp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_db_version_test.go b/vendor/github.com/oracle/bmcs-go-sdk/database_db_version_test.go deleted file mode 100644 index f35223ff0f..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_db_version_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -func (s *DatabaseTestSuite) TestListDBVersions() { - reqs := struct { - listOCIDRequirement - }{} - reqs.CompartmentID = "compartmentID" - opts := ListOptions{} - - details := &requestDetails{ - name: resourceDBVersions, - optional: &opts, - required: reqs, - } - - expected := ListDBVersions{ - DBVersions: []DBVersion{ - { - Version: "1", - }, - { - Version: "2", - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.DBVersions), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListDBVersions(reqs.CompartmentID, &opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.DBVersions), len(actual.DBVersions)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/database_test.go b/vendor/github.com/oracle/bmcs-go-sdk/database_test.go deleted file mode 100644 index 754c6f711d..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/database_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "testing" - - "github.com/stretchr/testify/suite" -) - -type DatabaseTestSuite struct { - suite.Suite - requestor *mockRequestor - nilHeader http.Header - nilQuery []interface{} -} - -func (s *DatabaseTestSuite) SetupTest() { - s.requestor = newMockRequestor(s) -} - -func (s *DatabaseTestSuite) testDeleteResource(name resourceName, id string, funcUnderTest func(string, *IfMatchOptions) error) { - option := &IfMatchOptions{IfMatch: "abcd"} - - details := &requestDetails{ - ids: urlParts{id}, - name: name, - optional: option, - } - s.requestor.On("deleteRequest", details).Return(nil) - - e := funcUnderTest(id, option) - s.requestor.AssertExpectations(s.T()) - s.Nil(e) -} - -func TestRunDatabaseTests(t *testing.T) { - suite.Run(t, new(DatabaseTestSuite)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/helpers_test.go b/vendor/github.com/oracle/bmcs-go-sdk/helpers_test.go deleted file mode 100644 index 837926922c..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/helpers_test.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "bytes" - "encoding/json" - - "github.com/stretchr/testify/mock" -) - -func marshalObjectForTest(obj interface{}) []byte { - var buffer bytes.Buffer - encoder := json.NewEncoder(&buffer) - encoder.Encode(obj) - - return buffer.Bytes() -} - -type mockRequestor struct { - *Client - mock.Mock -} - -func (mr *mockRequestor) request(method string, reqOpts request) (resp *response, e error) { - args := mr.Called(method, reqOpts) - return args.Get(0).(*response), args.Error(1) -} - -func (mr *mockRequestor) getRequest(reqOpts request) (resp *response, e error) { - args := mr.Called(reqOpts) - return args.Get(0).(*response), args.Error(1) - -} - -func (mr *mockRequestor) postRequest(reqOpts request) (resp *response, e error) { - args := mr.Called(reqOpts) - return args.Get(0).(*response), args.Error(1) - -} - -func (mr *mockRequestor) deleteRequest(reqOpts request) (e error) { - args := mr.Called(reqOpts) - return args.Error(0) -} - -func newMockRequestor(s interface{}) (m *mockRequestor) { - m = new(mockRequestor) - - m.Client = createClientForTest() - m.coreApi = m - m.objectStorageApi = m - m.databaseApi = m - m.identityApi = m - m.loadBalancerApi = m - - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity.go b/vendor/github.com/oracle/bmcs-go-sdk/identity.go deleted file mode 100644 index dcb8a4f149..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "fmt" - -// Error is returned from unsuccessful API calls. The OPCRequestID if present -// is used to reference the failing requests for support. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/responses/Error -type Error struct { - Status string `json:"status"` - Code string `json:"code"` - Message string `json:"message"` - OPCRequestID string `json:"opc-request-id,omitempty"` -} - -// Error returns a formatted description of an API error. -func (e *Error) Error() string { - return fmt.Sprintf("Status: %s; Code: %s; OPC Request ID: %s; Message: %s", - e.Status, - e.Code, - e.OPCRequestID, - e.Message, - ) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_api_key.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_api_key.go deleted file mode 100644 index bb5223de37..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_api_key.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// APIKey is returned for operations that create or modify user API keys. -import ( - "time" -) - -// APIKey is a PEM-format RSA credential for securing requests to the Oracle Bare Metal Cloud Services REST API. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/ApiKey/ -type APIKey struct { - KeyID string `json:"keyId"` - KeyValue string `json:"keyValue"` - Fingerprint string `json:"fingerprint"` - UserID string `json:"userId"` - TimeCreated time.Time `json:"timeCreated"` - TimeModified time.Time `json:"timeModified"` - State string `json:"lifecycleState"` -} - -// ListAPIKeyResponses contains a list of API keys -type ListAPIKeyResponses struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Keys []APIKey -} - -func (l *ListAPIKeyResponses) GetList() interface{} { - return &l.Keys -} - -// DeleteAPIKey deletes an API key belonging to a user. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/ApiKey/DeleteApiKey -func (c *Client) DeleteAPIKey(userID, fingerprint string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{userID, apiKeys, fingerprint}, - name: resourceUsers, - optional: opts, - } - - return c.identityApi.deleteRequest(details) -} - -// ListAPIKeys returns information about a user's API keys. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/ApiKey/ListApiKeys -func (c *Client) ListAPIKeys(userID string) (resp *ListAPIKeyResponses, e error) { - details := &requestDetails{ - ids: urlParts{userID, apiKeys, "/"}, - name: resourceUsers, - } - - var getResp *response - if getResp, e = c.identityApi.getRequest(details); e != nil { - return - } - - resp = &ListAPIKeyResponses{} - e = getResp.unmarshal(resp) - return -} - -// UploadAPIKey - add an API signing key for user. The key must be an RSA public -// key in pem format. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/ApiKey/UploadApiKey -func (c *Client) UploadAPIKey(userID, key string, opts *RetryTokenOptions) (apiKey *APIKey, e error) { - required := struct { - Key string `header:"-" json:"key" url:"-"` - }{ - Key: key, - } - - details := &requestDetails{ - ids: urlParts{userID, apiKeys, "/"}, - name: resourceUsers, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.identityApi.postRequest(details); e != nil { - return - } - - apiKey = &APIKey{} - e = resp.unmarshal(apiKey) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_api_key_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_api_key_test.go deleted file mode 100644 index 35f64f0efc..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_api_key_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *IdentityTestSuite) TestListAPIKeys() { - userID := "1ABC" - headerVal := "abcde" - details := &requestDetails{ - name: resourceUsers, - ids: urlParts{userID, apiKeys, "/"}, - } - - headers := http.Header{} - headers.Set(headerOPCRequestID, headerVal) - keys := []APIKey{ - { - UserID: userID, - KeyID: "2", - KeyValue: "DEADBEEF", - }, - } - getResp := &response{ - header: headers, - body: marshalObjectForTest(keys), - } - - s.requestor.On("getRequest", details).Return(getResp, nil) - - actual, e := s.requestor.ListAPIKeys(userID) - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(keys), len(actual.Keys)) - s.Equal(headerVal, actual.RequestID) -} - -func (s *IdentityTestSuite) TestDeleteAPIKey() { - fingerprint := "b4:8a:7d:54:e6:81:04:b2:99:8e:b3:ed:10:e2:12:2b" - userID := "123456" - opts := &IfMatchOptions{IfMatch: "abcd"} - - details := &requestDetails{ - ids: urlParts{userID, apiKeys, fingerprint}, - name: resourceUsers, - optional: opts, - } - - s.requestor.On("deleteRequest", details).Return(nil) - - e := s.requestor.DeleteAPIKey(userID, fingerprint, opts) - s.Nil(e) -} - -func (s *IdentityTestSuite) TestUploadAPIKey() { - userID := "123" - key := "DEADBEEF" - - opts := &RetryTokenOptions{RetryToken: "abc"} - - required := struct { - Key string `header:"-" json:"key" url:"-"` - }{ - Key: key, - } - - details := &requestDetails{ - ids: urlParts{userID, apiKeys, "/"}, - name: resourceUsers, - optional: opts, - required: required, - } - - expected := APIKey{UserID: userID, KeyID: "2"} - resp := &response{body: marshalObjectForTest(expected)} - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.UploadAPIKey(userID, key, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(actual.UserID, expected.UserID) - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_availability_domain.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_availability_domain.go deleted file mode 100644 index 702d168233..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_availability_domain.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// AvailablityDomain contains name and then tenancy ID that an -// availability domain belongs to. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/AvailabilityDomain/ -type AvailabilityDomain struct { - Name string `json:"name"` - CompartmentID string `json:"compartmentId"` -} - -// ListAvailabilityDomains contains a list AvailabilityDomain -type ListAvailabilityDomains struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - AvailabilityDomains []AvailabilityDomain -} - -func (l *ListAvailabilityDomains) GetList() interface{} { - return &l.AvailabilityDomains -} - -// ListAvailabilityDomains lists availability domains in a user's root tenancy. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/AvailabilityDomain/ListAvailabilityDomains -func (c *Client) ListAvailabilityDomains(compartmentID string) (ads *ListAvailabilityDomains, e error) { - details := &requestDetails{ - name: resourceAvailabilityDomains, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - var getResp *response - if getResp, e = c.identityApi.getRequest(details); e != nil { - return - } - - ads = &ListAvailabilityDomains{} - e = getResp.unmarshal(ads) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_availability_domain_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_availability_domain_test.go deleted file mode 100644 index 791065b161..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_availability_domain_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -func (s *IdentityTestSuite) TestListAvailabilityDomains() { - compartmentID := "compartmentid" - - details := &requestDetails{ - name: resourceAvailabilityDomains, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - resp := &response{ - body: marshalObjectForTest( - []AvailabilityDomain{ - { - Name: "one", - CompartmentID: "1", - }, - { - Name: "two", - CompartmentID: "1", - }, - }, - ), - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListAvailabilityDomains(compartmentID) - s.requestor.AssertExpectations(s.T()) - - s.Nil(e) - s.NotNil(actual) - s.Equal(len(actual.AvailabilityDomains), 2) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_compartment.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_compartment.go deleted file mode 100644 index 0423b3d2f3..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_compartment.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -type Compartment struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - Description string `json:"description"` - ID string `json:"id"` - InactiveStatus uint16 `json:"inactiveStatus"` - Name string `json:"name"` - State string `json:"lifecycleState"` - TimeCreated time.Time `json:"timeCreated"` -} - -type ListCompartments struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Compartments []Compartment -} - -func (l *ListCompartments) GetList() interface{} { - return &l.Compartments -} - -// CreateCompartment create a new compartment. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Compartment/CreateCompartment -func (c *Client) CreateCompartment(name, desc string, opts *RetryTokenOptions) (res *Compartment, e error) { - required := identityCreationRequirement{ - CompartmentID: c.authInfo.tenancyOCID, - Description: desc, - Name: name, - } - - details := &requestDetails{ - name: resourceCompartments, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.identityApi.postRequest(details); e != nil { - return - } - - res = &Compartment{} - e = resp.unmarshal(res) - return -} - -// GetCompartment returns the compartment identified by compartmentID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Compartment/GetCompartment -func (c *Client) GetCompartment(id string) (res *Compartment, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceCompartments, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - res = &Compartment{} - e = resp.unmarshal(res) - return -} - -// UpdateCompartment updates the description of a compartment. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Compartment/UpdateCompartment -func (c *Client) UpdateCompartment(id string, opts *UpdateCompartmentOptions) (res *Compartment, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceCompartments, - optional: opts, - } - - var resp *response - if resp, e = c.identityApi.request(http.MethodPut, details); e != nil { - return - } - - res = &Compartment{} - e = resp.unmarshal(res) - return -} - -// ListCompartments returns a list of compartments. The request MAY contain optional paging arguments. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Compartment/ListCompartments -func (c *Client) ListCompartments(opts *ListOptions) (resources *ListCompartments, e error) { - details := &requestDetails{ - name: resourceCompartments, - optional: opts, - required: listOCIDRequirement{c.authInfo.tenancyOCID}, - } - - var getResp *response - if getResp, e = c.identityApi.getRequest(details); e != nil { - return - } - - resources = &ListCompartments{} - e = getResp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_compartment_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_compartment_test.go deleted file mode 100644 index 57050d8932..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_compartment_test.go +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *IdentityTestSuite) TestCreateCompartment() { - compartmentID := s.requestor.authInfo.tenancyOCID - res := Compartment{ - CompartmentID: compartmentID, - Description: "description", - Name: "name", - } - - opts := &RetryTokenOptions{RetryToken: "xxxxx"} - - required := identityCreationRequirement{ - CompartmentID: res.CompartmentID, - Description: res.Description, - Name: res.Name, - } - - details := &requestDetails{ - name: resourceCompartments, - optional: opts, - required: required, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.CreateCompartment(res.Name, res.Description, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestGetCompartment() { - res := Compartment{ID: "id"} - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceCompartments, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetCompartment(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestUpdateCompartment() { - res := Compartment{ - ID: "id", - Description: "desc", - } - - opts := &UpdateCompartmentOptions{} - opts.Name = "name" - opts.Description = "desc" - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceCompartments, - optional: opts, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateCompartment(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.Name, actual.Name) - s.Equal(res.Description, actual.Description) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestListCompartments() { - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "wxyz" - - details := &requestDetails{ - name: resourceCompartments, - optional: opts, - required: listOCIDRequirement{s.requestor.authInfo.tenancyOCID}, - } - - expected := ListCompartments{ - Compartments: []Compartment{ - { - ID: "1", - Name: "one", - }, - { - ID: "2", - Name: "two", - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.Compartments), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListCompartments(opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.Compartments), len(actual.Compartments)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_group.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_group.go deleted file mode 100644 index 4cf54bb532..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_group.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -type Group struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - Description string `json:"description"` - ID string `json:"id"` - InactiveStatus uint16 `json:"inactiveStatus"` - Name string `json:"name"` - State string `json:"lifecycleState"` - TimeCreated time.Time `json:"timeCreated"` -} - -type ListGroups struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Groups []Group -} - -func (l *ListGroups) GetList() interface{} { - return &l.Groups -} - -// CreateGroup create a new group. groupName MUST be supplied and MUST be -// unique. groupDescription is optional. You MAY supply one option with an -// idempotency token. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Group/CreateGroup -func (c *Client) CreateGroup(name, desc string, opts *RetryTokenOptions) (res *Group, e error) { - required := identityCreationRequirement{ - CompartmentID: c.authInfo.tenancyOCID, - Description: desc, - Name: name, - } - - details := &requestDetails{ - name: resourceGroups, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.identityApi.postRequest(details); e != nil { - return - } - - res = &Group{} - e = resp.unmarshal(res) - return -} - -// GetGroup returns a group identified by groupID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Group/GetGroup -func (c *Client) GetGroup(id string) (res *Group, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceGroups, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - res = &Group{} - e = resp.unmarshal(res) - return -} - -// UpdateGroup updates the description of a group. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Group/UpdateGroup -func (c *Client) UpdateGroup(id string, opts *UpdateIdentityOptions) (res *Group, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceGroups, - optional: opts, - } - - var resp *response - if resp, e = c.identityApi.request(http.MethodPut, details); e != nil { - return - } - - res = &Group{} - e = resp.unmarshal(res) - return -} - -// DeleteGroup removes a group identified by groupID. Optionally pass an -// etag for optmistic concurrency control. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Group/DeleteGroup -func (c *Client) DeleteGroup(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceGroups, - optional: opts, - } - - return c.identityApi.deleteRequest(details) -} - -// ListGroups returns a list of Groups in a tenancy. The request MAY contain optional paging arguments. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Group/ListGroups -func (c *Client) ListGroups(opts *ListOptions) (resources *ListGroups, e error) { - details := &requestDetails{ - name: resourceGroups, - optional: opts, - required: listOCIDRequirement{c.authInfo.tenancyOCID}, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - resources = &ListGroups{} - e = resp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_group_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_group_test.go deleted file mode 100644 index 3ca2827fca..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_group_test.go +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *IdentityTestSuite) TestCreateGroup() { - compartmentID := s.requestor.authInfo.tenancyOCID - res := Group{ - CompartmentID: compartmentID, - Description: "description", - Name: "name", - } - - opts := &RetryTokenOptions{RetryToken: "xxxxx"} - - required := identityCreationRequirement{ - CompartmentID: res.CompartmentID, - Description: res.Description, - Name: res.Name, - } - - details := &requestDetails{ - name: resourceGroups, - optional: opts, - required: required, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.CreateGroup(res.Name, res.Description, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestGetGroup() { - res := Group{ID: "id"} - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceGroups, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetGroup(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestUpdateGroup() { - res := Group{ - ID: "id", - Description: "desc", - } - - opts := &UpdateIdentityOptions{} - opts.Description = "desc" - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceGroups, - optional: opts, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateGroup(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.Description, actual.Description) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestDeleteGroup() { - opts := &IfMatchOptions{IfMatch: "abcd"} - - details := &requestDetails{ - ids: urlParts{"id"}, - name: resourceGroups, - optional: opts, - } - - s.requestor.On("deleteRequest", details).Return(nil) - - e := s.requestor.DeleteGroup("id", opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) -} - -func (s *IdentityTestSuite) TestListGroups() { - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "wxyz" - - details := &requestDetails{ - name: resourceGroups, - optional: opts, - required: listOCIDRequirement{s.requestor.authInfo.tenancyOCID}, - } - - expected := ListGroups{ - Groups: []Group{ - { - ID: "1", - Name: "one", - }, - { - ID: "2", - Name: "two", - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.Groups), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListGroups(opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.Groups), len(actual.Groups)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_policy.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_policy.go deleted file mode 100644 index e7782b32b9..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_policy.go +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// CreatePolicy creates a new policy. -import ( - "net/http" - "time" -) - -// Policy returned by GetPolicy and other policy related methods. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/identity.html#Policy -type Policy struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - Description string `json:"description"` - ID string `json:"id"` - InactiveStatus uint16 `json:"inactiveStatus"` - Name string `json:"name"` - State string `json:"lifecycleState"` - Statements []string `json:"statements"` - TimeCreated time.Time `json:"timeCreated"` - VersionDate string `json:"versionDate"` -} - -type ListPolicies struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Policies []Policy -} - -func (l *ListPolicies) GetList() interface{} { - return &l.Policies -} - -// CreatePolicy create a policy in a compartment. -// -// For information on defining policies and statements. -// See https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm#Example -// -// For information on the CreatePolicy API, -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Policy/CreatePolicy -func (c *Client) CreatePolicy(name, desc, compartmentID string, statements []string, opts *CreatePolicyOptions) (res *Policy, e error) { - required := struct { - identityCreationRequirement - Statements []string `header:"-" json:"statements" url:"-"` - }{ - Statements: statements, - } - required.CompartmentID = compartmentID - required.Description = desc - required.Name = name - - details := &requestDetails{ - name: resourcePolicies, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.identityApi.postRequest(details); e != nil { - return - } - - res = &Policy{} - e = resp.unmarshal(res) - return -} - -// GetPolicy returns a policy identified by a policyID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Policy/GetPolicy -func (c *Client) GetPolicy(id string) (res *Policy, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourcePolicies, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - res = &Policy{} - e = resp.unmarshal(res) - return -} - -// UpdatePolicy can be called to modify the description and statements of an existing policy. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Policy/UpdatePolicy -func (c *Client) UpdatePolicy(id string, opts *UpdatePolicyOptions) (res *Policy, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourcePolicies, - optional: opts, - } - - var resp *response - if resp, e = c.identityApi.request(http.MethodPut, details); e != nil { - return - } - - res = &Policy{} - e = resp.unmarshal(res) - return -} - -// DeletePolicy removes a policy identified by policyID. Optionally pass an -// etag for optmistic concurrency control. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Policy/DeletePolicy -func (c *Client) DeletePolicy(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourcePolicies, - optional: opts, - } - - return c.identityApi.deleteRequest(details) -} - -// ListPolicies lists policies by compartmentId -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Policy/ListPolicies -func (c *Client) ListPolicies(compartmentID string, opts *ListOptions) (resources *ListPolicies, e error) { - details := &requestDetails{ - name: resourcePolicies, - optional: opts, - required: listOCIDRequirement{CompartmentID: compartmentID}, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - resources = &ListPolicies{} - e = resp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_policy_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_policy_test.go deleted file mode 100644 index 2552199ed7..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_policy_test.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *IdentityTestSuite) TestCreatePolicy() { - compartmentID := s.requestor.authInfo.tenancyOCID - - res := Policy{ - CompartmentID: compartmentID, - Description: "description", - Name: "name", - Statements: []string{ - "statement1", - "statement2", - }, - } - - opts := &CreatePolicyOptions{} - opts.RetryToken = "xxxxx" - - required := struct { - identityCreationRequirement - Statements []string `header:"-" json:"statements" url:"-"` - }{ - Statements: res.Statements, - } - required.CompartmentID = res.CompartmentID - required.Description = res.Description - required.Name = res.Name - - details := &requestDetails{ - name: resourcePolicies, - optional: opts, - required: required, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.CreatePolicy(res.Name, res.Description, compartmentID, res.Statements, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestGetPolicy() { - res := Policy{ID: "id"} - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourcePolicies, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetPolicy(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestUpdatePolicy() { - res := Policy{ - ID: "id", - Description: "desc", - } - - opts := &UpdatePolicyOptions{} - opts.Description = "desc" - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourcePolicies, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdatePolicy(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.Description, actual.Description) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestDeletePolicy() { - s.testDeleteResource(resourcePolicies, "9999", s.requestor.DeletePolicy) -} - -func (s *IdentityTestSuite) TestListPolicies() { - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "wxyz" - - details := &requestDetails{ - name: resourcePolicies, - optional: opts, - required: listOCIDRequirement{s.requestor.authInfo.tenancyOCID}, - } - - expected := ListPolicies{ - Policies: []Policy{ - { - ID: "1", - Name: "one", - }, - { - ID: "2", - Name: "two", - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.Policies), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListPolicies(s.requestor.authInfo.tenancyOCID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.Policies), len(actual.Policies)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_region.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_region.go deleted file mode 100644 index 407a19a2ec..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_region.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -type IdentityRegion struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - Key string `json:"key"` - Name string `json:"name"` -} - -type ListRegions struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Regions []IdentityRegion -} - -func (l *ListRegions) GetList() interface{} { - return &l.Regions -} - -// ListRegions returns a list of regions -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Region/ListRegions -func (c *Client) ListRegions() (resources *ListRegions, e error) { - details := &requestDetails{ - name: resourceRegions, - required: listOCIDRequirement{c.authInfo.tenancyOCID}, - } - - var getResp *response - if getResp, e = c.identityApi.getRequest(details); e != nil { - return - } - - resources = &ListRegions{} - e = getResp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_region_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_region_test.go deleted file mode 100644 index 06b03bf00b..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_region_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -func (s *IdentityTestSuite) TestListRegions() { - details := &requestDetails{ - name: resourceRegions, - required: listOCIDRequirement{s.requestor.Client.authInfo.tenancyOCID}, - } - - expected := ListRegions{ - Regions: []IdentityRegion{ - { - Name: "us-ashburn-1", - Key: "IAD", - }, - { - Name: "us-phoenix-1", - Key: "PHX", - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.Regions), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListRegions() - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.Regions), len(actual.Regions)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_swift_password.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_swift_password.go deleted file mode 100644 index 28425bb615..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_swift_password.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -type SwiftPassword struct { - ETagUnmarshaller - OPCRequestIDUnmarshaller - Password string `json:"password"` - ID string `json:"id"` - UserID string `json:"userId"` - Description string `json:"description"` - State string `json:"lifecycleState"` - InactiveStatus uint64 `json:"inactiveStatus"` - ExpiresOn time.Time `json:"expiresOn"` - TimeCreated time.Time `json:"timeCreated"` -} - -type ListSwiftPasswords struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - SwiftPasswords []SwiftPassword -} - -func (l *ListSwiftPasswords) GetList() interface{} { - return &l.SwiftPasswords -} - -// CreateSwiftPassword creates a new SwiftPassword for userID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/SwiftPassword/CreateSwiftPassword -func (c *Client) CreateSwiftPassword(userID, desc string, opts *RetryTokenOptions) (res *SwiftPassword, e error) { - required := struct { - Description string `header:"-" json:"description" url:"-"` - }{ - Description: desc, - } - - details := &requestDetails{ - ids: urlParts{userID, resourceSwiftPasswords}, - name: resourceUsers, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.identityApi.postRequest(details); e != nil { - return - } - - res = &SwiftPassword{} - e = resp.unmarshal(res) - return -} - -// UpdateSwiftPassword updates a SwiftPassword. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/SwiftPassword/UpdateSwiftPassword -func (c *Client) UpdateSwiftPassword(id, userID string, opts *UpdateIdentityOptions) (res *SwiftPassword, e error) { - details := &requestDetails{ - ids: urlParts{userID, resourceSwiftPasswords, id}, - name: resourceUsers, - optional: opts, - } - - var resp *response - if resp, e = c.identityApi.request(http.MethodPut, details); e != nil { - return - } - - res = &SwiftPassword{} - e = resp.unmarshal(res) - return -} - -// DeleteSwiftPassword deletes a SwiftPassword id for userID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/SwiftPassword/DeleteSwiftPassword -func (c *Client) DeleteSwiftPassword(id, userID string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{userID, resourceSwiftPasswords, id}, - name: resourceUsers, - optional: opts, - } - - return c.identityApi.deleteRequest(details) -} - -// ListSwiftPasswords gets all SwiftPasswords for userID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/SwiftPassword/ListSwiftPasswords -func (c *Client) ListSwiftPasswords(userID string) (resources *ListSwiftPasswords, e error) { - details := &requestDetails{ - ids: urlParts{userID, resourceSwiftPasswords}, - name: resourceUsers, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - resources = &ListSwiftPasswords{} - e = resp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_swift_password_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_swift_password_test.go deleted file mode 100644 index e745010877..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_swift_password_test.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *IdentityTestSuite) TestCreateSwiftPassword() { - desc := "description" - res := SwiftPassword{ - Password: "password", - ID: "id", - UserID: "userID", - Description: desc, - } - - opts := &RetryTokenOptions{RetryToken: "xxxxx"} - - required := struct { - Description string `header:"-" json:"description" url:"-"` - }{ - Description: desc, - } - - details := &requestDetails{ - ids: urlParts{res.UserID, resourceSwiftPasswords}, - name: resourceUsers, - optional: opts, - required: required, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - respHeaders.Set(headerOPCRequestID, "responseId") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.CreateSwiftPassword(res.UserID, desc, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.UserID, actual.UserID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestUpdateSwiftPassword() { - desc := "description" - res := SwiftPassword{ - Password: "password", - ID: "id", - UserID: "userID", - Description: desc, - } - - opts := &UpdateIdentityOptions{ - Description: desc, - } - - details := &requestDetails{ - ids: urlParts{res.UserID, resourceSwiftPasswords, res.ID}, - name: resourceUsers, - optional: opts, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - respHeaders.Set(headerOPCRequestID, "responseId") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateSwiftPassword(res.ID, res.UserID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.Description, actual.Description) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestDeleteSwiftPassword() { - opts := &IfMatchOptions{IfMatch: "abcd"} - id := "id" - userID := "userId" - - details := &requestDetails{ - ids: urlParts{userID, resourceSwiftPasswords, id}, - name: resourceUsers, - optional: opts, - } - - s.requestor.On("deleteRequest", details).Return(nil) - - e := s.requestor.DeleteSwiftPassword(id, userID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) -} - -func (s *IdentityTestSuite) TestListSwiftPasswords() { - userID := "userID" - - details := &requestDetails{ - name: resourceUsers, - ids: urlParts{userID, resourceSwiftPasswords}, - } - - expected := ListSwiftPasswords{ - SwiftPasswords: []SwiftPassword{ - { - ID: "1", - UserID: userID, - }, - { - ID: "2", - UserID: userID, - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.SwiftPasswords), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListSwiftPasswords(userID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.SwiftPasswords), len(actual.SwiftPasswords)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_tenancy.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_tenancy.go deleted file mode 100644 index 9e1eb54344..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_tenancy.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -type Tenancy struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - Description string `json:"description"` - ID string `json:"id"` - Name string `json:"name"` - HomeRegionKey string `json:"homeRegion"` -} - -// GetTenancy returns the tenancy identified by id. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/Tenancy/GetTenancy -func (c *Client) GetTenancy(id string) (res *Tenancy, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceTenancies, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - res = &Tenancy{} - e = resp.unmarshal(res) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_tenancy_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_tenancy_test.go deleted file mode 100644 index 7784a6bc09..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_tenancy_test.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -func (s *IdentityTestSuite) TestGetTenancy() { - res := Tenancy{ - ID: "id", - Name: "tenancyName", - Description: "This is a tenancy", - HomeRegionKey: "IAD", - } - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceTenancies, - } - - resp := &response{ - body: marshalObjectForTest(res), - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetTenancy(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_test.go deleted file mode 100644 index 709ebbb2d4..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "testing" - - "github.com/stretchr/testify/suite" -) - -type IdentityTestSuite struct { - suite.Suite - requestor *mockRequestor - nilHeader http.Header - nilQuery []interface{} -} - -func (s *IdentityTestSuite) SetupTest() { - s.requestor = newMockRequestor(s) -} - -func (s *IdentityTestSuite) testDeleteResource(name resourceName, id string, funcUnderTest func(string, *IfMatchOptions) error) { - option := &IfMatchOptions{IfMatch: "abcd"} - - details := &requestDetails{ - ids: urlParts{id}, - name: name, - optional: option, - } - s.requestor.On("deleteRequest", details).Return(nil) - - e := funcUnderTest(id, option) - s.requestor.AssertExpectations(s.T()) - s.Nil(e) -} - -func TestRunIdentityTests(t *testing.T) { - suite.Run(t, new(IdentityTestSuite)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_ui_password.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_ui_password.go deleted file mode 100644 index 3b0d20a26a..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_ui_password.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// UIPassword represents a user's temporary password. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/UIPassword/ -type UIPassword struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - InactiveStatus uint16 `json:"inactiveStatus"` - Password string `json:"password"` - State string `json:"lifecycleState"` - TimeCreated Time `json:"timeCreated"` - UserID string `json:"userId"` -} - -// CreateOrResetUIPassword creates or resets password for the user with userID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/UIPassword/CreateOrResetUIPassword -func (c *Client) CreateOrResetUIPassword(userID string, opts *RetryTokenOptions) (resource *UIPassword, e error) { - details := &requestDetails{ - ids: urlParts{userID, resourceUiPassword}, - name: resourceUsers, - optional: opts, - } - - var resp *response - if resp, e = c.identityApi.postRequest(details); e != nil { - return - } - - resource = &UIPassword{} - e = resp.unmarshal(resource) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_ui_password_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_ui_password_test.go deleted file mode 100644 index 50979015e5..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_ui_password_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *IdentityTestSuite) TestCreateUIPassword() { - res := &UIPassword{ - InactiveStatus: 0, - State: "state", - Password: "password", - TimeCreated: Time{Time: time.Now()}, - UserID: "user_id", - } - - opts := &RetryTokenOptions{RetryToken: "token"} - - details := &requestDetails{ - ids: urlParts{res.UserID, resourceUiPassword}, - name: resourceUsers, - optional: opts, - } - - header := http.Header{} - header.Set(headerETag, "ETAG!") - header.Set(headerOPCRequestID, "898989") - resp := &response{ - header: header, - body: marshalObjectForTest(res), - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.CreateOrResetUIPassword(res.UserID, opts) - - s.Nil(e) - s.NotNil(actual) - s.Equal(actual.Password, res.Password) - s.Equal(actual.UserID, res.UserID) - s.Equal(actual.ETag, "ETAG!") - s.Equal(actual.RequestID, "898989") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_user.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_user.go deleted file mode 100644 index 5c785662fe..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_user.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -type User struct { - ETagUnmarshaller - OPCRequestIDUnmarshaller - CompartmentID string `json:"compartmentId"` - Description string `json:"description"` - ID string `json:"id"` - InactiveStatus uint16 `json:"inactiveStatus"` - Name string `json:"name"` - State string `json:"lifecycleState"` - TimeCreated time.Time `json:"timeCreated"` -} - -type ListUsers struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Users []User -} - -func (l *ListUsers) GetList() interface{} { - return &l.Users -} - -// CreateUser is used to create a user. userName MUST be unique. description -// contains a comment about the user. The caller can supply 0 or 1 options. Options -// MAY contain an idempotency token. -// The caller specifies this token so that subsequent calls to create user will -// be idempotent. The token expires after 30 minutes. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/User/CreateUser -func (c *Client) CreateUser(name, desc string, opts *RetryTokenOptions) (res *User, e error) { - required := identityCreationRequirement{ - CompartmentID: c.authInfo.tenancyOCID, - Description: desc, - Name: name, - } - - details := &requestDetails{ - name: resourceUsers, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.identityApi.postRequest(details); e != nil { - return - } - - res = &User{} - e = resp.unmarshal(res) - return -} - -// GetUser returns a user identified by userID. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/User/GetUser -func (c *Client) GetUser(id string) (res *User, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceUsers, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - res = &User{} - e = resp.unmarshal(res) - return -} - -// UpdateUser updates the description of the specified user -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/User/UpdateUser -func (c *Client) UpdateUser(id string, opts *UpdateIdentityOptions) (res *User, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceUsers, - optional: opts, - } - - var resp *response - if resp, e = c.identityApi.request(http.MethodPut, details); e != nil { - return - } - - res = &User{} - e = resp.unmarshal(res) - return -} - -// UpdateUserState updates the state of the specified user -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/User/UpdateUserState -func (c *Client) UpdateUserState(id string, opts *UpdateUserStateOptions) (res *User, e error) { - details := &requestDetails{ - ids: urlParts{id, "state"}, - name: resourceUsers, - optional: opts, - } - - var resp *response - if resp, e = c.identityApi.request(http.MethodPut, details); e != nil { - return - } - - res = &User{} - e = resp.unmarshal(res) - return -} - -// DeleteUser deletes a user -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/User/DeleteUser -func (c *Client) DeleteUser(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceUsers, - optional: opts, - } - - return c.identityApi.deleteRequest(details) -} - -// ListUsers returns an array of users for the current tenancy. The requestor -// MAY supply paging options. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/User/ListUsers -func (c *Client) ListUsers(opts *ListOptions) (resources *ListUsers, e error) { - details := &requestDetails{ - name: resourceUsers, - optional: opts, - required: listOCIDRequirement{c.authInfo.tenancyOCID}, - } - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - resources = &ListUsers{} - e = resp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_user_group_membership.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_user_group_membership.go deleted file mode 100644 index 21986c6718..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_user_group_membership.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// UserGroupMembership returned by GetUserGroupMembership and related methods. -import ( - "time" -) - -// UserGroupMembership represents the membership of a user in a group -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/UserGroupMembership/ -type UserGroupMembership struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - CompartmentID string `json:"compartmentId"` - GroupID string `json:"groupId"` - ID string `json:"id"` - InactiveStatus uint16 `json:"inactiveStatus"` - State string `json:"lifecycleState"` - TimeCreated time.Time `json:"timeCreated"` - UserID string `json:"userId"` -} - -type ListUserGroupMemberships struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - Memberships []UserGroupMembership -} - -func (l *ListUserGroupMemberships) GetList() interface{} { - return &l.Memberships -} - -// AddUserToGroup adds a user to a group. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/UserGroupMembership/AddUserToGroup -func (c *Client) AddUserToGroup(userID, groupID string, opts *RetryTokenOptions) (res *UserGroupMembership, e error) { - required := struct { - GroupID string `header:"-" json:"groupId" url:"-"` - UserID string `header:"-" json:"userId" url:"-"` - }{ - GroupID: groupID, - UserID: userID, - } - - details := &requestDetails{ - name: resourceUserGroupMemberships, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.identityApi.postRequest(details); e != nil { - return - } - - res = &UserGroupMembership{} - e = resp.unmarshal(res) - return -} - -// GetUserGroupMembership returns a UserGroupMembership identified by id. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/UserGroupMembership/GetUserGroupMembership -func (c *Client) GetUserGroupMembership(id string) (res *UserGroupMembership, e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceUserGroupMemberships, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - res = &UserGroupMembership{} - e = resp.unmarshal(res) - return -} - -// DeleteUserGroupMembership removes a user from a group. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/UserGroupMembership/RemoveUserFromGroup -func (c *Client) DeleteUserGroupMembership(id string, opts *IfMatchOptions) (e error) { - details := &requestDetails{ - ids: urlParts{id}, - name: resourceUserGroupMemberships, - optional: opts, - } - - return c.identityApi.deleteRequest(details) -} - -// ListUserGroupMemberships lists the UserGroupMembership objects in a user's tenancy. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/identity/20160918/UserGroupMembership/ListUserGroupMemberships -func (c *Client) ListUserGroupMemberships(opts *ListMembershipsOptions) (resources *ListUserGroupMemberships, e error) { - details := &requestDetails{ - name: resourceUserGroupMemberships, - optional: opts, - required: ocidRequirement{c.authInfo.tenancyOCID}, - } - - var resp *response - if resp, e = c.identityApi.getRequest(details); e != nil { - return - } - - resources = &ListUserGroupMemberships{} - e = resp.unmarshal(resources) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_user_group_membership_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_user_group_membership_test.go deleted file mode 100644 index fb59209bc5..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_user_group_membership_test.go +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *IdentityTestSuite) TestAddUserToGroup() { - res := UserGroupMembership{ - ID: "1", - CompartmentID: s.requestor.authInfo.tenancyOCID, - GroupID: "groupid", - UserID: "userid", - } - - opts := &RetryTokenOptions{RetryToken: "aaaa"} - - required := struct { - GroupID string `header:"-" json:"groupId" url:"-"` - UserID string `header:"-" json:"userId" url:"-"` - }{ - GroupID: res.GroupID, - UserID: res.UserID, - } - - details := &requestDetails{ - name: resourceUserGroupMemberships, - optional: opts, - required: required, - } - - header := http.Header{} - header.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: header, - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.AddUserToGroup(res.UserID, res.GroupID, opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) - s.Equal(res.CompartmentID, actual.CompartmentID) -} - -func (s *IdentityTestSuite) TestGetUserGroupMembership() { - res := UserGroupMembership{ - ID: "1234", - GroupID: "4567", - UserID: "bob123", - } - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceUserGroupMemberships, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetUserGroupMembership("1234") - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal("1234", actual.ID) - s.Equal(res.GroupID, actual.GroupID) - s.Equal(res.UserID, actual.UserID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestDeleteUserGroupMembership() { - s.testDeleteResource(resourceUserGroupMemberships, "666", s.requestor.DeleteUserGroupMembership) -} - -func (s *IdentityTestSuite) TestListUserGroupMemberships() { - opts := &ListMembershipsOptions{} - opts.GroupID = "2" - opts.Limit = 100 - opts.Page = "A" - opts.UserID = "1" - - details := &requestDetails{ - name: resourceUserGroupMemberships, - optional: opts, - required: ocidRequirement{s.requestor.authInfo.tenancyOCID}, - } - - resources := []UserGroupMembership{ - { - ID: "1", - CompartmentID: s.requestor.authInfo.tenancyOCID, - GroupID: "1", - UserID: "1", - }, - { - ID: "2", - CompartmentID: s.requestor.authInfo.tenancyOCID, - GroupID: "1", - UserID: "1", - }, - } - - resp := &response{body: marshalObjectForTest(resources)} - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListUserGroupMemberships(opts) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(resources), len(actual.Memberships)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/identity_user_test.go b/vendor/github.com/oracle/bmcs-go-sdk/identity_user_test.go deleted file mode 100644 index 7f637d903a..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/identity_user_test.go +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "net/http" - -func (s *IdentityTestSuite) TestCreateUser() { - compartmentID := s.requestor.authInfo.tenancyOCID - res := User{ - CompartmentID: compartmentID, - Description: "description", - Name: "name", - } - - opts := &RetryTokenOptions{RetryToken: "xxxxx"} - - required := identityCreationRequirement{ - CompartmentID: res.CompartmentID, - Description: res.Description, - Name: res.Name, - } - - details := &requestDetails{ - name: resourceUsers, - optional: opts, - required: required, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: respHeaders, - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, e := s.requestor.CreateUser(res.Name, res.Description, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestGetUser() { - res := User{ID: "id"} - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceUsers, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetUser(res.ID) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.ID, actual.ID) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestUpdateUser() { - res := User{ - ID: "id", - Description: "desc", - } - - opts := &UpdateIdentityOptions{} - opts.Description = "desc" - - details := &requestDetails{ - ids: urlParts{res.ID}, - name: resourceUsers, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateUser(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.Description, actual.Description) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestUpdateUserState() { - blocked := false - res := User{ - ID: "id", - InactiveStatus: 0, - } - - opts := &UpdateUserStateOptions{Blocked: &blocked} - - details := &requestDetails{ - ids: urlParts{res.ID, "state"}, - name: resourceUsers, - optional: opts, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG!") - resp := &response{ - body: marshalObjectForTest(res), - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.UpdateUserState(res.ID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(res.InactiveStatus, actual.InactiveStatus) - s.Equal("ETAG!", actual.ETag) -} - -func (s *IdentityTestSuite) TestDeleteUser() { - opts := &IfMatchOptions{IfMatch: "abcd"} - - details := &requestDetails{ - ids: urlParts{"id"}, - name: resourceUsers, - optional: opts, - } - - s.requestor.On("deleteRequest", details).Return(nil) - - e := s.requestor.DeleteUser("id", opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) -} - -func (s *IdentityTestSuite) TestListUsers() { - opts := &ListOptions{} - opts.Limit = 100 - opts.Page = "wxyz" - - details := &requestDetails{ - name: resourceUsers, - optional: opts, - required: listOCIDRequirement{s.requestor.authInfo.tenancyOCID}, - } - - expected := ListUsers{ - Users: []User{ - { - ID: "1", - Name: "one", - }, - { - ID: "2", - Name: "two", - }, - }, - } - - resp := &response{ - body: marshalObjectForTest(expected.Users), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.ListUsers(opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(len(expected.Users), len(actual.Users)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_backend.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_backend.go deleted file mode 100644 index fa97ca720a..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_backend.go +++ /dev/null @@ -1,184 +0,0 @@ -// 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"` - 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{ - name: resourceLoadBalancers, - ids: urlParts{loadBalancerID, resourceBackendSets, backendSetName, resourceBackends}, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.loadBalancerApi.postRequest(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{ - name: resourceLoadBalancers, - ids: urlParts{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{ - name: resourceLoadBalancers, - ids: urlParts{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 *UpdateLoadBalancerBackendOptions, -) (workRequestID string, e error) { - - details := &requestDetails{ - name: resourceLoadBalancers, - ids: urlParts{loadBalancerID, - resourceBackendSets, backendSetName, - resourceBackends, backendName}, - optional: opts, - } - - var resp *response - if resp, e = c.loadBalancerApi.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{ - name: resourceLoadBalancers, - ids: urlParts{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/oracle/bmcs-go-sdk/loadbalancer_backend_test.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_backend_test.go deleted file mode 100644 index 455e67a26c..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_backend_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - - "github.com/stretchr/testify/assert" -) - -func (s *LoadbalancerTestSuite) TestListBackends() { - backend := Backend{ - Backup: false, - Drain: false, - IPAddress: "123.10.5.12", - Port: 1234, - Offline: false, - Weight: 1, - } - - backends := &ListBackends{ - Backends: []Backend{ - backend, - }, - } - - details := &requestDetails{ - name: resourceLoadBalancers, - ids: urlParts{"lbID", - resourceBackendSets, "lbBackendSet", resourceBackends}, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(backends.Backends), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, err := s.requestor.ListBackends( - "lbID", - "lbBackendSet", - ) - - s.Nil(err) - s.NotNil(actual) - s.True(assert.ObjectsAreEqual(backends.Backends[0], actual.Backends[0])) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_backendset.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_backendset.go deleted file mode 100644 index 49e91ad3f9..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_backendset.go +++ /dev/null @@ -1,208 +0,0 @@ -// 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" url:"-"` - HealthChecker *HealthChecker `json:"healthChecker" url:"-"` - Name string `json:"name,omitempty" url:"-"` // Only on create - Policy string `json:"policy" url:"-"` // FIXME: supposedly has default: "ROUND_ROBIN" but then raises error when null. For valid values see ListPolicies() - SSLConfig *SSLConfiguration `json:"sslConfiguration,omitempty" url:"-"` // TODO: acc test, waiting on CreateCertificate() tests - SessionPersistenceConfig *SessionPersistenceConfiguration `json:"sessionPersistenceConfiguration,omitempty" url:"-"` -} - -type SSLConfiguration struct { - CertificateName string `json:"certificateName"` - VerifyDepth int `json:"verifyDepth"` - VerifyPeerCertificate bool `json:"verifyPeerCertificate"` -} - -type SessionPersistenceConfiguration struct { - CookieName string `json:"cookieName"` - DisableFallback bool `json:"disableFallback"` -} - -// 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, - sessionPersistenceConfig *SessionPersistenceConfiguration, - opts *LoadBalancerOptions, -) (workRequestID string, e error) { - required := BackendSet{ - Name: name, - Policy: policy, - SSLConfig: sslConfig, - SessionPersistenceConfig: sessionPersistenceConfig, - HealthChecker: healthChecker, - Backends: backends, - } - - details := &requestDetails{ - name: resourceLoadBalancers, - ids: urlParts{ - loadBalancerID, - resourceBackendSets, - }, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.loadBalancerApi.postRequest(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{ - name: resourceLoadBalancers, - ids: urlParts{ - 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{ - name: resourceLoadBalancers, - ids: urlParts{ - 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{ - name: resourceLoadBalancers, - ids: urlParts{ - loadBalancerID, - resourceBackendSets, - backendSetName, - }, - optional: opts, - } - - var resp *response - if resp, e = c.loadBalancerApi.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{ - name: resourceLoadBalancers, - ids: urlParts{ - 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/oracle/bmcs-go-sdk/loadbalancer_certificate.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_certificate.go deleted file mode 100644 index 1663fdabbc..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_certificate.go +++ /dev/null @@ -1,135 +0,0 @@ -// 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 - CertificateName string `header:"-" url:"-" json:"certificateName"` - PublicCertificate string `header:"-" url:"-" json:"publicCertificate"` - PrivateKey string `header:"-" url:"-" json:"privateKey,omitempty"` // Only for create - // Optional - CACertificate string `header:"-" url:"-" json:"caCertificate,omitempty"` - Passphrase string `header:"-" url:"-" json:"passphrase,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{ - CertificateName: certificateName, - PublicCertificate: publicCertificate, - PrivateKey: privateKey, - CACertificate: caCertificate, - Passphrase: passphrase, - } - - details := &requestDetails{ - name: resourceLoadBalancers, - ids: urlParts{ - loadBalancerID, - resourceCertificates, - }, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.loadBalancerApi.postRequest(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{ - name: resourceLoadBalancers, - ids: urlParts{ - 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{ - name: resourceLoadBalancers, - ids: urlParts{ - 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/oracle/bmcs-go-sdk/loadbalancer_healthchecker.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_healthchecker.go deleted file mode 100644 index fa87f61edb..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_healthchecker.go +++ /dev/null @@ -1,80 +0,0 @@ -// 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 - Protocol string `url:"-" header:"-" json:"protocol"` // TODO: add validation in provider, must be in {"HTTP","TCP"} - URLPath string `url:"-" header:"-" json:"urlPath"` - // Optional - IntervalInMS int `url:"-" header:"-" json:"intervalInMillis,omitempty"` // Default: 10000 - Port int `url:"-" header:"-" json:"port,omitempty"` // Default: 0 - ResponseBodyRegex string `url:"-" header:"-" json:"responseBodyRegex,omitempty"` // Default: ".*", - Retries int `url:"-" header:"-" json:"retries,omitempty"` // Default: 3 - ReturnCode int `url:"-" header:"-" json:"returnCode,omitempty"` // Default: 200 - TimeoutInMS int `url:"-" header:"-" json:"timeoutInMillis,omitempty"` // Default: 3000, - -} - -// 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/oracle/bmcs-go-sdk/loadbalancer_listener.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_listener.go deleted file mode 100644 index f3f6a0f0c7..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_listener.go +++ /dev/null @@ -1,130 +0,0 @@ -// 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 `header:"-" url:"-" json:"defaultBackendSetName"` - Name string `header:"-" url:"-" json:"name,omitempty"` // Only for create - Port int `header:"-" url:"-" json:"port"` - Protocol string `header:"-" url:"-" json:"protocol"` // TODO: add validation in provider, For valid values see ListProtocols() - SSLConfig *SSLConfiguration `header:"-" url:"-" json:"sslConfiguration,omitempty"` -} - -// 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{ - name: resourceLoadBalancers, - ids: urlParts{ - loadBalancerID, - resourceListeners, - }, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.loadBalancerApi.postRequest(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{ - name: resourceLoadBalancers, - ids: urlParts{ - loadBalancerID, - resourceListeners, - listenerName, - }, - optional: opts, - } - - var resp *response - if resp, e = c.loadBalancerApi.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{ - name: resourceLoadBalancers, - ids: urlParts{ - loadBalancerID, - resourceListeners, - listenerName, - }, - optional: opts, - } - - var resp *response - if resp, e = c.loadBalancerApi.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/oracle/bmcs-go-sdk/loadbalancer_loadbalancer.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_loadbalancer.go deleted file mode 100644 index 299911b31e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_loadbalancer.go +++ /dev/null @@ -1,180 +0,0 @@ -// 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 - CompartmentID string `json:"compartmentId"` - DisplayName string `json:"displayName"` - ID string `json:"id"` - IPAddresses []IPAddress `json:"ipAddresses"` // TODO: is there a better way? - IsPrivate bool `json:"isPrivate"` - Shape string `json:"shapeName"` - State string `json:"lifecycleState"` - SubnetIDs []string `json:"subnetIds"` - TimeCreated Time `json:"timeCreated"` - BackendSets map[string]BackendSet `json:"backendSets"` - Certificates map[string]Certificate `json:"certificates"` - Listeners map[string]Listener `json:"listeners"` -} - -type IPAddress struct { - IPAddress string `json:"ipAddress"` -} - -// 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:"-"` - IsPrivate bool `header:"-" json:"isPrivate,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 *CreateLoadBalancerOptions) (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.postRequest(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{ - name: resourceLoadBalancers, - ids: urlParts{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{ - name: 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 *UpdateLoadBalancerOptions) (workRequestID string, e error) { - // TODO: Determine if any parameters to the load balancer API are optional. - details := &requestDetails{ - name: resourceLoadBalancers, - ids: urlParts{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{ - name: resourceLoadBalancers, - ids: urlParts{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/oracle/bmcs-go-sdk/loadbalancer_loadbalancer_test.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_loadbalancer_test.go deleted file mode 100644 index 8403dc1145..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_loadbalancer_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *LoadbalancerTestSuite) TestCreateLoadbalancer() { - res := &LoadBalancer{ - CompartmentID: "compartmentID", - DisplayName: "displayName", - ID: "id1", - IPAddresses: []IPAddress{IPAddress{"123"}}, - IsPrivate: false, - Shape: "100Mbps", - State: ResourceProvisioning, - SubnetIDs: []string{"subnetId1"}, - TimeCreated: Time{Time: time.Now()}, - } - - opts := &CreateLoadBalancerOptions{} - opts.DisplayName = res.DisplayName - opts.IsPrivate = false - - required := CreateLoadBalancerDetails{ - Shape: res.Shape, - SubnetIDs: res.SubnetIDs, - } - required.CompartmentID = res.CompartmentID - - details := &requestDetails{ - name: resourceLoadBalancers, - optional: opts, - required: required, - } - - workReqId := "ocid1.loadbalancerworkrequest.oc1.phx.aaaaaaaa" - header := http.Header{} - header.Set(headerOPCWorkRequestID, workReqId) - resp := &response{ - header: header, - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateLoadBalancer( - nil, - nil, - res.CompartmentID, - nil, - res.Shape, - res.SubnetIDs, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(workReqId, actual) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_policy.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_policy.go deleted file mode 100644 index 74539b98d9..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_policy.go +++ /dev/null @@ -1,50 +0,0 @@ -// 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{ - name: 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/oracle/bmcs-go-sdk/loadbalancer_protocol.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_protocol.go deleted file mode 100644 index 9e70bd2d7e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_protocol.go +++ /dev/null @@ -1,50 +0,0 @@ -// 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{ - name: 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/oracle/bmcs-go-sdk/loadbalancer_shape.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_shape.go deleted file mode 100644 index 007fdbf740..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_shape.go +++ /dev/null @@ -1,51 +0,0 @@ -// 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/oracle/bmcs-go-sdk/loadbalancer_test.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_test.go deleted file mode 100644 index 3b8717251e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_test.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "testing" - - "github.com/stretchr/testify/suite" -) - -type LoadbalancerTestSuite struct { - suite.Suite - requestor *mockRequestor - nilHeader http.Header -} - -func (s *LoadbalancerTestSuite) SetupTest() { - s.requestor = newMockRequestor(s) -} - -func TestRunLoadbalancerTests(t *testing.T) { - suite.Run(t, new(LoadbalancerTestSuite)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_workrequest.go b/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_workrequest.go deleted file mode 100644 index debb6a61bf..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/loadbalancer_workrequest.go +++ /dev/null @@ -1,89 +0,0 @@ -// 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/oracle/bmcs-go-sdk/object_storage_bucket.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket.go deleted file mode 100644 index eb87069706..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket.go +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// Bucket stores arbitrary objects on a given key -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/Bucket/ - -type Bucket struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - Namespace Namespace `json:"namespace"` - Name string `json:"name"` - CompartmentID string `json:"compartmentId"` - Metadata map[string]string `json:"metadata"` - CreatedBy string `json:"createdBy"` - TimeCreated Time `json:"timeCreated"` - AccessType BucketAccessType `json:"publicAccessType"` -} - -// CreateBucket initializes and creates a storage bucket. Namespace is -// set in the opts parameter. See Oracle documentation for more information -// on other arguments. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/Bucket/CreateBucket -func (c *Client) CreateBucket( - compartmentID string, - name string, - namespaceName Namespace, - opts *CreateBucketOptions, -) (bckt *Bucket, e error) { - - required := struct { - ocidRequirement - Name string `header:"-" json:"name" url:"-"` - }{ - Name: name, - } - required.CompartmentID = compartmentID - - details := &requestDetails{ - ids: urlParts{namespaceName, resourceBuckets}, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.objectStorageApi.postRequest(details); e != nil { - return - } - - bckt = &Bucket{} - e = resp.unmarshal(bckt) - return -} - -// GetBucket gets the current representation of the given bucket in the given namespace. -// -// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/Bucket/GetBucket -func (c *Client) GetBucket( - bucketName string, - namespaceName Namespace, -) (bckt *Bucket, e error) { - details := &requestDetails{ - ids: urlParts{namespaceName, resourceBuckets, bucketName}, - } - - var resp *response - if resp, e = c.objectStorageApi.getRequest(details); e != nil { - return - } - - bckt = &Bucket{} - e = resp.unmarshal(bckt) - return -} - -// UpdateBucket performs a partial (or full) update of a bucket, currently including just the user-defined metadata -// -// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/Bucket/UpdateBucket -func (c *Client) UpdateBucket( - compartmentID string, - name string, - namespaceName Namespace, - opts *UpdateBucketOptions, -) (bckt *Bucket, e error) { - - required := struct { - ocidRequirement - }{} - required.CompartmentID = compartmentID - - details := &requestDetails{ - ids: urlParts{namespaceName, resourceBuckets, name}, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.objectStorageApi.postRequest(details); e != nil { - return - } - - bckt = &Bucket{} - e = resp.unmarshal(bckt) - return -} - -// DeleteBucket deletes a bucket if it is already empty. If the bucket is not empty, use DeleteObject first. -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/Bucket/DeleteBucket -func (c *Client) DeleteBucket( - name string, - namespaceName Namespace, - opts *IfMatchOptions, -) (e error) { - required := struct { - ocidRequirement - Name string `header:"-" json:"name" url:"-"` - }{ - Name: name, - } - - details := &requestDetails{ - ids: urlParts{namespaceName, resourceBuckets, name}, - optional: opts, - required: required, - } - - return c.objectStorageApi.deleteRequest(details) -} - -type HeadBucket struct { - OPCRequestIDUnmarshaller - ETagUnmarshaller - OPCClientRequestIDUnmarshaller -} - -type HeadBucketOptions struct { - IfMatchOptions - IfNoneMatchOptions - OPCClientRequestIDUnmarshaller -} - -// HeadBucket checks that a bucket exists and returns the ETag -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/methods/HeadBucket -func (c *Client) HeadBucket( - namespace Namespace, - bucketName string, - opts *HeadBucketOptions, -) (headBucket *HeadBucket, e error) { - - var required interface{} - details := &requestDetails{ - ids: urlParts{ - namespace, - resourceBuckets, - bucketName, - }, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.objectStorageApi.getRequest(details); e != nil { - return - } - - headBucket = &HeadBucket{} - e = resp.unmarshal(headBucket) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket_summary.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket_summary.go deleted file mode 100644 index 61d73c3e96..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket_summary.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "time" -) - -// BucketSummary is the list representation of a bucket -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/BucketSummary/ - -type BucketSummary struct { - Namespace Namespace `json:"namespace"` - Name string `json:"name"` - CompartmentID string `json:"compartmentId"` - CreatedBy string `json:"createdBy"` - TimeCreated time.Time `json:"timeCreated"` - ETag string `json:"etag"` -} - -type ListBuckets struct { - OPCRequestIDUnmarshaller - NextPageUnmarshaller - OPCClientRequestIDUnmarshaller - BucketSummaries []BucketSummary -} - -func (ref *ListBuckets) GetList() interface{} { - return &ref.BucketSummaries -} - -// ListBuckets returns BucketSummaries for all the buckets in a namespace -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/BucketSummary/ListBuckets -func (c *Client) ListBuckets( - compartmentID string, - namespaceName Namespace, - opts *ListBucketsOptions, -) (buckets *ListBuckets, e error) { - - required := listOCIDRequirement{} - required.CompartmentID = compartmentID - - details := &requestDetails{ - ids: urlParts{namespaceName, resourceBuckets}, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.objectStorageApi.getRequest(details); e != nil { - return - } - - buckets = &ListBuckets{} - e = resp.unmarshal(buckets) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket_summary_test.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket_summary_test.go deleted file mode 100644 index e22231fd01..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket_summary_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *ObjectStorageTestSuite) TestListBuckets() { - bucket := BucketSummary{ - Namespace: "namespace", - Name: "name", - CompartmentID: "compartment", - CreatedBy: "someone", - TimeCreated: time.Now(), - ETag: "string", - } - buckets := &ListBuckets{ - BucketSummaries: []BucketSummary{ - bucket, - }, - } - - opts := &ListBucketsOptions{} - - required := listOCIDRequirement{} - required.CompartmentID = bucket.CompartmentID - - details := &requestDetails{ - ids: urlParts{bucket.Namespace, resourceBuckets}, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(buckets.BucketSummaries), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, err := s.requestor.ListBuckets( - bucket.CompartmentID, - bucket.Namespace, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(buckets.BucketSummaries[0].Name, actual.BucketSummaries[0].Name) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket_test.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket_test.go deleted file mode 100644 index 9567bd6456..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_bucket_test.go +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *ObjectStorageTestSuite) TestCreateBucket() { - metadata := map[string]string{ - "foo": "bar", - } - timeCreated := Time{ - Time: time.Now(), - } - - bucket := &Bucket{ - Namespace: "namespace", - Name: "name", - CompartmentID: "compartmentID", - Metadata: metadata, - CreatedBy: "userOCID", - TimeCreated: timeCreated, - AccessType: ObjectRead, - } - - opts := &CreateBucketOptions{ - Metadata: metadata, - AccessType: ObjectRead, - } - - required := struct { - ocidRequirement - Name string `header:"-" json:"name" url:"-"` - }{ - Name: bucket.Name, - } - required.CompartmentID = bucket.CompartmentID - - details := &requestDetails{ - ids: urlParts{bucket.Namespace, resourceBuckets}, - optional: opts, - required: required, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(bucket), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreateBucket( - bucket.CompartmentID, - bucket.Name, - bucket.Namespace, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(bucket.CompartmentID, actual.CompartmentID) - s.Equal(bucket.AccessType, actual.AccessType) -} - -func (s *ObjectStorageTestSuite) TestGetBucket() { - bucket := &Bucket{ - Namespace: "namespace", - Name: "name", - CompartmentID: "compartmentID", - Metadata: nil, - CreatedBy: "userOCID", - TimeCreated: Time{Time: time.Now()}, - AccessType: NoPublicAccess, - } - - details := &requestDetails{ - ids: urlParts{bucket.Namespace, resourceBuckets, bucket.Name}, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - resp := &response{ - body: marshalObjectForTest(bucket), - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetBucket(bucket.Name, bucket.Namespace) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(bucket.Namespace, actual.Namespace) - s.Equal(bucket.AccessType, NoPublicAccess) - s.Equal("ETAG", actual.ETag) -} - -func (s *ObjectStorageTestSuite) TestUpdateBucket() { - metadata := map[string]string{ - "foo": "bar", - } - - timeCreated := Time{ - Time: time.Now(), - } - - bucket := &Bucket{ - Namespace: "namespace", - Name: "name", - CompartmentID: "compartmentID", - Metadata: metadata, - CreatedBy: "userOCID", - TimeCreated: timeCreated, - AccessType: NoPublicAccess, - } - - respHeaders := http.Header{} - respHeaders.Set(headerETag, "ETAG!") - - new_metadata := map[string]string{ - "foo": "bar!", - } - opts := &UpdateBucketOptions{ - Metadata: new_metadata, - AccessType: ObjectRead, - } - - required := struct { - ocidRequirement - }{} - required.CompartmentID = bucket.CompartmentID - - details := &requestDetails{ - ids: urlParts{bucket.Namespace, resourceBuckets, bucket.Name}, - optional: opts, - required: required, - } - - bucket_updated := &Bucket{ - Namespace: "namespace", - Name: "name", - CompartmentID: "compartmentID", - Metadata: new_metadata, - CreatedBy: "userOCID", - TimeCreated: timeCreated, - AccessType: ObjectRead, - } - - resp := &response{ - header: respHeaders, - body: marshalObjectForTest(bucket_updated), - } - - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.UpdateBucket( - bucket.CompartmentID, - bucket.Name, - bucket.Namespace, - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal("ETAG!", actual.ETag) - s.Equal(new_metadata, actual.Metadata) - s.Equal(bucket_updated.AccessType, actual.AccessType) -} - -func (s *ObjectStorageTestSuite) TestDeleteBucket() { - s.testDeleteResource( - resourceBuckets, "name", "namespace", s.requestor.DeleteBucket, - ) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_namespace.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_namespace.go deleted file mode 100644 index 882609c40e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_namespace.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "errors" - "reflect" - "strings" -) - -// Namespace is the top level organizational level of the object store -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/methods/GetNamespace - -type Namespace string - -// SetBody takes a slice of bytes b, trims off '"' characters, and populates a slice of bytes toBeFilled -func (g *Namespace) SetBody(b []byte, toBeFilled interface{}) error { - rv := reflect.ValueOf(toBeFilled) - if rv.Kind() != reflect.Ptr || rv.IsNil() { - return errors.New("Value passed to unmarshal is not a pointer") - } - s := strings.Trim(string(b), "\"") - rv.Elem().SetString(s) - return nil -} - -// GetNamespace fetches the current user's namespace -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/methods/GetNamespace -func (c *Client) GetNamespace() (name *Namespace, e error) { - var opts interface{} - var required interface{} - details := &requestDetails{ - ids: urlParts{}, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.objectStorageApi.getRequest(details); e != nil { - return - } - - name = new(Namespace) - e = resp.unmarshal(name) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_namespace_test.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_namespace_test.go deleted file mode 100644 index 0179391c60..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_namespace_test.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -func (s *ObjectStorageTestSuite) TestGetNamespace() { - - var opts interface{} - var required interface{} - - details := &requestDetails{ - ids: urlParts{}, - optional: opts, - required: required, - } - - namespace := "namespacename" - resp := &response{ - body: []byte(namespace), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, err := s.requestor.GetNamespace() - - s.Nil(err) - s.NotNil(actual) - s.Equal(namespace, string(*actual)) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_objects.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_objects.go deleted file mode 100644 index 0e39ea0fdd..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_objects.go +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "errors" - "net/http" - "reflect" - "time" -) - -type ObjectSummary struct { - Name string `json:"name"` - Size uint64 `json:"size"` - MD5 string `json:"md5"` - TimeCreated time.Time `json:"timeCreated"` -} - -type ListObjects struct { - OPCClientRequestIDUnmarshaller - OPCRequestIDUnmarshaller - Objects []ObjectSummary `json:"objects"` - Prefixes []string `json:"prefixes"` - NextStartWith string `json:"nextStartWith"` -} - -type HeadObject struct { - ContentUnmarshaller - ETagUnmarshaller - LastModifiedUnmarshaller - MetadataUnmarshaller - OPCClientRequestIDUnmarshaller - OPCRequestIDUnmarshaller - ID string - Bucket string - Namespace Namespace -} - -// Object is an item stored in ObjectStorage -type Object struct { - HeadObject - Size uint64 - TraceID string - Body []byte -} - -func (g *Object) SetBody(b []byte, toBeFilled interface{}) error { - rv := reflect.ValueOf(toBeFilled) - if rv.Kind() != reflect.Ptr || rv.IsNil() { - return errors.New("Value passed to unmarshal is not a pointer") - } - if po, ok := toBeFilled.(*Object); ok { - po.Body = b - } else { - return errors.New("Value passed in was not an Object") - } - return nil -} - -type DeleteObject struct { - OPCRequestIDUnmarshaller - OPCClientRequestIDUnmarshaller - LastModifiedUnmarshaller -} - -// ListObjects lists objects -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/ListObjects/ListObjects -func (c *Client) ListObjects(namespace Namespace, bucket string, opts *ListObjectsOptions) (objects *ListObjects, e error) { - details := &requestDetails{ - ids: urlParts{ - namespace, - resourceBuckets, - bucket, - resourceObjects, - }, - optional: opts, - } - - var resp *response - if resp, e = c.objectStorageApi.getRequest(details); e != nil { - return - } - - objects = &ListObjects{} - e = resp.unmarshal(objects) - return -} - -// GetObject fetches an object from object storage -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/methods/GetObject -func (c *Client) GetObject( - namespace Namespace, - bucketName string, - objectName string, - opts *GetObjectOptions, -) (object *Object, e error) { - details := &requestDetails{ - ids: urlParts{ - namespace, - resourceBuckets, - bucketName, - resourceObjects, - objectName, - }, - optional: opts, - } - - var resp *response - if resp, e = c.objectStorageApi.getRequest(details); e != nil { - return - } - - object = &Object{} - e = resp.unmarshal(object) - object.Namespace = namespace - object.Bucket = bucketName - object.ID = objectName - return -} - -// DeleteObject deletes an object from object storage -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/methods/DeleteObject -func (c *Client) DeleteObject( - namespace Namespace, - bucketName string, - objectName string, - opts *DeleteObjectOptions, -) (object *DeleteObject, e error) { - - details := &requestDetails{ - ids: urlParts{ - namespace, - resourceBuckets, - bucketName, - resourceObjects, - objectName, - }, - optional: opts, - } - - var resp *response - if resp, e = c.objectStorageApi.request(http.MethodDelete, details); e != nil { - return - } - - object = &DeleteObject{} - e = resp.unmarshal(object) - return -} - -// HeadObject fetches the user defined metadata for an object -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/methods/HeadObject -func (c *Client) HeadObject( - namespace Namespace, - bucketName string, - objectName string, - opts *HeadObjectOptions, -) (headObject *HeadObject, e error) { - - details := &requestDetails{ - ids: urlParts{ - namespace, - resourceBuckets, - bucketName, - resourceObjects, - objectName, - }, - optional: opts, - } - - var resp *response - if resp, e = c.objectStorageApi.request(http.MethodHead, details); e != nil { - return - } - - headObject = &HeadObject{} - e = resp.unmarshal(headObject) - headObject.Namespace = namespace - headObject.Bucket = bucketName - headObject.ID = objectName - return -} - -// PutObject updates an object in object storage -// -// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/methods/PutObject -func (c *Client) PutObject( - namespace Namespace, - bucketName string, - objectName string, - content []byte, - opts *PutObjectOptions, -) (object *Object, e error) { - - required := struct { - bodyRequirement - ContentLength uint64 `header:"Content-Length" json:"-" url:"-"` - }{ - ContentLength: uint64(len(content)), - } - required.Body = content - - // application/json gets added by default if content-type is not specified. This is not desirable - // for object storage, so override empty content-type with the object storage default - if opts == nil { - opts = &PutObjectOptions{} - } - if opts.ContentType == "" { - opts.ContentType = "application/octet-stream" - } - - details := &requestDetails{ - ids: urlParts{ - namespace, - resourceBuckets, - bucketName, - resourceObjects, - objectName, - }, - optional: opts, - required: required, - } - - var resp *response - if resp, e = c.objectStorageApi.request(http.MethodPut, details); e != nil { - return - } - - object = &Object{} - e = resp.unmarshal(object) - object.Namespace = namespace - object.Bucket = bucketName - object.ID = objectName - object.Body = content - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_objects_test.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_objects_test.go deleted file mode 100644 index f44d44c53e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_objects_test.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "time" -) - -func (s *ObjectStorageTestSuite) TestListObject() { - var reqs interface{} - namespace := Namespace("namespace") - bucket := "bucket" - opts := &ListObjectsOptions{} - details := &requestDetails{ - ids: urlParts{ - - namespace, - resourceBuckets, - bucket, - resourceObjects, - }, - optional: opts, - required: reqs, - } - - expected := &ListObjects{ - Objects: []ObjectSummary{ - { - Name: "name", - Size: 150, - MD5: "md5", - TimeCreated: time.Now(), - }, - }, - Prefixes: []string{""}, - NextStartWith: "namea", - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(expected), - } - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, err := s.requestor.ListObjects(namespace, bucket, opts) - - s.Nil(err) - s.NotNil(actual) - s.Equal(expected.Objects[0].Name, actual.Objects[0].Name) -} - -func (s *ObjectStorageTestSuite) TestGetObject() { - namespaceID := Namespace("namespace1") - bucketID := "bucket1" - objectID := "object1" - opts := &GetObjectOptions{} - var reqs interface{} - body := []byte("testBody") - - object := &Object{ - Body: body, - } - - details := &requestDetails{ - ids: urlParts{namespaceID, resourceBuckets, bucketID, resourceObjects, objectID}, - optional: opts, - required: reqs, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - headers.Set(headerContentLength, "") - resp := &response{ - body: object.Body, - header: headers, - } - - s.requestor.On("getRequest", details).Return(resp, nil) - - actual, e := s.requestor.GetObject(namespaceID, bucketID, objectID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(object.Body, actual.Body) - s.Equal("ETAG", actual.ETag) -} - -func (s *ObjectStorageTestSuite) TestDeleteObject() { - namespaceID := Namespace("namespace1") - bucketID := "bucket1" - objectID := "object1" - opts := &DeleteObjectOptions{} - var reqs interface{} - - object := &DeleteObject{} - - details := &requestDetails{ - ids: urlParts{namespaceID, resourceBuckets, bucketID, resourceObjects, objectID}, - optional: opts, - required: reqs, - } - - resp := &response{ - body: marshalObjectForTest(object), - } - - s.requestor.On("request", http.MethodDelete, details).Return(resp, nil) - - actual, e := s.requestor.DeleteObject(namespaceID, bucketID, objectID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) -} - -func (s *ObjectStorageTestSuite) TestHeadObject() { - namespaceID := Namespace("namespace1") - bucketID := "bucket1" - objectID := "object1" - opts := &HeadObjectOptions{} - var reqs interface{} - - object := &HeadBucket{} - object.ETag = "ETAG" - object.ClientRequestID = "reqID" - - details := &requestDetails{ - ids: urlParts{namespaceID, resourceBuckets, bucketID, resourceObjects, objectID}, - optional: opts, - required: reqs, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - headers.Set(headerContentLength, "0") - resp := &response{ - body: marshalObjectForTest(object), - header: headers, - } - - s.requestor.On("request", http.MethodHead, details).Return(resp, nil) - - actual, e := s.requestor.HeadObject(namespaceID, bucketID, objectID, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(object.ETag, actual.ETag) -} - -// &baremetal.requestDetails{ids:baremetal.urlParts{"n", "namespace1", "b", "bucket1", "o", "object1"}, name:"", optional:(*baremetal.PutObjectOptions)(0xc82035a870), required:struct { baremetal.bodyRequirement; ContentLength uint64 "header:\"Content-Lengt -// h\" json:\"-\" url:\"-\"" }{bodyRequirement:baremetal.bodyRequirement{Body:[]uint8{0x74, 0x65, 0x73, 0x74, 0x42, 0x6f, 0x64, 0x79}}, ContentLength:0x8}} - -func (s *ObjectStorageTestSuite) TestPutObject() { - namespaceID := Namespace("namespace1") - bucketID := "bucket1" - objectID := "object1" - - content := []byte("testBody") - - required := struct { - bodyRequirement - ContentLength uint64 `header:"Content-Length" json:"-" url:"-"` - }{ - ContentLength: uint64(len(content)), - } - required.Body = content - - opts := &PutObjectOptions{} - - details := &requestDetails{ - ids: urlParts{namespaceID, resourceBuckets, bucketID, resourceObjects, objectID}, - optional: opts, - required: required, - } - - headers := http.Header{} - headers.Set(headerETag, "ETAG") - headers.Set(headerContentLength, "8") - resp := &response{ - body: required.Body, - header: headers, - } - - s.requestor.On("request", http.MethodPut, details).Return(resp, nil) - - actual, e := s.requestor.PutObject(namespaceID, bucketID, objectID, content, opts) - - s.requestor.AssertExpectations(s.T()) - s.Nil(e) - s.NotNil(actual) - s.Equal(required.Body, actual.Body) - s.Equal("ETAG", actual.ETag) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_preauthenticated_request.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_preauthenticated_request.go deleted file mode 100644 index 5001f49cc8..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_preauthenticated_request.go +++ /dev/null @@ -1,126 +0,0 @@ -package baremetal - -type PreauthenticatedRequest struct { - ID string `json:"id"` - Name string `json:"name"` - ObjectName string `json:"objectName"` - AccessURI string `json:"accessUri"` - AccessType PARAccessType `json:"accessType"` - TimeExpires Time `json:"timeExpires"` - TimeCreated Time `json:"timeCreated"` -} - -type PreauthenticatedRequestSummary struct { - ID string `json:"id"` - Name string `json:"name"` - ObjectName string `json:"objectName"` - AccessType PARAccessType `json:"accessType"` - TimeExpires Time `json:"timeExpires"` - TimeCreated Time `json:"timeCreated"` -} - -type ListPreauthenticatedRequests struct { - OPCClientRequestIDUnmarshaller - OPCRequestIDUnmarshaller - NextPageUnmarshaller - PreauthenticatedRequests []PreauthenticatedRequestSummary -} - -func buildPARUrlParts(namespace Namespace, bucketName string, rest ...interface{}) urlParts { - fixedParts := urlParts{namespace, resourceBuckets, bucketName, resourcePAR} - parts := fixedParts - for _, elem := range rest { - parts = append(parts, elem) - } - return parts -} - -// CreatePreauthenticatedRequest creates a url that can be used to -// access an object or a bucket with a url. The preauthenticated request is identified by its id -// See Oracle documentation for more information -// -//https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/PreauthenticatedRequest/CreatePreauthenticatedRequest -func (c *Client) CreatePreauthenticatedRequest( - namespace Namespace, - bucketName string, - parDetails *CreatePreauthenticatedRequestDetails, - -) (par *PreauthenticatedRequest, e error) { - details := requestDetails{ - ids: buildPARUrlParts(namespace, bucketName), - name: resourcePAR, - required: parDetails, - } - - var res *response - if res, e = c.objectStorageApi.postRequest(&details); e != nil { - return - } - par = &PreauthenticatedRequest{} - e = res.unmarshal(&par) - return -} - -// DeletePreauthenticatedRequest deletes a preauthenticated request by its id. -// -// https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/PreauthenticatedRequest/DeletePreauthenticatedRequest -func (c *Client) DeletePreauthenticatedRequest(namespace Namespace, - bucketName string, - parId string, - options *ClientRequestOptions, -) (e error) { - details := &requestDetails{ - ids: buildPARUrlParts(namespace, bucketName, parId), - optional: options, - } - - return c.objectStorageApi.deleteRequest(details) -} - -// Gets information about a previously created preauthenticated request -// -// https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/PreauthenticatedRequestSummary/GetPreauthenticatedRequest -func (c *Client) GetPreauthenticatedRequest(namespace Namespace, - bucketName string, - parId string, - options *ClientRequestOptions, -) (par *PreauthenticatedRequestSummary, e error) { - details := requestDetails{ - ids: buildPARUrlParts(namespace, bucketName, parId), - optional: options, - } - var res *response - if res, e = c.objectStorageApi.getRequest(&details); e != nil { - return - } - par = &PreauthenticatedRequestSummary{} - e = res.unmarshal(&par) - return - -} - -// Lists preauthenticated request on a give bucket, optionally receives a prefix for filtering by name -// -//https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/PreauthenticatedRequestSummary/ListPreauthenticatedRequests -func (c *Client) ListPreauthenticatedRequests( - namespace Namespace, - bucketName string, - opt *ListPreauthenticatedRequestOptions) (parList *ListPreauthenticatedRequests, e error) { - details := requestDetails{ - ids: buildPARUrlParts(namespace, bucketName), - optional: opt, - } - - var resp *response - if resp, e = c.objectStorageApi.getRequest(&details); e != nil { - return - } - - parList = &ListPreauthenticatedRequests{} - e = resp.unmarshal(parList) - return -} - -func (ref *ListPreauthenticatedRequests) GetList() []PreauthenticatedRequestSummary { - return ref.PreauthenticatedRequests -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_preauthenticated_request_test.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_preauthenticated_request_test.go deleted file mode 100644 index 63d9d83e73..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_preauthenticated_request_test.go +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "errors" - "net/http" - "time" - - "github.com/stretchr/testify/mock" -) - -func (s *ObjectStorageTestSuite) TestDeletePreauthenticatedRequest() { - namesp := Namespace("namesp") - opts := &ClientRequestOptions{} - details := &requestDetails{ - ids: buildPARUrlParts(namesp, "bucket1", "par1"), - optional: opts, - } - s.requestor.On("deleteRequest", details).Return(nil) - - e := s.requestor.DeletePreauthenticatedRequest(namesp, "bucket1", "par1", opts) - s.Nil(e) -} - -func (s *ObjectStorageTestSuite) TestDeletePreauthenticatedRequestError() { - namesp := Namespace("namesp") - opts := &ClientRequestOptions{} - details := &requestDetails{ - ids: buildPARUrlParts(namesp, "bucket1", "par1"), - optional: opts, - } - fe := errors.New("fake error") - s.requestor.On("deleteRequest", details).Return(fe) - - e := s.requestor.DeletePreauthenticatedRequest(namesp, "bucket1", "par1", opts) - s.NotNil(e) -} - -func (s *ObjectStorageTestSuite) TestCreatePreauthenticatedFailure() { - - namesp := Namespace("namesp") - opts := &CreatePreauthenticatedRequestDetails{} - details := &requestDetails{ - ids: buildPARUrlParts(namesp, "bucket1"), - name: resourcePAR, - required: opts, - } - - e := errors.New("fake error") - s.requestor.On("postRequest", details).Return(&response{}, e) - - actual, err := s.requestor.CreatePreauthenticatedRequest( - namesp, - "bucket1", - opts, - ) - - s.NotNil(err) - s.Nil(actual) -} - -func (s *ObjectStorageTestSuite) TestCreatePreauthenticatedRequest() { - var timecreated time.Time = time.Now() - timeCreated := Time{Time: timecreated} - timeExpires := Time{Time: timecreated.AddDate(0, 0, 1)} - namesp := Namespace("namesp") - - par := &PreauthenticatedRequest{ - ID: "string", - Name: "name", - AccessURI: "/some/uri", - ObjectName: "objectname", - TimeCreated: timeCreated, - AccessType: PARObjectRead, - TimeExpires: timeExpires, - } - - opts := &CreatePreauthenticatedRequestDetails{ - Name: "name", - ObjectName: "objectname", - AccessType: PARObjectRead, - TimeExpires: timeExpires, - } - - details := &requestDetails{ - ids: buildPARUrlParts(namesp, "bucket1"), - name: resourcePAR, - required: opts, - } - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(par), - } - s.requestor.On("postRequest", details).Return(resp, nil) - - actual, err := s.requestor.CreatePreauthenticatedRequest( - namesp, - "bucket1", - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(par.Name, actual.Name) - s.Equal(par.AccessURI, actual.AccessURI) - s.Equal(par.AccessType, actual.AccessType) - //s.Equal(par.TimeExpires.Unix(), actual.TimeExpires.Unix()) -} -func (s *ObjectStorageTestSuite) TestGetPreauthenticatedRequest() { - var timecreated time.Time = time.Now() - timeCreated := Time{Time: timecreated} - timeExpires := Time{Time: timecreated.AddDate(0, 0, 1)} - namesp := Namespace("namesp") - - par := &PreauthenticatedRequestSummary{ - ID: "string", - Name: "name", - ObjectName: "objectname", - AccessType: PARObjectRead, - TimeExpires: timeExpires, - TimeCreated: timeCreated, - } - - opts := &ClientRequestOptions{} - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(par), - } - s.requestor.On("getRequest", - mock.MatchedBy(func(req *requestDetails) bool { return true })).Return(resp, nil) - - actual, err := s.requestor.GetPreauthenticatedRequest( - namesp, - "bucket1", - "par1", - opts, - ) - - s.Nil(err) - s.NotNil(actual) - s.Equal(par.Name, actual.Name) - s.Equal(par.AccessType, actual.AccessType) - //s.Equal(par.TimeExpires, actual.TimeExpires) -} - -func (s *ObjectStorageTestSuite) TestGetPreauthenticatedRequestError() { - var timecreated time.Time = time.Now() - timeCreated := Time{Time: timecreated} - timeExpires := Time{Time: timecreated.AddDate(0, 0, 1)} - namesp := Namespace("namesp") - - par := &PreauthenticatedRequestSummary{ - ID: "string", - Name: "name", - ObjectName: "objectname", - AccessType: PARObjectRead, - TimeExpires: timeExpires, - TimeCreated: timeCreated, - } - - opts := &ClientRequestOptions{} - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(par), - } - e := errors.New("fake error") - - s.requestor.On("getRequest", - mock.MatchedBy(func(req *requestDetails) bool { return true })). - Return(resp, e) - - actual, err := s.requestor.GetPreauthenticatedRequest( - namesp, - "bucket1", - "par1", - opts, - ) - - s.NotNil(err) - s.Nil(actual) -} -func (s *ObjectStorageTestSuite) TestListPreauthenticatedRequests() { - var timecreated time.Time = time.Now() - timeCreated := Time{Time: timecreated} - timeExpires := Time{Time: timecreated.AddDate(0, 0, 1)} - namesp := Namespace("namesp") - - parSum := &ListPreauthenticatedRequests{ - PreauthenticatedRequests: []PreauthenticatedRequestSummary{ - PreauthenticatedRequestSummary{ - ID: "par1", - Name: "name", - ObjectName: "objectname2", - AccessType: PARObjectRead, - TimeExpires: timeExpires, - TimeCreated: timeCreated, - }, - PreauthenticatedRequestSummary{ - ID: "par2", - Name: "name2", - ObjectName: "objectname2", - AccessType: PARObjectRead, - TimeExpires: timeExpires, - TimeCreated: timeCreated, - }, - }, - } - - opts := &ListPreauthenticatedRequestOptions{} - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(parSum), - } - - s.requestor.On("getRequest", - mock.MatchedBy(func(req *requestDetails) bool { return true })). - Return(resp, nil) - - actual, err := s.requestor.ListPreauthenticatedRequests(namesp, "bucket1", opts) - s.NotNil(actual) - s.Equal(2, len(actual.GetList())) - s.Nil(err) -} - -func (s *ObjectStorageTestSuite) TestListPreauthenticatedRequestsFailure() { - namesp := Namespace("namesp") - - opts := &ListPreauthenticatedRequestOptions{} - - resp := &response{ - header: http.Header{}, - body: marshalObjectForTest(opts), - } - - err := errors.New("fake error") - s.requestor.On("getRequest", - mock.MatchedBy(func(req *requestDetails) bool { return true })). - Return(resp, err) - - actual, actual_err := s.requestor.ListPreauthenticatedRequests(namesp, "bucket1", opts) - s.Nil(actual) - s.NotNil(err) - s.Equal(err, actual_err) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_test.go b/vendor/github.com/oracle/bmcs-go-sdk/object_storage_test.go deleted file mode 100644 index d38e7096a0..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/object_storage_test.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/http" - "testing" - - "github.com/stretchr/testify/suite" -) - -type ObjectStorageTestSuite struct { - suite.Suite - requestor *mockRequestor - nilHeader http.Header -} - -func (s *ObjectStorageTestSuite) SetupTest() { - s.requestor = newMockRequestor(s) -} - -func TestRunObjectStorageTests(t *testing.T) { - suite.Run(t, new(ObjectStorageTestSuite)) -} - -func (s *ObjectStorageTestSuite) testDeleteResource( - resourceName resourceName, - name string, - namespaceName Namespace, - funcUnderTest func(string, Namespace, *IfMatchOptions) error, -) { - required := struct { - ocidRequirement - Name string `header:"-" json:"name" url:"-"` - }{ - Name: name, - } - option := &IfMatchOptions{IfMatch: "abcd"} - - details := &requestDetails{ - ids: urlParts{namespaceName, resourceBuckets, name}, - optional: option, - required: required, - } - - s.requestor.On("deleteRequest", details).Return(nil) - - e := funcUnderTest(name, namespaceName, option) - s.requestor.AssertExpectations(s.T()) - s.Nil(e) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/request.go b/vendor/github.com/oracle/bmcs-go-sdk/request.go deleted file mode 100644 index 8e897532d0..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/request.go +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "encoding/json" - "net/http" - "net/url" - - "github.com/google/go-querystring/query" -) - -type urlParts []interface{} - -// request exists to support mocking. -// TODO: These marshal fns should be behind one single marshal -// func that takes a urlBuilder and an http.Method constant and -// returns a new http.Request via http.NewRequest to the requestor -// for further auth processing. -type request interface { - marshalBody() ([]byte, error) - marshalHeader() http.Header - marshalURL(string, string, urlBuilderFn) (val string, e error) -} - -// requestDetails is the concrete implementation of request. -// optional should always be a struct from request_options.go -// required should always be an anonymous struct that can, -// optionally, have one of the unexported structs from -// request_requirements.go embedded. -type requestDetails struct { - region string - urlTemplate string - ids urlParts - name resourceName - optional interface{} - required interface{} -} - -func objToJSONMap(val interface{}) (map[string]interface{}, error) { - marshaled, err := json.Marshal(val) - if err != nil { - return nil, err - } - jsonMap := make(map[string]interface{}) - if string(marshaled) == "null" { - return jsonMap, nil - } - err = json.Unmarshal(marshaled, &jsonMap) - return jsonMap, err -} - -func (r *requestDetails) marshalBody() (marshaled []byte, e error) { - if bm, ok := r.required.(bodyMarshaller); ok { - return bm.body(), nil - } - - required := r.required - if required == nil { - required = struct{}{} - } - requiredMap, err := objToJSONMap(required) - if err != nil { - return nil, err - } - - opts := r.optional - if opts == nil { - opts = struct{}{} - } - - optMap, err := objToJSONMap(opts) - if err != nil { - return nil, err - } - - // Override options with required in case of overlap - for k, v := range requiredMap { - optMap[k] = v - } - - marshaled, e = json.Marshal(optMap) - return -} - -func (r *requestDetails) marshalHeader() http.Header { - - // TODO: Error handling here. - var rHeader, oHeader http.Header - rHeader, _ = NewHeaderFromStruct(r.required) - oHeader, _ = NewHeaderFromStruct(r.optional) - - for k, v := range rHeader { - oHeader[k] = v - } - - if md, ok := r.optional.(MetadataUnmarshallable); ok { - // md may be nil and still be "ok" - if md != (*PutObjectOptions)(nil) { - prefix := "opc-meta-" - for name, val := range md.GetMetadata() { - oHeader[prefix+name] = []string{val} - } - } - } - - return oHeader -} - -func (r *requestDetails) marshalQueryString() (vals url.Values, e error) { - var rVals url.Values - if rVals, e = query.Values(r.required); e != nil { - return - } - if vals, e = query.Values(r.optional); e != nil { - return - } - for k, v := range rVals { - vals[k] = v - } - return -} - -func (r *requestDetails) marshalURL(urlTemplate string, region string, urlFn urlBuilderFn) (val string, e error) { - var q url.Values - if q, e = r.marshalQueryString(); e != nil { - return - } - val, e = urlFn(urlTemplate, region, r.name, q, r.ids...) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/request_headers.go b/vendor/github.com/oracle/bmcs-go-sdk/request_headers.go deleted file mode 100644 index 696385acf3..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/request_headers.go +++ /dev/null @@ -1,256 +0,0 @@ -// These helpers implement loading structs into http.Headers. -// -// As a simple example: -// -// type Options struct { -// IfMatch string `header:"if-match"` -// RetryToken string `header:"retry-token"` -// } -// -// opt := Options{ "6d82cbb050ddc7fa9cbb659014546e59", "my-custom-token" } - -// req, _ := http.NewRequest(http.MethodGet, url, nil) -// header.loadStruct(&req.Header, opts) -// -// The exact mapping between Go values and Header values is described in the -// documentation for the loadStruct() function. - -package baremetal - -import ( - "fmt" - "net/http" - "reflect" - "strconv" - "strings" - "time" -) - -var timeType = reflect.TypeOf(time.Time{}) - -// loadStruct encodes the field values of h and loads them into the provided -// http.Header. -// -// loadStruct expects to be passed a struct, and traverses it recursively using -// the following encoding rules. -// -// Each exported struct field is encoded and then loaded into the header unless -// -// - the field's tag is "-", or -// - the field is empty and its tag specifies the "omitempty" option -// -// The empty values are false, 0, any nil pointer or interface value, any array -// slice, map, or string of length zero, and any time.Time that returns true -// for IsZero(). -// -// The header field name defaults to the struct field name but can be -// specified in the struct field's tag value. The "header" key in the struct -// field's tag value is the key name, followed by an optional comma and -// options. For example: -// -// // Field is ignored by this package. -// Field int `header:"-"` -// -// // Field appears as header field "myName". -// Field int `header:"myName"` -// -// // Field appears as header field "myName" and the field is omitted if -// // its value is empty -// Field int `header:"myName,omitempty"` -// -// // Field appears as header field "Field" (the default), but the field -// // is skipped if empty. Note the leading comma. -// Field int `header:",omitempty"` -// -// For encoding individual field values, the following type-dependent rules -// apply: -// -// Boolean values default to encoding as the strings "true" or "false". -// Including the "int" option signals that the field should be encoded as the -// strings "1" or "0". -// -// time.Time values default to encoding as RFC3339 timestamps. Including the -// "unix" option signals that the field should be encoded as a Unix time (see -// time.Unix()) -// -// Slice and Array values are ignored. -// -// Anonymous struct fields are usually encoded as if their inner exported fields -// were fields in the outer struct, subject to the standard Go visibility rules. -// An anonymous struct field with a name given in its header tag is treated as -// having that name, rather than being anonymous. -// -// Non-nil pointer values are encoded as the value pointed to. -// -// Nested structs are ignored. -// -// All other values are encoded using their default string representation. -// -// Multiple fields that encode to the same header field will result in -// unpredictable behavior. -func NewHeaderFromStruct(v interface{}) (http.Header, error) { - header := make(http.Header) - if err := loadStruct(&header, v); err != nil { - return nil, err - } - return header, nil -} - -func loadStruct(header *http.Header, v interface{}) error { - val := reflect.ValueOf(v) - for val.Kind() == reflect.Ptr { - if val.IsNil() { - return nil - } - val = val.Elem() - } - - if v == nil { - return nil - } - - if val.Kind() != reflect.Struct { - return fmt.Errorf("header: NewFromStruct() expects struct input. Got %v", val.Kind()) - } - - err := reflectValue(header, val) - return err -} - -// reflectValue populates the header field from the struct fields in val. -// Embedded structs are followed recursively (using the rules defined in the -// Values function documentation) breadth-first. -func reflectValue(header *http.Header, val reflect.Value) error { - var embedded []reflect.Value - - typ := val.Type() - for i := 0; i < typ.NumField(); i++ { - sf := typ.Field(i) - if sf.PkgPath != "" && !sf.Anonymous { // unexported - continue - } - - sv := val.Field(i) - tag := sf.Tag.Get("header") - if tag == "-" { - continue - } - name, opts := parseTag(tag) - if name == "" { - if sf.Anonymous && sv.Kind() == reflect.Struct { - // save embedded struct for later processing - embedded = append(embedded, sv) - continue - } - - name = sf.Name - } - - if opts.Contains("omitempty") && isEmptyValue(sv) { - continue - } - - if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array { - continue - } - - if sv.Type() == timeType { - header.Set(name, valueString(sv, opts)) - continue - } - - for sv.Kind() == reflect.Ptr { - if sv.IsNil() { - break - } - sv = sv.Elem() - } - - if sv.Kind() == reflect.Struct { - continue - } - - header.Set(name, valueString(sv, opts)) - } - - for _, f := range embedded { - if err := reflectValue(header, f); err != nil { - return err - } - } - - return nil -} - -// valueString returns the string representation of a value. -func valueString(v reflect.Value, opts tagOptions) string { - for v.Kind() == reflect.Ptr { - if v.IsNil() { - return "" - } - v = v.Elem() - } - - if v.Kind() == reflect.Bool && opts.Contains("int") { - if v.Bool() { - return "1" - } - return "0" - } - - if v.Type() == timeType { - t := v.Interface().(time.Time) - if opts.Contains("unix") { - return strconv.FormatInt(t.Unix(), 10) - } - return t.Format(time.RFC3339) - } - - return fmt.Sprint(v.Interface()) -} - -// isEmptyValue checks if a value should be considered empty for the purposes -// of omitting fields with the "omitempty" option. -func isEmptyValue(v reflect.Value) bool { - switch v.Kind() { - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - } - - if v.Type() == timeType { - return v.Interface().(time.Time).IsZero() - } - - return false -} - -// tagOptions is the string following a comma in a struct field's "header" tag, or -// the empty string. It does not include the leading comma. -type tagOptions []string - -// parseTag splits a struct field's header tag into its name and comma-separated -// options. -func parseTag(tag string) (string, tagOptions) { - s := strings.Split(tag, ",") - return s[0], s[1:] -} - -// Contains checks whether the tagOptions contains the specified option. -func (o tagOptions) Contains(option string) bool { - for _, s := range o { - if s == option { - return true - } - } - return false -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/request_helpers.go b/vendor/github.com/oracle/bmcs-go-sdk/request_helpers.go deleted file mode 100644 index c7ffdd8dbc..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/request_helpers.go +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "bytes" - "crypto" - "crypto/rand" - "crypto/rsa" - "crypto/sha256" - "encoding/base64" - "encoding/json" - "fmt" - "io" - "net/http" - "strconv" - "strings" - "time" -) - -type authenticationInfo struct { - privateRSAKey *rsa.PrivateKey - tenancyOCID string - userOCID string - keyFingerPrint string -} - -var signerVersion = "1" - -func (a *authenticationInfo) getKeyID() string { - return fmt.Sprintf("%s/%s/%s", a.tenancyOCID, a.userOCID, a.keyFingerPrint) -} - -func getErrorFromResponse(body io.Reader, resp *http.Response) (apiError Error) { - apiError = Error{} - - if opcRequestID := resp.Header.Get(headerOPCRequestID); opcRequestID != "" { - apiError.OPCRequestID = opcRequestID - } - - if resp.Header.Get("content-type") != "application/json" { - buf := new(bytes.Buffer) - buf.ReadFrom(body) - apiError.Message = buf.String() - } else { - decoder := json.NewDecoder(body) - if e := decoder.Decode(&apiError); e != nil { - buf := new(bytes.Buffer) - buf.ReadFrom(decoder.Buffered()) - apiError.Message = buf.String() - } - } - apiError.Status = strconv.Itoa(resp.StatusCode) - - return -} - -func createAuthorizationHeader(request *http.Request, auth *authenticationInfo, userAgent string, body []byte) (e error) { - addRequiredRequestHeaders(request, userAgent, body) - var sig string - - if sig, e = computeSignature(request, auth.privateRSAKey); e != nil { - return - } - - signedHeaders := getSigningHeaders(request.Method) - headers := concatenateHeaders(signedHeaders) - - authValue := fmt.Sprintf("Signature version=\"%s\",headers=\"%s\",keyId=\"%s\",algorithm=\"rsa-sha256\",signature=\"%s\"", signerVersion, headers, auth.getKeyID(), sig) - - request.Header.Add("authorization", authValue) - - return -} - -func concatenateHeaders(headers []string) (concatenated string) { - - for _, header := range headers { - if len(concatenated) > 0 { - concatenated += " " - } - concatenated += header - } - - return -} - -func getSigningHeaders(method string) []string { - result := []string{ - "date", - "(request-target)", - "host", - } - - if method == http.MethodPost || method == http.MethodPut { - result = append(result, "content-length", "content-type", "x-content-sha256") - } - - return result -} - -func computeSignature(request *http.Request, privateKey *rsa.PrivateKey) (sig string, e error) { - signingString := getSigningString(request) - hasher := sha256.New() - hasher.Write([]byte(signingString)) - hashed := hasher.Sum(nil) - var unencodedSig []byte - unencodedSig, e = rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, hashed) - if e != nil { - return - } - - sig = base64.StdEncoding.EncodeToString(unencodedSig) - - return - -} - -func getSigningString(request *http.Request) string { - signingHeaders := getSigningHeaders(request.Method) - signingString := "" - for _, header := range signingHeaders { - if signingString != "" { - signingString += "\n" - } - - if header == "(request-target)" { - signingString += fmt.Sprintf("%s: %s", header, getRequestTarget(request)) - } else { - signingString += fmt.Sprintf("%s: %s", header, request.Header.Get(header)) - } - } - - return signingString - -} - -func getRequestTarget(request *http.Request) string { - lowercaseMethod := strings.ToLower(request.Method) - return fmt.Sprintf("%s %s", lowercaseMethod, request.URL.RequestURI()) -} - -func addIfNotPresent(dest *http.Header, key, value string) { - if dest.Get(key) == "" { - dest.Set(key, value) - } -} - -func getBodyHash(body []byte) string { - hash := sha256.Sum256(body) - return base64.StdEncoding.EncodeToString(hash[:]) -} - -func addRequiredRequestHeaders(request *http.Request, userAgent string, body []byte) { - addIfNotPresent(&request.Header, "content-type", "application/json") - addIfNotPresent(&request.Header, "date", time.Now().UTC().Format(http.TimeFormat)) - addIfNotPresent(&request.Header, "host", request.URL.Host) - if userAgent == "" { - addIfNotPresent(&request.Header, "User-Agent", fmt.Sprintf("baremetal-sdk-go-v%s", SDKVersion)) - } else { - addIfNotPresent(&request.Header, "User-Agent", userAgent) - } - addIfNotPresent(&request.Header, "accept", "*/*") - - if request.Method == http.MethodPost || request.Method == http.MethodPut { - addIfNotPresent(&request.Header, "content-length", strconv.FormatInt(request.ContentLength, 10)) - - if request.ContentLength > 0 { - addIfNotPresent(&request.Header, "x-content-sha256", getBodyHash(body)) - } - - } -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/request_options.go b/vendor/github.com/oracle/bmcs-go-sdk/request_options.go deleted file mode 100644 index 40565b5b52..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/request_options.go +++ /dev/null @@ -1,449 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -// Options -// To get the body, optional and required are marshalled and merged. -// To get the query string, optional and required are merged. -// To get the header, optional and required are merged. -// Required options get built inline within exported functions, based on -// function parameters. -// A single options struct gets passed to exported functions, representing -// optional params. -// Both required and optional fields need to explicitly tag header, json and -// url, excluding appropriately. - -type IfMatchOptions struct { - IfMatch string `header:"If-Match,omitempty" json:"-" url:"-"` -} - -type IfNoneMatchOptions struct { - IfNoneMatch string `header:"If-None-Match,omitempty" json:"-" url:"-"` -} - -type RetryTokenOptions struct { - RetryToken string `header:"opc-retry-token,omitempty" json:"-" url:"-"` -} - -type HeaderOptions struct { - IfMatchOptions - RetryTokenOptions -} - -type ClientRequestOptions struct { - OPCClientRequestID string `header:"opc-client-request-id,omitempty" json:"-" url:"-"` -} - -type DisplayNameOptions struct { - DisplayName string `header:"-" json:"displayName,omitempty" url:"-"` -} - -type VersionDateOptions struct { - VersionDate string `header:"-" json:"versionDate,omitempty" url:"-"` -} - -// Creation Options - -type CreateOptions struct { - RetryTokenOptions - DisplayNameOptions -} - -type CreateBucketOptions struct { - Metadata map[string]string `header:"-" json:"metadata,omitempty" url:"-"` - AccessType BucketAccessType `header:"-" json:"publicAccessType,omitempty" url:"-"` -} - -type CreatePreauthenticatedRequestDetails struct { - ClientRequestOptions - Name string `header:"-" json:"name" url:"-"` - ObjectName string `header:"-" json:"objectName,omitempty" url:"-"` - AccessType PARAccessType `header:"-" json:"accessType" url:"-"` - TimeExpires Time `header:"-" json:"timeExpires" url:"-"` -} - -type CreatePrivateIPOptions struct { - CreateOptions - HostnameLabel string `header:"-" json:"hostnameLabel,omitempty" url:"-"` - IPAddress string `header:"-" json:"ipAddress,omitempty" url:"-"` -} - -type CreateVcnOptions struct { - CreateOptions - DnsLabel string `header:"-" json:"dnsLabel,omitempty" url:"-"` -} - -type CreateSubnetOptions struct { - CreateOptions - DHCPOptionsID string `header:"-" json:"dhcpOptionsId,omitempty" url:"-"` - DNSLabel string `header:"-" json:"dnsLabel,omitempty" url:"-"` - ProhibitPublicIpOnVnic bool `header:"-" json:"prohibitPublicIpOnVnic,omitempty" url:"-"` - RouteTableID string `header:"-" json:"routeTableId,omitempty" url:"-"` - SecurityListIDs []string `header:"-" json:"securityListIds,omitempty" url:"-"` -} - -type AttachVnicOptions struct { - CreateOptions -} - -type LoadBalancerOptions struct { - ClientRequestOptions - RetryTokenOptions -} - -type CreateLoadBalancerOptions struct { - LoadBalancerOptions - DisplayNameOptions - IsPrivate bool `header:"-" json:"isPrivate,omitempty" url:"-"` -} - -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 UpdateLoadBalancerBackendOptions struct { - LoadBalancerOptions - Backup bool `header:"-" json:"backup" url:"-"` - Drain bool `header:"-" json:"drain" url:"-"` - Offline bool `header:"-" json:"offline" url:"-"` - Weight int `header:"-" json:"weight" url:"-"` -} - -type UpdateLoadBalancerBackendSetOptions struct { - LoadBalancerOptions - RetryTokenOptions - Backends []Backend `header:"-" json:"backends" 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,omitempty" 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 UpdatePrivateIPOptions struct { - UpdateOptions - HostnameLabel string `header:"-" json:"hostnameLabel,omitempty" url:"-"` - VnicID string `header:"-" json:"vnicId,omitempty" url:"-"` -} - -type UpdateVnicOptions struct { - UpdateOptions - HostnameLabel string `header:"-" json:"hostnameLabel,omitempty" url:"-"` - SkipSourceDestCheck *bool `header:"-" json:"skipSourceDestCheck,omitempty" url:"-"` -} - -type VolumeSourceDetails struct { - Id string `header:"-" json:"id" url:"-"` - Type string `header:"-" json:"type" url:"-"` -} - -type CreateVolumeOptions struct { - CreateOptions - SizeInMBs int `header:"-" json:"sizeInMBs,omitempty" url:"-"` - SizeInGBs int `header:"-" json:"sizeInGBs,omitempty" url:"-"` - VolumeBackupID string `header:"-" json:"volumeBackupId,omitempty" url:"-"` - VolumeSourceDetails *VolumeSourceDetails `header:"-" json:"sourceDetails,omitempty" url:"-"` -} - -type CreatePolicyOptions struct { - RetryTokenOptions - VersionDateOptions -} - -type CreateVnicOptions struct { - AssignPublicIp *bool `header:"-" json:"assignPublicIp,omitempty" url:"-"` - DisplayName string `header:"-" json:"displayName,omitempty" url:"-"` - HostnameLabel string `header:"-" json:"hostnameLabel,omitempty" url:"-"` - PrivateIp string `header:"-" json:"privateIp,omitempty" url:"-"` - SkipSourceDestCheck *bool `header:"-" json:"skipSourceDestCheck,omitempty" url:"-"` - SubnetID string `header:"-" json:"subnetId,omitempty" url:"-"` -} - -type LaunchInstanceOptions struct { - CreateOptions - CreateVnicOptions *CreateVnicOptions `header:"-" json:"createVnicDetails,omitempty" url:"-"` - HostnameLabel string `header:"-" json:"hostnameLabel,omitempty" url:"-"` - IpxeScript string `header:"-" json:"ipxeScript,omitempty" url:"-"` - Metadata map[string]string `header:"-" json:"metadata,omitempty" url:"-"` - ExtendedMetadata map[string]interface{} `header:"-" json:"extendedMetadata,omitempty" url:"-"` -} - -type LaunchDBSystemOptions struct { - CreateOptions - BackupSubnetId string `header:"-" json:"backupSubnetId,omitempty" url:"-"` - ClusterName string `header:"-" json:"clusterName,omitempty" url:"-"` - DataStoragePercentage int `header:"-" json:"dataStoragePercentage,omitempty" url:"-"` - DiskRedundancy DiskRedundancy `header:"-" json:"diskRedundancy,omitempty" url:"-"` - Domain string `header:"-" json:"domain,omitempty" url:"-"` - InitialDataStorageSizeInGB int `header:"-" json:"initialDataStorageSizeInGB,omitempty" url:"-"` - LicenseModel LicenseModel `header:"-" json:"licenseModel,omitempty" url:"-"` - NodeCount int `header:"-" json:"nodeCount,omitempty" url:"-"` -} - -type CreateDBHomeOptions struct { - DisplayNameOptions -} - -type CreateDatabaseOptions struct { - CharacterSet string - NCharacterSet string - DBWorkload string - PDBName string -} - -// Read Options - -type GetObjectOptions struct { - IfMatchOptions - IfNoneMatchOptions - ClientRequestOptions - Range string `header:"Range,omitempty" json:"-" url:"-"` -} - -// Update Options - -type UpdateOptions struct { - HeaderOptions - DisplayNameOptions -} - -type IfMatchDisplayNameOptions struct { - IfMatchOptions - DisplayNameOptions -} - -type UpdateBucketOptions struct { - IfMatchOptions - Name string `header:"-" json:"name,omitempty" url:"-"` - Namespace Namespace `header:"-" json:"namespace,omitempty" url:"-"` - AccessType BucketAccessType `header:"-" json:"publicAccessType,omitempty" url:"-"` - Metadata map[string]string `header:"-" json:"metadata,omitempty" url:"-"` -} - -type UpdateIdentityOptions struct { - IfMatchOptions - Description string `header:"-" json:"description,omitempty" url:"-"` -} - -type UpdateCompartmentOptions struct { - UpdateIdentityOptions - Name string `header:"-" json:"name,omitempty" url:"-"` -} - -type UpdateUserStateOptions struct { - IfMatchOptions - Blocked *bool `header:"-" json:"blocked,omitempty" url:"-"` -} - -type UpdatePolicyOptions struct { - UpdateIdentityOptions - VersionDateOptions - Statements []string `header:"-" json:"statements,omitempty" url:"-"` -} - -type UpdateDHCPDNSOptions struct { - CreateOptions - Options []DHCPDNSOption `header:"-" json:"options,omitempty" url:"-"` -} - -type UpdateGatewayOptions struct { - IfMatchOptions - DisplayNameOptions - IsEnabled *bool `header:"-" json:"isEnabled,omitempty" url:"-"` -} - -type UpdateRouteTableOptions struct { - CreateOptions - RouteRules []RouteRule `header:"-" json:"routeRules,omitempty" url:"-"` -} - -type UpdateSecurityListOptions struct { - IfMatchDisplayNameOptions - EgressRules []EgressSecurityRule `header:"-" json:"egressSecurityRules" url:"-"` - IngressRules []IngressSecurityRule `header:"-" json:"ingressSecurityRules" url:"-"` -} - -type PutObjectOptions struct { - IfMatchOptions - IfNoneMatchOptions - ClientRequestOptions - MetadataUnmarshaller - Expect string `header:"Expect,omitempty" json:"-" url:"-"` - ContentMD5 string `header:"Content-MD5,omitempty" json:"-" url:"-"` - ContentType string `header:"Content-Type,omitempty" json:"-" url:"-"` - ContentLanguage string `header:"Content-Language,omitempty" json:"-" url:"-"` - ContentEncoding string `header:"Content-Encoding,omitempty" json:"-" url:"-"` -} - -// Delete Options - -type DeleteObjectOptions struct { - IfMatchOptions - ClientRequestOptions -} - -// List Options - -type PageListOptions struct { - Page string `header:"-" json:"-" url:"page,omitempty"` -} - -type LimitListOptions struct { - Limit uint64 `header:"-" json:"-" url:"limit,omitempty"` -} - -type ListOptions struct { - LimitListOptions - PageListOptions -} - -type DisplayNameListOptions struct { - DisplayName string `header:"-" json:"-" url:"displayName,omitempty"` -} - -type AvailabilityDomainListOptions struct { - AvailabilityDomain string `header:"-" json:"-" url:"availabilityDomain,omitempty"` -} - -type DrgIDListOptions struct { - DrgID string `header:"-" json:"-" url:"drgId,omitempty"` -} - -type InstanceIDListOptions struct { - InstanceID string `header:"-" json:"-" url:"instanceId,omitempty"` -} - -type ListInstancesOptions struct { - AvailabilityDomainListOptions - DisplayNameListOptions - ListOptions -} - -type ListConsoleHistoriesOptions struct { - AvailabilityDomainListOptions - InstanceIDListOptions - ListOptions -} - -type ListDrgAttachmentsOptions struct { - DrgIDListOptions - ListOptions - VcnID string `header:"-" json:"-" url:"vcnId,omitempty"` -} - -type ListImagesOptions struct { - DisplayNameListOptions - ListOptions - OperatingSystem string `header:"-" json:"-" url:"operatingSystem,omitempty"` - OperatingSystemVersion string `header:"-" json:"-" url:"operatingSystemVersion,omitempty"` -} - -type ListIPSecConnsOptions struct { - DrgIDListOptions - ListOptions - CpeID string `header:"-" json:"-" url:"cpeId,omitempty"` -} - -type ListPrivateIPsOptions struct { - ListOptions - IPAddress string `header:"-" json:"-" url:"ipAddress,omitempty"` - SubnetID string `header:"-" json:"-" url:"subnetId,omitempty"` - VnicID string `header:"-" json:"-" url:"vnicId,omitempty"` -} - -type ListShapesOptions struct { - AvailabilityDomainListOptions - ListOptions - ImageID string `header:"-" json:"-" url:"imageId,omitempty"` -} - -type ListVnicAttachmentsOptions struct { - AvailabilityDomainListOptions - InstanceIDListOptions - ListOptions - VnicID string `header:"-" json:"-" url:"vnicId,omitempty"` -} - -type ListVolumesOptions struct { - AvailabilityDomainListOptions - ListOptions -} - -type ListVolumeAttachmentsOptions struct { - AvailabilityDomainListOptions - InstanceIDListOptions - ListOptions - VolumeID string `header:"-" json:"-" url:"volumeId,omitempty"` -} - -type ListBackupsOptions struct { - ListOptions - VolumeID string `header:"-" json:"-" url:"volumeId,omitempty"` -} - -type ListMembershipsOptions struct { - ListOptions - GroupID string `header:"-" json:"-" url:"groupId,omitempty"` - UserID string `header:"-" json:"-" url:"userId,omitempty"` -} - -type ListBucketsOptions struct { - ListOptions - ClientRequestOptions -} - -type ListPreauthenticatedRequestOptions struct { - ListOptions - ClientRequestOptions - ObjectNamePrefix string `header:"-" json:"-" url:"objectNamePrefix,omitempty"` -} - -type ListObjectsOptions struct { - ClientRequestOptions - LimitListOptions - Prefix string `header:"-" json:"-" url:"prefix,omitempty"` - Start string `header:"-" json:"-" url:"start,omitempty"` - End string `header:"-" json:"-" url:"end,omitempty"` - Delimiter string `header:"-" json:"-" url:"delimiter,omitempty"` - Fields string `header:"-" json:"-" url:"fields,omitempty"` -} - -// Misc Options - -type HeadObjectOptions struct { - IfMatchOptions - IfNoneMatchOptions - ClientRequestOptions -} - -type ConsoleHistoryDataOptions struct { - Length uint64 `header:"-" json:"-" url:"length,omitempty"` - Offset uint64 `header:"-" json:"-" url:"offset,omitempty"` -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/request_requirements.go b/vendor/github.com/oracle/bmcs-go-sdk/request_requirements.go deleted file mode 100644 index 83d816ee4e..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/request_requirements.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -type identityCreationRequirement struct { - CompartmentID string `header:"-" json:"compartmentId" url:"-"` - Description string `header:"-" json:"description" url:"-"` - Name string `header:"-" json:"name" url:"-"` -} - -type ocidRequirement struct { - CompartmentID string `header:"-" json:"compartmentId" url:"compartmentId"` -} - -type listOCIDRequirement struct { - CompartmentID string `header:"-" json:"-" url:"compartmentId"` -} - -// Body is handled explicitly during marshal. -type bodyMarshaller interface { - body() []byte -} - -type bodyRequirement struct { - Body []byte `header:"-" json:"-" url:"-"` -} - -func (b bodyRequirement) body() []byte { - return b.Body -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/request_test.go b/vendor/github.com/oracle/bmcs-go-sdk/request_test.go deleted file mode 100644 index 7a55a5482c..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/request_test.go +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "bytes" - "crypto/rsa" - "fmt" - "net/http" - "testing" - - "strings" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -type builderFnMatcher func(urlBuilderFn) bool - -func matchBuilderFns(urlBuilder urlBuilderFn) builderFnMatcher { - return func(ub urlBuilderFn) bool { - return fmt.Sprint(urlBuilder) == fmt.Sprint(ub) - } -} - -type mockRequestOptions struct { - mock.Mock -} - -func (mr *mockRequestOptions) marshalURL(urlTemplate string, region string, b urlBuilderFn) (string, error) { - args := mr.Called(b) - return args.Get(0).(string), nil -} - -func (mr *mockRequestOptions) marshalHeader() http.Header { - args := mr.Called() - return args.Get(0).(http.Header) -} - -func (mr *mockRequestOptions) marshalBody() (body []byte, e error) { - args := mr.Called() - return args.Get(0).([]byte), nil -} - -func getTestClient() (c *Client, e error) { - return NewClient( - "userOCID", - "tenancyOCID", - "fingerprint", - PrivateKeyFilePath(getTestDataPEMPath()), - PrivateKeyPassword("password"), - ) -} - -func TestAddRequestHeaders(t *testing.T) { - request, _ := http.NewRequest(http.MethodGet, "http://www.goo.com", nil) - - addRequiredRequestHeaders(request, "user-agent", []byte{}) - assert.Equal(t, request.Header.Get("content-type"), "application/json") - assert.Equal(t, request.Header.Get("user-agent"), "user-agent") - - request, _ = http.NewRequest(http.MethodGet, "http://www.goo.com", nil) - - request.Header.Add("content-type", "something") - - addRequiredRequestHeaders(request, "", []byte{}) - - assert.Equal(t, request.Header.Get("content-type"), "something") - - buffer := []byte("12345") - body := bytes.NewBuffer(buffer) - request, _ = http.NewRequest(http.MethodPost, "http://www.postme.com", body) - - addRequiredRequestHeaders(request, "", buffer) - - assert.Equal(t, request.Header.Get("content-length"), "5") - -} - -func TestGetSigningString(t *testing.T) { - request, _ := http.NewRequest( - http.MethodGet, - "https://core.us-az-phoenix-1.oracleiaas.com/v1/instances?availabilityDomain=Pjwf%3A%20PHX-AD-1", - nil, - ) - - request.Header.Add("date", "Thu, 05 Jan 2014 21:31:40 GMT") - addRequiredRequestHeaders(request, "", []byte{}) - actual := getSigningString(request) - expected := `date: Thu, 05 Jan 2014 21:31:40 GMT -(request-target): get /v1/instances?availabilityDomain=Pjwf%3A%20PHX-AD-1 -host: core.us-az-phoenix-1.oracleiaas.com` - - if !assert.Equal(t, actual, expected) { - t.Log("Actual ", actual) - t.Log("Expected ", expected) - } - - buffer := []byte("{'foo':'bar'}") - body := bytes.NewBuffer(buffer) - request, _ = http.NewRequest( - http.MethodPost, - "https://core.us-az-phoenix-1.oracleiaas.com/v1/instances?availabilityDomain=Pjwf%3A%20PHX-AD-1", - body, - ) - - request.Header.Add("date", "Thu, 05 Jan 2014 21:31:40 GMT") - addRequiredRequestHeaders(request, "", buffer) - actual = getSigningString(request) - expected = "date: Thu, 05 Jan 2014 21:31:40 GMT\n" + - "(request-target): post /v1/instances?availabilityDomain=Pjwf%3A%20PHX-AD-1\n" + - "host: core.us-az-phoenix-1.oracleiaas.com\n" + - "content-length: 13\n" + - "content-type: application/json\n" + - "x-content-sha256: " + getBodyHash([]byte("{'foo':'bar'}")) - - if !assert.Equal(t, actual, expected) { - t.Log("Actual ", actual) - t.Log("Expected ", expected) - } - -} - -func TestCreateAuthorizationHeader(t *testing.T) { - - testGetURI := "https://core.us-az-phoenix-1.oracleiaas.com/v1/instances" + - "?availabilityDomain=Pjwf%3A%20PHX-AD-1" + - "&compartmentId=ocid1.compartment.oc1..aaaaaaaayzim47sto5wqh5d4vugrsx566gjqmflvhlifte3p5ez3miy6e4lq" + - "&displayName=TeamXInstances" + - "&volumeId=ocid1.volume.oc1.phx.abyhqljrav2k323acohquoxszz2zyh5vj5v2gbvntg7ifd4ndusyvr332whq" - - expected := "Signature version=\"1\",headers=\"date (request-target) host\",keyId=\"ocid1.tenancy.oc1..aaaaaaaaq3hulfjvrouw3e6qx2ncxtp256aq7etiabqqtzunnhxjslzkfyxq/ocid1.user.oc1..aaaaaaaaflxvsdpjs5ztahmsf7vjxy5kdqnuzyqpvwnncbkfhavexwd4w5ra/b4:8a:7d:54:e6:81:04:b2:99:8e:b3:ed:10:e2:12:2b\",algorithm=\"rsa-sha256\",signature=\"A8PvWR1EshLFd6q6WuJZDKm7LUINhFdMrTxN1puVgZ58umMHn5Aja9ZAoeo7x6uMvRIaPVwGWY2OwF/BAJWnCoUn6hk/fhIRqY+gm3jU9Xmf15WUjgYwF+PbcueHw8WzLTa1zlsC4kkv4Bz/cuY8QvagWquwrQQ/9ZoxH/RMLMDJcSJHb8uqhj4n1seoUJ9ja8LddbQIkkgdtogs5nnDbk7ynwkVnRHwLVysVfoTip4Q7hNJe++zb1SEdRsz9wSuUDHgox9lTO0ZzSjRWiTNZ72BDW28Eln7WpLx6YvdvWI3YDA718AgJYWiwNbCcdcIiVHI56MX1pztve0Ru4JYqw==\"" - - var privateKey *rsa.PrivateKey - var e error - pass := "password" - - if privateKey, e = PrivateKeyFromBytes(testPrivateKey, &pass); e != nil { - t.Error("Couldn't create private key", e) - } - - ai := &authenticationInfo{ - privateRSAKey: privateKey, - tenancyOCID: testTenancyOCID, - userOCID: testUserOCID, - keyFingerPrint: testKeyFingerPrint, - } - - request, _ := http.NewRequest( - http.MethodGet, - testGetURI, - nil, - ) - // Set date to be the same date we used to generate test auth header, otherwise - // sig will be different every time - request.Header.Add("date", "Thu, 05 Jan 2014 21:31:40 GMT") - - e = createAuthorizationHeader(request, ai, "", []byte{}) - - assert.Nil(t, e) - - authHeader := request.Header.Get("Authorization") - - if !assert.Equal(t, authHeader, expected) { - t.Log("Actual ", authHeader) - t.Log("Expected ", expected) - } -} - -func TestAgainstSigningExample(t *testing.T) { - // This test uses the example input and expected output from https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/signingrequests.htm#six. - - exampleKey := []byte(`-----BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF -NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F -UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB -AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA -QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK -kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg -f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u -412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc -mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7 -kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA -gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW -G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI -7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA== ------END RSA PRIVATE KEY-----`) - - privateKey, e := PrivateKeyFromBytes(exampleKey, nil) - if e != nil { - t.Error("Couldn't create private key", e) - } - - ai := &authenticationInfo{ - privateRSAKey: privateKey, - tenancyOCID: "ocid1.tenancy.oc1..aaaaaaaaba3pv6wkcr4jqae5f15p2b2m2yt2j6rx32uzr4h25vqstifsfdsq", - userOCID: "ocid1.user.oc1..aaaaaaaat5nvwcna5j6aqzjcaty5eqbb6qt2jvpkanghtgdaqedqw3rynjq", - keyFingerPrint: "20:3b:97:13:55:1c:5b:0d:d3:37:d8:50:4e:c5:3a:34", - } - - body := []byte(`{ - "compartmentId": "ocid1.compartment.oc1..aaaaaaaam3we6vgnherjq5q2idnccdflvjsnog7mlr6rtdb25gilchfeyjxa", - "instanceId": "ocid1.instance.oc1.phx.abuw4ljrlsfiqw6vzzxb43vyypt4pkodawglp3wqxjqofakrwvou52gb6s5a", - "volumeId": "ocid1.volume.oc1.phx.abyhqljrgvttnlx73nmrwfaux7kcvzfs3s66izvxf2h4lgvyndsdsnoiwr5q" -}`) - - request, _ := http.NewRequest( - http.MethodPost, - "https://iaas.us-phoenix-1.oraclecloud.com/20160918/volumeAttachments", - bytes.NewBuffer(body), - ) - request.Header.Add("Date", "Thu, 05 Jan 2014 21:31:40 GMT") - addRequiredRequestHeaders(request, "", body) - - e = createAuthorizationHeader(request, ai, "", []byte{}) - - expectedAuthHeader := `Signature version="1",headers="date (request-target) host content-length content-type x-content-sha256",keyId="ocid1.tenancy.oc1..aaaaaaaaba3pv6wkcr4jqae5f15p2b2m2yt2j6rx32uzr4h25vqstifsfdsq/ocid1.user.oc1..aaaaaaaat5nvwcna5j6aqzjcaty5eqbb6qt2jvpkanghtgdaqedqw3rynjq/20:3b:97:13:55:1c:5b:0d:d3:37:d8:50:4e:c5:3a:34",algorithm="rsa-sha256",signature="Mje8vIDPlwIHmD/cTDwRxE7HaAvBg16JnVcsuqaNRim23fFPgQfLoOOxae6WqKb1uPjYEl0qIdazWaBy/Ml8DRhqlocMwoSXv0fbukP8J5N80LCmzT/FFBvIvTB91XuXI3hYfP9Zt1l7S6ieVadHUfqBedWH0itrtPJBgKmrWso="` - assert.NoError(t, e) - assert.Equal(t, request.Header.Get("Content-Length"), "316") - assert.Equal(t, expectedAuthHeader, request.Header.Get("Authorization")) - - request, _ = http.NewRequest( - http.MethodGet, - "https://iaas.us-phoenix-1.oraclecloud.com/20160918/instances"+ - "?availabilityDomain=Pjwf%3A%20PHX-AD-1&"+ - "compartmentId=ocid1.compartment.oc1..aaaaaaaam3we6vgnherjq5q2idnccdflvjsnog7mlr6rtdb25gilchfeyjxa"+ - "&displayName=TeamXInstances&volumeId=ocid1.volume.oc1.phx.abyhqljrgvttnlx73nmrwfaux7kcvzfs3s66izvxf2h4lgvyndsdsnoiwr5q", - nil, - ) - request.Header.Add("Date", "Thu, 05 Jan 2014 21:31:40 GMT") - addRequiredRequestHeaders(request, "", nil) - - e = createAuthorizationHeader(request, ai, "", []byte{}) - - expectedAuthHeader = strings.Replace(`Signature version="1",headers="date (request-target) host",keyId="ocid1.t -enancy.oc1..aaaaaaaaba3pv6wkcr4jqae5f15p2b2m2yt2j6rx32uzr4h25vqstifsfdsq/ocid1.user.oc1..aaaaaaaat5nvwcna5j6aqzjcaty5eqbb6qt2jvpkanghtgdaqedqw3ryn -jq/20:3b:97:13:55:1c:5b:0d:d3:37:d8:50:4e:c5:3a:34",algorithm="rsa-sha256",signature="GBas7grhyrhSKHP6AVIj/h5/Vp8bd/peM79H9Wv8kjoaCivujVXlpbKLjMPe -DUhxkFIWtTtLBj3sUzaFj34XE6YZAHc9r2DmE4pMwOAy/kiITcZxa1oHPOeRheC0jP2dqbTll -8fmTZVwKZOKHYPtrLJIJQHJjNvxFWeHQjMaR7M="`, "\n", "", -1) - - assert.NoError(t, e) - assert.Equal(t, expectedAuthHeader, request.Header.Get("Authorization")) -} - -func TestConcatenateHeaders(t *testing.T) { - headers := []string{ - "foo", - "bar", - "baz", - } - expected := "foo bar baz" - actual := concatenateHeaders(headers) - - assert.Equal(t, actual, expected) - - headers = []string{"foo"} - - expected = "foo" - actual = concatenateHeaders(headers) - - assert.Equal(t, actual, expected) - - headers = []string{} - expected = "" - actual = concatenateHeaders(headers) - - assert.Equal(t, actual, expected) - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/requestor.go b/vendor/github.com/oracle/bmcs-go-sdk/requestor.go deleted file mode 100644 index dc24b48944..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/requestor.go +++ /dev/null @@ -1,349 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "bytes" - "fmt" - "log" - "math/rand" - "net" - "net/http" - "net/http/httputil" - "net/url" - "os" - "strings" - "time" -) - -type requestor interface { - request(method string, reqOpts request) (r *response, e error) - getRequest(reqOpts request) (resp *response, e error) - postRequest(reqOpts request) (resp *response, e error) - deleteRequest(reqOpts request) (e error) -} - -type apiRequestor struct { - httpClient *http.Client - authInfo *authenticationInfo - urlBuilder urlBuilderFn - urlTemplate string - userAgent string - region string - shortRetryTime time.Duration - longRetryTime time.Duration - randGen *rand.Rand - disableAutoRetries bool - disableNotFoundRetries bool -} - -func newCoreAPIRequestor(authInfo *authenticationInfo, nco *NewClientOptions) (r *apiRequestor) { - return &apiRequestor{ - httpClient: &http.Client{ - Transport: nco.Transport, - }, - authInfo: authInfo, - urlBuilder: buildCoreURL, - urlTemplate: nco.UrlTemplate, - userAgent: nco.UserAgent, - region: nco.Region, - shortRetryTime: nco.ShortRetryTime, - longRetryTime: nco.LongRetryTime, - randGen: nco.RandGen, - disableAutoRetries: nco.DisableAutoRetries, - disableNotFoundRetries: nco.DisableNotFoundRetries, - } -} - -func newObjectStorageAPIRequestor(authInfo *authenticationInfo, nco *NewClientOptions) (r *apiRequestor) { - return &apiRequestor{ - httpClient: &http.Client{ - Transport: nco.Transport, - }, - authInfo: authInfo, - urlBuilder: buildObjectStorageURL, - urlTemplate: nco.UrlTemplate, - userAgent: nco.UserAgent, - region: nco.Region, - shortRetryTime: nco.ShortRetryTime, - longRetryTime: nco.LongRetryTime, - randGen: nco.RandGen, - disableAutoRetries: nco.DisableAutoRetries, - disableNotFoundRetries: nco.DisableNotFoundRetries, - } -} - -func newDatabaseAPIRequestor(authInfo *authenticationInfo, nco *NewClientOptions) (r *apiRequestor) { - return &apiRequestor{ - httpClient: &http.Client{ - Transport: nco.Transport, - }, - authInfo: authInfo, - urlBuilder: buildDatabaseURL, - urlTemplate: nco.UrlTemplate, - userAgent: nco.UserAgent, - region: nco.Region, - shortRetryTime: nco.ShortRetryTime, - longRetryTime: nco.LongRetryTime, - randGen: nco.RandGen, - disableAutoRetries: nco.DisableAutoRetries, - disableNotFoundRetries: nco.DisableNotFoundRetries, - } -} - -func newIdentityAPIRequestor(authInfo *authenticationInfo, nco *NewClientOptions) (r *apiRequestor) { - return &apiRequestor{ - httpClient: &http.Client{ - Transport: nco.Transport, - }, - authInfo: authInfo, - urlBuilder: buildIdentityURL, - urlTemplate: nco.UrlTemplate, - userAgent: nco.UserAgent, - region: nco.Region, - shortRetryTime: nco.ShortRetryTime, - longRetryTime: nco.LongRetryTime, - randGen: nco.RandGen, - disableAutoRetries: nco.DisableAutoRetries, - disableNotFoundRetries: nco.DisableNotFoundRetries, - } -} - -func newLoadBalancerAPIRequestor(authInfo *authenticationInfo, nco *NewClientOptions) (r *apiRequestor) { - return &apiRequestor{ - httpClient: &http.Client{ - Transport: nco.Transport, - }, - authInfo: authInfo, - urlBuilder: buildLoadBalancerURL, - urlTemplate: nco.UrlTemplate, - userAgent: nco.UserAgent, - region: nco.Region, - shortRetryTime: nco.ShortRetryTime, - longRetryTime: nco.LongRetryTime, - randGen: nco.RandGen, - disableAutoRetries: nco.DisableAutoRetries, - disableNotFoundRetries: nco.DisableNotFoundRetries, - } -} - -func (api *apiRequestor) deleteRequest(reqOpts request) (e error) { - _, e = api.request(http.MethodDelete, reqOpts) - return -} - -func (api *apiRequestor) getRequest(reqOpts request) (getResp *response, e error) { - if getResp, e = api.request(http.MethodGet, reqOpts); e != nil { - return - } - return -} - -func (api *apiRequestor) postRequest(reqOpts request) (postResp *response, e error) { - if postResp, e = api.request(http.MethodPost, reqOpts); e != nil { - return - } - return -} - -func (api *apiRequestor) request(method string, reqOpts request) (r *response, e error) { - return submitRequestWithRetries(api, method, reqOpts, generateRetryToken(api.randGen), - "", -1, 0, 1) -} - -func submitRequestWithRetries(api *apiRequestor, method string, reqOpts request, generatedRetryToken string, - currentErrorCode string, retryTimeRemaining time.Duration, timeWaited time.Duration, retryNum uint) (r *response, e error) { - var jsonBuffer []byte - var buffer *bytes.Buffer - if method == http.MethodDelete || method == http.MethodGet { - buffer = bytes.NewBuffer([]byte{}) - } else { - if jsonBuffer, e = reqOpts.marshalBody(); e != nil { - return - } - buffer = bytes.NewBuffer(jsonBuffer) - } - - var urlstr string - if urlstr, e = reqOpts.marshalURL(api.urlTemplate, api.region, api.urlBuilder); e != nil { - return - } - - var req *http.Request - if req, e = http.NewRequest(method, urlstr, buffer); e != nil { - return - } - req.Header = reqOpts.marshalHeader() - - //add random retry token if user hasn't added one so that we can safely retry requests - if _, present := req.Header[retryTokenKey]; !api.disableAutoRetries && - !present && - method != http.MethodDelete && - method != http.MethodGet { - req.Header[retryTokenKey] = []string{generatedRetryToken} - } - - 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) - if err == nil { - log.Printf("[DEBUG] HTTP Request: %v\n", string(reqdump)) - } else { - log.Printf("[WARN] Could not dump HTTP Request: %#v, error: %#v\n", req, err) - } - } - - var resp *http.Response - resp, e = api.httpClient.Do(req) - if e != nil { - // If we hit a DNS lookup error and the url_template was overridden, then add a more - // helpful message - if uErr, ok := e.(*url.Error); ok { - if opErr, ok := uErr.Err.(*net.OpError); ok { - if dnsErr, ok := opErr.Err.(*net.DNSError); ok { - if strings.ToLower(api.urlTemplate) != strings.ToLower(baseUrlTemplate) { - dnsErr.Err += "\nCheck your environment configuration and verify that the url_template" + - " is correct for the region you are targeting." - } - } - } - } - - log.Printf("[WARN] Could not get HTTP Response, error: %#v\n", e) - return - } - - if os.Getenv("DEBUG") != "" { - respdump, err := httputil.DumpResponse(resp, true) - if err == nil { - log.Printf("[DEBUG] HTTP Response: %v\n", string(respdump)) - } else { - log.Printf("[WARN] Could not dump HTTP Response: %#v, error: %#v\n", resp, err) - } - } - - var reader bytes.Buffer - _, e = reader.ReadFrom(resp.Body) - resp.Body.Close() - - if e != nil { - return - } - - // we still have to check response code, if we get non 200 response - // body will contain an error object which we'll Unmarshal and send - // back as an Error - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - - apiError := getErrorFromResponse(&reader, resp) - if api.disableAutoRetries { - e = &apiError - return - } - errorCodeStr := fmt.Sprintf("%s:%s", apiError.Status, apiError.Code) - if retryNum == 1 { - retryTimeRemaining = getMaxRetryTimeInSeconds(api, apiError, req.URL.String(), method, api.disableNotFoundRetries) - currentErrorCode = errorCodeStr - } else if currentErrorCode != errorCodeStr { - retryTimeRemaining = getMaxRetryTimeInSeconds(api, apiError, req.URL.String(), method, api.disableNotFoundRetries) - timeWaited - currentErrorCode = errorCodeStr - } - if retryTimeRemaining > 0 { - timeSlept := polynomialBackoffSleep(retryNum, retryTimeRemaining) - return submitRequestWithRetries(api, method, reqOpts, generatedRetryToken, - currentErrorCode, retryTimeRemaining-timeSlept, timeWaited+timeSlept, retryNum+1) - } else { - e = &apiError - return - } - } - - r = &response{ - header: resp.Header, - body: reader.Bytes(), - } - - return -} - -var sleep = time.Sleep - -func polynomialBackoffSleep(retryNum uint, retryTimeRemaining time.Duration) time.Duration { - secondsToSleep := time.Duration(retryNum*retryNum) * time.Second - if retryTimeRemaining < secondsToSleep { - secondsToSleep = retryTimeRemaining - } - if os.Getenv("DEBUG") != "" { - log.Printf("[DEBUG] Got a retriable error. Waiting %d seconds and trying again...", int(secondsToSleep.Seconds())) - } - if os.Getenv("TEST") != "true" { - sleep(secondsToSleep) - } - return secondsToSleep -} - -func getMaxRetryTimeInSeconds(api *apiRequestor, e Error, requestURL string, method string, disableNotFoundRetries bool) time.Duration { - switch e.Status { - case "400": - return 0 - case "401": - return 0 - case "403": - return 0 - case "404": - if disableNotFoundRetries { - return 0 - } - if method == http.MethodDelete { - return 0 - } - if requestServiceCheck(requestURL, identityServiceAPI) || - requestServiceCheck(requestURL, objectStorageServiceAPI) { - return api.longRetryTime - } - case "409": - if e.Code == "InvalidatedRetryToken" || e.Code == "CompartmentAlreadyExists" { - return 0 - } else if e.Code == "NotAuthorizedOrResourceAlreadyExists" { - if requestServiceCheck(requestURL, identityServiceAPI) || - requestServiceCheck(requestURL, objectStorageServiceAPI) { - return api.longRetryTime - } - } - case "412": - return 0 - case "429": - return api.longRetryTime - case "500": - if requestServiceCheck(requestURL, objectStorageServiceAPI) { - return api.longRetryTime - } - } - return api.shortRetryTime -} - -func requestServiceCheck(requestURL string, service string) bool { - if service == "" { - return false - } - return strings.HasPrefix(requestURL, urlPrefix+service) -} - -/* Generates a random alphanumeric string. - * Used for generating a retry token so that the SDK can safely retry operations. - */ -func generateRetryToken(randGen *rand.Rand) string { - alphanumericChars := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") - retryToken := make([]rune, generatedRetryTokenLength) - for i := range retryToken { - retryToken[i] = alphanumericChars[randGen.Intn(len(alphanumericChars))] - } - return string(retryToken) -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/requestor_test.go b/vendor/github.com/oracle/bmcs-go-sdk/requestor_test.go deleted file mode 100644 index ee49dae89b..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/requestor_test.go +++ /dev/null @@ -1,1073 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "bytes" - "crypto/tls" - "encoding/json" - "fmt" - "math/rand" - "net/http" - "net/http/httptest" - "net/url" - "testing" - "time" - - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/suite" -) - -type RequestorTestSuite struct { - suite.Suite - client *Client - transport *http.Transport -} - -var numRetries = 0 - -func (s *RequestorTestSuite) SetupTest() { - var e error - s.client, e = getTestClient() - if e != nil { - panic(e) - } - - s.transport = &http.Transport{ - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, - }, - } -} - -func buildTestURL(urlTemplate string, region string, resource resourceName, query url.Values, ids ...interface{}) (string, error) { - return "url!", nil -} - -func newTestAPIRequestor(authInfo *authenticationInfo, nco *NewClientOptions) (r *apiRequestor) { - return &apiRequestor{ - httpClient: &http.Client{ - Transport: nco.Transport, - }, - authInfo: authInfo, - urlBuilder: buildTestURL, - userAgent: nco.UserAgent, - region: nco.Region, - shortRetryTime: nco.ShortRetryTime, - longRetryTime: nco.LongRetryTime, - randGen: nco.RandGen, - disableAutoRetries: nco.DisableAutoRetries, - } -} - -func TestRunRequestorTests(t *testing.T) { - sleep = mockSleep - suite.Run(t, new(RequestorTestSuite)) - sleep = time.Sleep -} - -func (s *RequestorTestSuite) TestDeleteRequest() { - userAgent := "test-user-agent" - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - s.Require().Equal(r.Header.Get("User-Agent"), userAgent) - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - - w.Write([]byte("Deleted group 1")) - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - UserAgent: userAgent, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - url, _ := url.Parse(fmt.Sprintf("%s/%s/%s", ts.URL, resourceGroups, "123")) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(url.String()) - reqOpts.On("marshalHeader").Return(http.Header{}) - - e := api.deleteRequest(reqOpts) - s.Nil(e) -} - -func (s *RequestorTestSuite) TestUnsuccessfulDeleteRequest() { - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - - w.WriteHeader(http.StatusNotFound) - - error := Error{ - Code: "42", - Message: "ultimate answer", - } - - var buffer bytes.Buffer - encoder := json.NewEncoder(&buffer) - encoder.Encode(error) - - w.Write(buffer.Bytes()) - - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - url, _ := url.Parse(fmt.Sprintf("%s/%s/%s", ts.URL, resourceGroups, "123")) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(url.String()) - reqOpts.On("marshalHeader").Return(http.Header{}) - - e := api.deleteRequest(reqOpts) - s.NotNil(e) - s.Equal("Status: 404; Code: 42; OPC Request ID: 1234567890; Message: ultimate answer", e.Error()) -} - -func (s *RequestorTestSuite) TestGetRequest() { - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - u := []User{ - { - ID: "0123456789", - CompartmentID: r.URL.Query().Get("queryCompartmentID"), - Name: "Bob", - Description: "Bob's name", - TimeCreated: time.Now(), - State: ResourceCreated, - }, - } - - buff, _ := json.Marshal(u) - - w.Write(buff) - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - url := ts.URL + "/users?" + fmt.Sprintf("%s=%s", "queryCompartmentID", s.client.authInfo.tenancyOCID) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(url) - reqOpts.On("marshalHeader").Return(http.Header{}) - - resp, e := api.getRequest(reqOpts) - s.Nil(e) - - buffer := bytes.NewBuffer(resp.body) - decoder := json.NewDecoder(buffer) - var users []User - e = decoder.Decode(&users) - s.Nil(e) - - s.Equal(len(users), 1) - s.Equal(users[0].ID, "0123456789") - -} - -func (s *RequestorTestSuite) TestUnsuccessfulGetRequest() { - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - - w.WriteHeader(http.StatusForbidden) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - url := ts.URL + "/users?compartmentId=1" - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(url) - reqOpts.On("marshalHeader").Return(http.Header{}) - - resp, e := api.getRequest(reqOpts) - s.NotNil(e) - s.Nil(resp) - s.Equal(e.Error(), "Status: 403; Code: bar; OPC Request ID: 1234567890; Message: foo") - -} - -func (s *RequestorTestSuite) TestUnsuccessfulRequest() { - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusBadRequest) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := struct{}{} - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - _, e := api.request(http.MethodPost, reqOpts) - - s.NotNil(e) - s.Equal(e.Error(), "Status: 400; Code: bar; OPC Request ID: 1234567890; Message: foo") -} - -func (s *RequestorTestSuite) TestPlainTextErrorResponse() { - const errorMsg string = "Internal Server Error" - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(errorMsg)) - return - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := struct{}{} - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - _, e := api.request(http.MethodPost, reqOpts) - - s.NotNil(e) - s.Equal(e.Error(), "Status: 500; Code: ; OPC Request ID: ; Message: "+errorMsg) -} - -func (s *RequestorTestSuite) TestBadJsonErrorResponse() { - const errorMsg string = "Invalid JSON body" - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusBadRequest) - w.Write([]byte(errorMsg)) - return - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := struct{}{} - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - _, e := api.request(http.MethodPost, reqOpts) - - s.NotNil(e) - s.Equal(e.Error(), "Status: 400; Code: ; OPC Request ID: ; Message: "+errorMsg) -} - -func (s *RequestorTestSuite) TestSuccessfulRequest() { - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - - var details identityCreationRequirement - decoder := json.NewDecoder(r.Body) - - decoder.Decode(&details) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - u := User{ - ID: "0123456789", - CompartmentID: details.CompartmentID, - Name: details.Name, - Description: details.Description, - TimeCreated: time.Now(), - State: ResourceCreated, - } - - buff, _ := json.Marshal(u) - - w.Write(buff) - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := identityCreationRequirement{ - CompartmentID: "xyz", - Description: "123abc", - Name: "Bob", - } - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - response, e := api.request(http.MethodPost, reqOpts) - - if !s.Nil(e) { - s.T().Log(e.Error()) - } - - var user User - e = json.Unmarshal(response.body, &user) - - s.Nil(e) - s.Equal(body.CompartmentID, user.CompartmentID) - s.Equal(body.Name, user.Name) - s.Equal(body.Description, user.Description) -} - -func testGetMaxRetryTimeForStatus(s *RequestorTestSuite, status string, codes []string, noRetryServices []string, defaultRetryServices []string, longRetryServices []string, methods []string) { - var testUrl string - var waitTime time.Duration - var service string - var err = Error{} - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - err.Status = status - for _, code := range codes { - err.Code = code - for _, method := range methods { - for _, service = range noRetryServices { - testUrl = fmt.Sprintf(baseUrlTemplate, service, us_phoenix_1) - waitTime = getMaxRetryTimeInSeconds(api, err, testUrl, method, false) - s.Equal(waitTime, time.Duration(0)) - } - for _, service = range defaultRetryServices { - testUrl = fmt.Sprintf(baseUrlTemplate, service, us_phoenix_1) - waitTime = getMaxRetryTimeInSeconds(api, err, testUrl, method, false) - s.Equal(waitTime, api.shortRetryTime) - } - for _, service = range longRetryServices { - testUrl = fmt.Sprintf(baseUrlTemplate, service, us_phoenix_1) - waitTime = getMaxRetryTimeInSeconds(api, err, testUrl, method, false) - s.Equal(waitTime, api.longRetryTime) - } - } - } -} - -func (s *RequestorTestSuite) TestGetMaxRetryTimeInSeconds() { - var status string - var codes []string - var noRetryServices []string - var defaultRetryServices []string - var longRetryServices []string - var methods []string - - allMethods := []string{http.MethodDelete, http.MethodGet, http.MethodPost, http.MethodPut} - allServices := []string{"AnyService", identityServiceAPI, coreServiceAPI, databaseServiceAPI, objectStorageServiceAPI} - - status = "400" - codes = []string{"AnyCode", "CannotParseRequest", "InvalidParameter", "LimitExceeded", "MissingParameter", "QuotaExceeded"} - noRetryServices = allServices - defaultRetryServices = []string{} - longRetryServices = []string{} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) - - status = "401" - codes = []string{"AnyCode", "NotAuthenticated"} - noRetryServices = allServices - defaultRetryServices = []string{} - longRetryServices = []string{} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) - - status = "403" - codes = []string{"AnyCode"} - noRetryServices = allServices - defaultRetryServices = []string{} - longRetryServices = []string{} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) - - status = "404" - codes = []string{"AnyCode", "NotAuthorizedOrNotFound"} - noRetryServices = []string{} - defaultRetryServices = []string{"AnyService", coreServiceAPI, databaseServiceAPI} - longRetryServices = []string{identityServiceAPI, objectStorageServiceAPI} - methods = []string{http.MethodGet, http.MethodPost, http.MethodPut} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, methods) - - noRetryServices = allServices - defaultRetryServices = []string{} - longRetryServices = []string{} - methods = []string{http.MethodDelete} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, methods) - - status = "409" - codes = []string{"InvalidatedRetryToken", "CompartmentAlreadyExists"} - noRetryServices = allServices - defaultRetryServices = []string{} - longRetryServices = []string{} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) - - codes = []string{"NotAuthorizedOrResourceAlreadyExists"} - noRetryServices = []string{} - defaultRetryServices = []string{"AnyService", coreServiceAPI, databaseServiceAPI} - longRetryServices = []string{identityServiceAPI, objectStorageServiceAPI} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) - - codes = []string{"AnyCode", "IncorrectState"} - noRetryServices = []string{} - defaultRetryServices = allServices - longRetryServices = []string{} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) - - status = "412" - codes = []string{"AnyCode", "NoEtagMatch"} - noRetryServices = allServices - defaultRetryServices = []string{} - longRetryServices = []string{} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) - - status = "429" - codes = []string{"AnyCode", "TooManyRequests"} - noRetryServices = []string{} - defaultRetryServices = []string{} - longRetryServices = allServices - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) - - status = "500" - codes = []string{"AnyCode", "InternalServerError"} - noRetryServices = []string{} - defaultRetryServices = []string{"AnyService", coreServiceAPI, databaseServiceAPI, identityServiceAPI} - longRetryServices = []string{objectStorageServiceAPI} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) - - status = "AnyStatus" - codes = []string{"AnyCode"} - noRetryServices = []string{} - defaultRetryServices = allServices - longRetryServices = []string{} - testGetMaxRetryTimeForStatus(s, status, codes, noRetryServices, defaultRetryServices, longRetryServices, allMethods) -} - -func (s *RequestorTestSuite) TestRequestServiceCheck() { - var testUrl string - testUrl = fmt.Sprintf(baseUrlTemplate, objectStorageServiceAPI, us_phoenix_1) - s.True(requestServiceCheck(testUrl, objectStorageServiceAPI)) - s.False(requestServiceCheck(testUrl, identityServiceAPI)) - s.False(requestServiceCheck(testUrl, "")) - testUrl = fmt.Sprintf("https://something.%s.%s.oraclebmc.com", objectStorageServiceAPI, us_phoenix_1) - s.False(requestServiceCheck(testUrl, objectStorageServiceAPI)) -} - -func mockSleep(_ time.Duration) { - numRetries++ -} - -func (s *RequestorTestSuite) TestPolynomialBackoffSleep() { - var secondsSlept time.Duration - secondsSlept = polynomialBackoffSleep(1, 0) - s.Equal(secondsSlept, time.Duration(0)) - secondsSlept = polynomialBackoffSleep(1, time.Duration(4)*time.Second) - s.Equal(secondsSlept, time.Duration(1)*time.Second) - secondsSlept = polynomialBackoffSleep(2, time.Duration(4)*time.Second) - s.Equal(secondsSlept, time.Duration(4)*time.Second) -} - -func (s *RequestorTestSuite) TestNotRetriableRequest() { - numRetries = 0 - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusBadRequest) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := struct{}{} - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - _, e := api.request(http.MethodPost, reqOpts) - - s.NotNil(e) - s.Equal(e.Error(), "Status: 400; Code: bar; OPC Request ID: 1234567890; Message: foo") - s.Equal(numRetries, 0) -} - -func (s *RequestorTestSuite) TestRetriableRequestTimeout() { - numRetries = 0 - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusNotFound) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := struct{}{} - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - _, e := api.request(http.MethodPost, reqOpts) - - s.NotNil(e) - s.Equal(e.Error(), "Status: 404; Code: bar; OPC Request ID: 1234567890; Message: foo") - - expectedRetryNum := 0 - timeWaited := 0 - for timeWaited < int(shortRetryTime.Seconds()) { - expectedRetryNum++ - timeWaited += expectedRetryNum * expectedRetryNum - } - s.Equal(numRetries, expectedRetryNum) -} - -func (s *RequestorTestSuite) TestRetriableRequestTimeoutWithChangeInStatus() { - numRetries = 0 - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if numRetries <= 3 { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusInternalServerError) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - } else { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusTooManyRequests) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - } - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := struct{}{} - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - _, e := api.request(http.MethodPost, reqOpts) - - s.NotNil(e) - s.Equal(e.Error(), "Status: 429; Code: bar; OPC Request ID: 1234567890; Message: foo") - - expectedRetryNum := 0 - timeWaited := 0 - for timeWaited < int(longRetryTime.Seconds()) { - expectedRetryNum++ - timeWaited += expectedRetryNum * expectedRetryNum - } - s.Equal(numRetries, expectedRetryNum) -} - -func (s *RequestorTestSuite) TestRetriableRequestWithChangeInStatusWithSuccess() { - numRetries = 0 - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if numRetries <= 3 { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusInternalServerError) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - } else if numRetries <= 5 { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusTooManyRequests) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - } else { - var details identityCreationRequirement - decoder := json.NewDecoder(r.Body) - - decoder.Decode(&details) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - u := User{ - ID: "0123456789", - CompartmentID: details.CompartmentID, - Name: details.Name, - Description: details.Description, - TimeCreated: time.Now(), - State: ResourceCreated, - } - - buff, _ := json.Marshal(u) - - w.Write(buff) - } - return - - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := identityCreationRequirement{ - CompartmentID: "xyz", - Description: "123abc", - Name: "Bob", - } - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - response, e := api.request(http.MethodPost, reqOpts) - - if !s.Nil(e) { - s.T().Log(e.Error()) - } - - var user User - e = json.Unmarshal(response.body, &user) - - s.Nil(e) - s.Equal(body.CompartmentID, user.CompartmentID) - s.Equal(body.Name, user.Name) - s.Equal(body.Description, user.Description) - s.Equal(numRetries, 6) -} - -func (s *RequestorTestSuite) TestRetriableRequestWithSuccess() { - numRetries = 0 - retryNumForSuccess := 3 - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if numRetries == retryNumForSuccess { - var details identityCreationRequirement - decoder := json.NewDecoder(r.Body) - - decoder.Decode(&details) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - u := User{ - ID: "0123456789", - CompartmentID: details.CompartmentID, - Name: details.Name, - Description: details.Description, - TimeCreated: time.Now(), - State: ResourceCreated, - } - - buff, _ := json.Marshal(u) - - w.Write(buff) - } else { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusNotFound) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - } - return - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := identityCreationRequirement{ - CompartmentID: "xyz", - Description: "123abc", - Name: "Bob", - } - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - response, e := api.request(http.MethodPost, reqOpts) - - if !s.Nil(e) { - s.T().Log(e.Error()) - } - - var user User - e = json.Unmarshal(response.body, &user) - - s.Nil(e) - s.Equal(body.CompartmentID, user.CompartmentID) - s.Equal(body.Name, user.Name) - s.Equal(body.Description, user.Description) - s.Equal(numRetries, retryNumForSuccess) -} - -func (s *RequestorTestSuite) TestAutomaticallyAddingRetryToken() { - numRetries = 0 - retryNumForSuccess := 3 - var retryToken string - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if numRetries == retryNumForSuccess { - var details identityCreationRequirement - decoder := json.NewDecoder(r.Body) - - decoder.Decode(&details) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - u := User{ - ID: "0123456789", - CompartmentID: details.CompartmentID, - Name: r.Header.Get(retryTokenKey), - Description: details.Description, - TimeCreated: time.Now(), - State: ResourceCreated, - } - - buff, _ := json.Marshal(u) - - w.Write(buff) - } else { - retryToken = r.Header.Get(retryTokenKey) - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusNotFound) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - } - return - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := identityCreationRequirement{ - CompartmentID: "xyz", - Description: "123abc", - Name: "Bob", - } - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - response, e := api.request(http.MethodPost, reqOpts) - - if !s.Nil(e) { - s.T().Log(e.Error()) - } - - var user User - e = json.Unmarshal(response.body, &user) - - s.Nil(e) - s.NotEqual(retryToken, "") - s.Equal(retryToken, user.Name) - s.Equal(numRetries, retryNumForSuccess) -} - -func (s *RequestorTestSuite) TestKeepingProvidedRetryToken() { - numRetries = 0 - retryNumForSuccess := 3 - retryToken := "abcdef" - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if numRetries == retryNumForSuccess { - var details identityCreationRequirement - decoder := json.NewDecoder(r.Body) - - decoder.Decode(&details) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - u := User{ - ID: "0123456789", - CompartmentID: details.CompartmentID, - Name: r.Header.Get(retryTokenKey), - Description: details.Description, - TimeCreated: time.Now(), - State: ResourceCreated, - } - - buff, _ := json.Marshal(u) - - w.Write(buff) - } else { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusNotFound) - err := Error{ - Message: "foo", - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - } - return - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - }) - - body := identityCreationRequirement{ - CompartmentID: "xyz", - Description: "123abc", - Name: "Bob", - } - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - header := http.Header{} - header.Set(retryTokenKey, retryToken) - reqOpts.On("marshalHeader").Return(header) - - response, e := api.request(http.MethodPost, reqOpts) - - if !s.Nil(e) { - s.T().Log(e.Error()) - } - - var user User - e = json.Unmarshal(response.body, &user) - - s.Nil(e) - s.Equal(retryToken, user.Name) - s.Equal(numRetries, retryNumForSuccess) -} - -func (s *RequestorTestSuite) TestDisablingAutoRetries() { - numRetries = 0 - retryNumForSuccess := 3 - ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if numRetries == retryNumForSuccess { - var details identityCreationRequirement - decoder := json.NewDecoder(r.Body) - - decoder.Decode(&details) - - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusOK) - u := User{ - ID: "0123456789", - CompartmentID: details.CompartmentID, - Name: details.Name, - Description: details.Description, - TimeCreated: time.Now(), - State: ResourceCreated, - } - - buff, _ := json.Marshal(u) - - w.Write(buff) - } else { - w.Header().Set("Content-Type", "application/json") - w.Header().Set("opc-request-id", "1234567890") - // anything other than 200 is an error - w.WriteHeader(http.StatusNotFound) - err := Error{ - Message: r.Header.Get(retryTokenKey), - Code: "bar", - } - - buff, _ := json.Marshal(err) - - w.Write(buff) - } - return - })) - - api := newTestAPIRequestor(s.client.authInfo, &NewClientOptions{ - Transport: s.transport, - ShortRetryTime: shortRetryTime, - LongRetryTime: longRetryTime, - RandGen: rand.New(rand.NewSource(time.Now().UnixNano())), - DisableAutoRetries: true, - }) - - body := identityCreationRequirement{ - CompartmentID: "xyz", - Description: "123abc", - Name: "Bob", - } - var marshaled []byte - marshaled, _ = json.Marshal(body) - - reqOpts := &mockRequestOptions{} - reqOpts.On("marshalBody").Return(marshaled) - reqOpts.On("marshalURL", mock.MatchedBy(matchBuilderFns(buildTestURL))).Return(ts.URL) - reqOpts.On("marshalHeader").Return(http.Header{}) - - _, e := api.request(http.MethodPost, reqOpts) - - s.Equal(numRetries, 0) - s.NotNil(e) - s.Equal(e.Error(), "Status: 404; Code: bar; OPC Request ID: 1234567890; Message: ") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/response.go b/vendor/github.com/oracle/bmcs-go-sdk/response.go deleted file mode 100644 index 0e9f3f4b86..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/response.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "encoding/json" - "net/http" - "strconv" - "strings" -) - -type response struct { - header http.Header - body []byte -} - -func (r *response) unmarshal(resource interface{}) (e error) { - var val interface{} - - if c, ok := resource.(Container); ok { - val = c.GetList() - } else { - val = resource - } - - if pc, ok := resource.(NextPageUnmarshallable); ok { - pc.SetNextPage(r.header.Get(headerOPCNextPage)) - } - - if cs, ok := resource.(BodyUnmarshallable); ok { - 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 - } - - if rr, ok := resource.(OPCRequestIDUnmarshallable); ok { - rr.SetRequestID(r.header.Get(headerOPCRequestID)) - } - - if crr, ok := resource.(OPCClientRequestIDUnmarshallable); ok { - 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)) - } - - // TODO: Unmarshal this string into a Time. - // if et, ok := resource.(LastModifiedUnmarshallable); ok { - // et.SetLastModified(r.header.Get(headerLastModified)) - // } - - if cr, ok := resource.(ContentUnmarshallable); ok { - cr.SetContentEncoding(r.header.Get(headerContentEncoding)) - cr.SetContentLanguage(r.header.Get(headerContentLanguage)) - cr.SetContentMD5(r.header.Get(headerContentMD5)) - cr.SetContentType(r.header.Get(headerContentType)) - - lengthStr := r.header.Get(headerContentLength) - if lengthStr != "" { - if length, err := strconv.Atoi(lengthStr); err != nil { - e = err - return - } else { - cr.SetContentLength(uint64(length)) - } - } - } - - if md, ok := resource.(MetadataUnmarshallable); ok { - prefix := "opc-meta-" - meta := make(map[string]string) - for name, headers := range r.header { - name = strings.ToLower(name) - if strings.HasPrefix(name, prefix) { - for _, h := range headers { - meta[strings.Replace(name, prefix, "", 1)] = h - } - } - } - md.SetMetadata(meta) - } - - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/response_unmarshallers.go b/vendor/github.com/oracle/bmcs-go-sdk/response_unmarshallers.go deleted file mode 100644 index c555f023d2..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/response_unmarshallers.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "time" - -// JSON bodies are unmarshalled by the json package. The unmarshallers in this -// file are primarily responsible for unmarshalling data returned via the -// response header. That said, any response data that cannot be unmarshalled -// using json should be configured here. - -type OPCRequestIDUnmarshallable interface { - SetRequestID(id string) -} - -type OPCRequestIDUnmarshaller struct { - RequestID string `json:"RequestID,omitempty" url:"-"` -} - -func (r *OPCRequestIDUnmarshaller) SetRequestID(id string) { - r.RequestID = id -} - -type NextPageUnmarshallable interface { - SetNextPage(np string) -} - -type NextPageUnmarshaller struct { - NextPage string -} - -func (r *NextPageUnmarshaller) SetNextPage(np string) { - r.NextPage = np -} - -type ETagUnmarshallable interface { - SetETag(etag string) -} - -type ETagUnmarshaller struct { - ETag string -} - -func (r *ETagUnmarshaller) SetETag(etag string) { - r.ETag = etag -} - -type OPCClientRequestIDUnmarshallable interface { - SetClientRequestID(id string) -} - -type OPCClientRequestIDUnmarshaller struct { - ClientRequestID string -} - -func (r *OPCClientRequestIDUnmarshaller) SetClientRequestID(id string) { - r.ClientRequestID = id -} - -type OPCWorkRequestIDUnmarshallable interface { - SetWorkRequestID(id string) -} - -type OPCWorkRequestIDUnmarshaller struct { - WorkRequestID string `json:"WorkRequestID,omitempty" url:"-"` -} - -func (r *OPCWorkRequestIDUnmarshaller) SetWorkRequestID(id string) { - r.WorkRequestID = id -} - -type LastModifiedUnmarshallable interface { - SetLastModified(time.Time) -} - -type LastModifiedUnmarshaller struct { - LastModified time.Time -} - -func (r *LastModifiedUnmarshaller) SetLastModified(time time.Time) { - r.LastModified = time -} - -type MetadataUnmarshallable interface { - GetMetadata() map[string]string - SetMetadata(map[string]string) -} - -type MetadataUnmarshaller struct { - Metadata map[string]string `json:"-" url:"-" header:"-"` -} - -func (mr *MetadataUnmarshaller) GetMetadata() map[string]string { - return mr.Metadata -} - -func (mr *MetadataUnmarshaller) SetMetadata(md map[string]string) { - mr.Metadata = md -} - -type ContentUnmarshallable interface { - MetadataUnmarshallable - SetContentLength(uint64) - SetContentMD5(string) - SetContentType(string) - SetContentLanguage(string) - SetContentEncoding(string) -} - -type ContentUnmarshaller struct { - ContentLength uint64 - ContentRange string - ContentMD5 string - ContentType string - ContentLanguage string - ContentEncoding string -} - -func (ref *ContentUnmarshaller) SetContentLength(l uint64) { - ref.ContentLength = l -} - -func (ref *ContentUnmarshaller) SetContentRange(r string) { - ref.ContentRange = r -} - -func (ref *ContentUnmarshaller) SetContentMD5(md5 string) { - ref.ContentMD5 = md5 -} - -func (ref *ContentUnmarshaller) SetContentType(t string) { - ref.ContentType = t -} - -func (ref *ContentUnmarshaller) SetContentLanguage(l string) { - ref.ContentLanguage = l -} - -func (ref *ContentUnmarshaller) SetContentEncoding(l string) { - ref.ContentEncoding = l -} - -type BodyUnmarshallable interface { - SetBody([]byte, interface{}) error -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/test/core/main.go b/vendor/github.com/oracle/bmcs-go-sdk/test/core/main.go deleted file mode 100644 index 81a266bec3..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/test/core/main.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package main - -import ( - "fmt" - "log" - "os" - - baremetal "github.com/oracle/bmcs-go-sdk" - tt "github.com/oracle/bmcs-go-sdk/test/shared" -) - -func main() { - log.SetFlags(log.Lshortfile) - var err error - - keyPath := tt.TestVals["BAREMETAL_PRIVATE_KEY_PATH"] - tenancyOCID := tt.TestVals["BAREMETAL_TENANCY_OCID"] - userOCID := tt.TestVals["BAREMETAL_USER_OCID"] - fingerprint := tt.TestVals["BAREMETAL_FINGERPRINT"] - password := tt.TestVals["BAREMETAL_KEY_PASSWORD"] - compartmentID := tt.TestVals["TEST_COMPARTMENT_ID"] - - client, err := baremetal.NewClient( - userOCID, - tenancyOCID, - fingerprint, - baremetal.PrivateKeyFilePath(keyPath), - baremetal.PrivateKeyPassword(password), - ) - - if err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - - tt.PrintTestHeader("ListShapes") - - var shapes *baremetal.ListShapes - if shapes, err = client.ListShapes(compartmentID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", shapes) - tt.PrintTestFooter() - - tt.PrintTestHeader("CreateCpe") - - cpeopts := &baremetal.CreateOptions{} - cpeopts.DisplayName = "cpe1" - var cpe *baremetal.Cpe - if cpe, err = client.CreateCpe(compartmentID, "121.122.123.124", cpeopts); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - - fmt.Printf("%+v\n", cpe) - - tt.PrintTestFooter() - - tt.PrintTestHeader("ListCpes") - var cpes *baremetal.ListCpes - if cpes, err = client.ListCpes(compartmentID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - - tt.PrintResults(cpes) - - tt.PrintTestHeader("GetCpe") - - if cpe, err = client.GetCpe(cpe.ID); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - - tt.PrintResults(cpe) - - tt.PrintTestHeader("DeleteCpe") - - if err = client.DeleteCpe(cpe.ID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - - tt.PrintTestFooter() - - tt.PrintTestHeader("CreateVirtualNetwork") - - vcnopts := &baremetal.CreateVcnOptions{} - vcnopts.DisplayName = "vcn1" - var vcn *baremetal.VirtualNetwork - if vcn, err = client.CreateVirtualNetwork("172.16.0.0/16", compartmentID, vcnopts); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", vcn) - - tt.PrintTestFooter() - vcnETag := vcn.ETag - tt.PrintTestHeader("GetVirtualNetwork") - - if vcn, err = client.GetVirtualNetwork(vcn.ID); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", vcn) - - tt.PrintTestFooter() - - tt.PrintTestHeader("DeleteVirtualNetwork") - - if err = client.DeleteVirtualNetwork(vcn.ID, &baremetal.IfMatchOptions{IfMatch: vcnETag}); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - - tt.PrintTestFooter() - - tt.PrintTestHeader("Instance Feature") - testInstanceFeature(client) - tt.PrintTestFooter() - - fmt.Println("PASS") - -} - -func testInstanceFeature(client *baremetal.Client) { - var err error - - compartmentID := tt.TestVals["TEST_COMPARTMENT_ID"] - - metadata := map[string]string{ - "ssh_authorized_keys": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDyE8kXMHt8O5i" + - "zGIesqBy6tSl57c9pc6/3Y/5eE42pNYQ7/jjhgN5b8iXbWV/ZkXWKMchN+6H0uhse27ex6VB1Cl" + - "7jxXU0hyHQ9yldI5YTvn8HByxi1FLkhHVYnVKe1YY6lgffCCv0EX/VCnZDugjCM4CNS4pGbTU1k" + - "j21166K7Cr5Jz2XzfGV424Wq3HZNV2GYzcGSzHX4ei9CDzWgQTRQs+6eU3TGUmzQQnF1Gbq/np+L" + - "wZnoewTeu5ZoxHEG4wiDK+uPiRSp/klNSppt1wVX6qYpdVEl5tRkxmuLhId6TTRksUABNZi+K0JtIk6RvcdR1poEEqihE/AIB91g8UX new mac", - } - - var ads *baremetal.ListAvailabilityDomains - if ads, err = client.ListAvailabilityDomains(compartmentID); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - ad := ads.AvailabilityDomains[0] - - var shapesList *baremetal.ListShapes - if shapesList, err = client.ListShapes(compartmentID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - shape := shapesList.Shapes[0] - - var vcnList *baremetal.ListVirtualNetworks - if vcnList, err = client.ListVirtualNetworks(compartmentID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - vcn := vcnList.VirtualNetworks[0] - - var subnetList *baremetal.ListSubnets - if subnetList, err = client.ListSubnets(compartmentID, vcn.ID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - subnet := subnetList.Subnets[0] - - var imgList *baremetal.ListImages - if imgList, err = client.ListImages(compartmentID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - img := imgList.Images[0] - - opts := &baremetal.LaunchInstanceOptions{} - opts.DisplayName = "foobar" - opts.Metadata = metadata - - instance, err := client.LaunchInstance( - ad.Name, - compartmentID, - img.ID, - shape.Name, - subnet.ID, - opts, - ) - - if err != nil { - fmt.Println(err) - os.Exit(tt.ERR) - } - - fmt.Printf("%+v\n\n", instance) - - tt.PrintTestHeader("ListInstances") - - var instances *baremetal.ListInstances - if instances, err = client.ListInstances(compartmentID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - for _, tempInstance := range instances.Instances { - fmt.Println(tempInstance.DisplayName) - } - fmt.Printf("%+v\n", instances) - - tt.PrintTestFooter() - - tt.PrintTestHeader("DeleteInstance") - - if err = client.TerminateInstance(instance.ID, &baremetal.IfMatchOptions{ - IfMatch: instance.ETag, - }); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - - tt.PrintTestFooter() - - // instance, err := client.GetInstance("ocid1.instance.oc1.phx.abyhqljsor6xyqrihupbhe3mv7tky3fwyqm5mafnpsf2lihgq3osz4gzr3rq") - // if err != nil { - // fmt.Println(err) - // os.Exit(tt.ERR) - // } - // fmt.Printf("%+v\n\n", instance) - // // -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/test/database/main.go b/vendor/github.com/oracle/bmcs-go-sdk/test/database/main.go deleted file mode 100644 index 172df099d4..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/test/database/main.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package main - -import ( - "fmt" - "log" - "os" - "time" - - baremetal "github.com/oracle/bmcs-go-sdk" - tt "github.com/oracle/bmcs-go-sdk/test/shared" -) - -func main() { - log.SetFlags(log.Lshortfile) - var err error - - keyPath := tt.TestVals["BAREMETAL_PRIVATE_KEY_PATH"] - tenancyOCID := tt.TestVals["BAREMETAL_TENANCY_OCID"] - userOCID := tt.TestVals["BAREMETAL_USER_OCID"] - fingerprint := tt.TestVals["BAREMETAL_FINGERPRINT"] - //password := tt.TestVals["BAREMETAL_KEY_PASSWORD"] - compartmentID := tt.TestVals["TEST_COMPARTMENT_ID"] - - var client *baremetal.Client - if client, err = baremetal.NewClient(userOCID, - tenancyOCID, - fingerprint, - baremetal.PrivateKeyFilePath(keyPath)); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - - tt.PrintTestHeader("ListDBVersions") - var versions *baremetal.ListDBVersions - if versions, err = client.ListDBVersions(compartmentID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - version := versions.DBVersions[1] - fmt.Printf("%+v\n", versions) - tt.PrintTestFooter() - - tt.PrintTestHeader("ListAvailabilityDomains") - var ads *baremetal.ListAvailabilityDomains - if ads, err = client.ListAvailabilityDomains(compartmentID); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - ad := ads.AvailabilityDomains[0] - fmt.Printf("%+v\n", ads) - fmt.Printf("%+v\n", ad) - tt.PrintTestFooter() - - tt.PrintTestHeader("ListVirtualNetworks") - var vcnList *baremetal.ListVirtualNetworks - if vcnList, err = client.ListVirtualNetworks(compartmentID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - vcn := vcnList.VirtualNetworks[0] - fmt.Printf("%+v\n", vcnList) - fmt.Printf("%+v\n", vcn) - tt.PrintTestFooter() - - tt.PrintTestHeader("ListSubnets") - var subnetList *baremetal.ListSubnets - if subnetList, err = client.ListSubnets(compartmentID, vcn.ID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - subnet := subnetList.Subnets[0] - fmt.Printf("%+v\n", subnetList) - fmt.Printf("%+v\n", subnet) - tt.PrintTestFooter() - - tt.PrintTestHeader("ListDBSystemShapes") - var shapes *baremetal.ListDBSystemShapes - if shapes, err = client.ListDBSystemShapes(ad.Name, compartmentID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", shapes) - shape := shapes.DBSystemShapes[0] - fmt.Printf("%+v\n", shape) - tt.PrintTestFooter() - - tt.PrintTestHeader("DBSystem") - dbHomeOpts := &baremetal.CreateDBHomeOptions{ - DisplayNameOptions: baremetal.DisplayNameOptions{DisplayName: "dbHomeDisplayName"}, - } - dbOpts := &baremetal.CreateDatabaseOptions{ - CharacterSet: "AL32UTF8", - NCharacterSet: "AL16UTF16", - DBWorkload: "OLTP", - PDBName: "pdbName", - } - db := baremetal.NewCreateDatabaseDetails("ABab_#789", "dbname", dbOpts) - dbHome := baremetal.NewCreateDBHomeDetails(db, version.Version, dbHomeOpts) - tt.PrintTestHeader("DBSystem:DBHome") - fmt.Printf("%+v\n", dbHome) - tt.PrintTestFooter() - opts := &baremetal.LaunchDBSystemOptions{ - Domain: "testDBDomain", - DataStoragePercentage: 40, - DiskRedundancy: "HIGH", - } - opts.DisplayName = "dbDisplayName" - var sys *baremetal.DBSystem - // TODO: shape.Name should be used instead of BM.DenseIO1.36, but - // DBSystemShapes is only returning one shape. - if sys, err = client.LaunchDBSystem( - ad.Name, - compartmentID, - 2, - baremetal.DatabaseEditionStandard, - dbHome, - "test-db-system-hostname", - "BM.DenseIO1.36", - []string{"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWm/fWAxfDy2DxlJLvIRubenc/aO77QaoSHXotCAxCkgttaxv+YNGyJIxO1hGDbmxwlBfyYivHCAg+LMBX6vrp8esA5B3Gnd9kLcvnfazGFvCmGJAecoZFwGvGJb5UeFZI6jCmELp/QbAx7wL2iOvCB+HY3K18sVft0kk4vd/p9iXiXrDPBytdZcYtR6hBU8pal6+FR1o0UlGbK8vvTi3r57IJ/U+DMs1wRHYvIEBWGoCBeuCXqL5PQU+HxGp1SwmicQGZbXS4x1XW1Hvc4pudvfoC0YOVXmVYIE3ZgWYzyid/IPm/JEs9wlbPN1zoCbHQjxKd7o15B2nSvDj0/gTT gotascii@gmail.com"}, - subnet.ID, - opts, - ); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", sys) - tt.PrintTestFooter() - - tt.PrintTestHeader("ListDBNodes") - dbSystemID := sys.ID - var nodes *baremetal.ListDBNodes - if nodes, err = client.ListDBNodes(compartmentID, dbSystemID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", nodes) - tt.PrintTestFooter() - - tt.PrintTestHeader("ListDBHomes") - - var homes *baremetal.ListDBHomes - if homes, err = client.ListDBHomes(compartmentID, dbSystemID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", homes) - tt.PrintTestFooter() - - tt.PrintTestHeader("TerminateDBSystem") - time.Sleep(10 * time.Second) - if err = client.TerminateDBSystem(dbSystemID, nil); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - tt.PrintTestFooter() - - fmt.Println("PASS") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/test/object/main.go b/vendor/github.com/oracle/bmcs-go-sdk/test/object/main.go deleted file mode 100644 index 783a531ef0..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/test/object/main.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package main - -import ( - "fmt" - "log" - "os" - - baremetal "github.com/oracle/bmcs-go-sdk" - tt "github.com/oracle/bmcs-go-sdk/test/shared" -) - -func main() { - log.SetFlags(log.Lshortfile) - var err error - - keyPath := tt.TestVals["BAREMETAL_PRIVATE_KEY_PATH"] - tenancyOCID := tt.TestVals["BAREMETAL_TENANCY_OCID"] - userOCID := tt.TestVals["BAREMETAL_USER_OCID"] - fingerprint := tt.TestVals["BAREMETAL_FINGERPRINT"] - password := tt.TestVals["BAREMETAL_KEY_PASSWORD"] - compartmentID := tt.TestVals["TEST_COMPARTMENT_ID"] - - var client *baremetal.Client - if client, err = baremetal.NewFromKeyPath(userOCID, tenancyOCID, fingerprint, keyPath, password); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - - tt.PrintTestHeader("GetNamespace") - var namespace *baremetal.Namespace - if namespace, err = client.GetNamespace(); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", *namespace) - tt.PrintTestFooter() - - // var ns baremetal.Namespace = baremetal.Namespace("test-compartment") - // namespace := &ns - - tt.PrintTestHeader("CreateBucket") - var bucketName = "test-bucket" - var bucketMetadata = map[string]string{"foo": "bar"} - var bucket *baremetal.Bucket - if bucket, err = client.CreateBucket(compartmentID, bucketName, *namespace, &baremetal.CreateBucketOptions{}); err != nil { - log.Println(err) - // os.Exit(tt.ERR) - } else { - fmt.Printf("%+v\n", bucket) - } - - tt.PrintTestFooter() - - tt.PrintTestHeader("ListBuckets") - var buckets *baremetal.ListBuckets - if buckets, err = client.ListBuckets(compartmentID, *namespace, &baremetal.ListBucketsOptions{}); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", buckets) - tt.PrintTestFooter() - - tt.PrintTestHeader("GetBucket") - var bucket2 *baremetal.Bucket - if bucket2, err = client.GetBucket(bucketName, *namespace); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", bucket2) - tt.PrintTestFooter() - - tt.PrintTestHeader("UpdateBucket") - if bucket2, err = client.UpdateBucket(compartmentID, bucketName, *namespace, &baremetal.UpdateBucketOptions{ - IfMatchOptions: baremetal.IfMatchOptions{IfMatch: bucket2.ETag}, - Name: bucketName, - Namespace: *namespace, - Metadata: bucketMetadata, - }); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - fmt.Printf("%+v\n", bucket2) - tt.PrintTestFooter() - - // objectID := "test-object" - - // tt.PrintTestHeader("PutObject") - // var object *baremetal.Object - // if object, err = client.PutObject(*namespace, bucket2Name, objectID, []byte("test-object-content"), &baremetal.PutObjectOptions{}); err != nil { - // log.Println(err) - // os.Exit(tt.ERR) - // } - // fmt.Printf("%+v\n", object) - // tt.PrintTestFooter() - - // tt.PrintTestHeader("ListObjects") - - // var objects *baremetal.ListObjects - // if objects, err = client.ListObjects(*namespace, bucket2Name, &baremetal.ListObjectsOptions{}); err != nil { - // log.Println(err) - // os.Exit(tt.ERR) - // } - // fmt.Printf("%+v\n", objects) - // tt.PrintTestFooter() - - // tt.PrintTestHeader("GetObject") - // var object2 *baremetal.Object - // if object2, err = client.GetObject(*namespace, bucket2Name, objectID, &baremetal.GetObjectOptions{}); err != nil { - // log.Println(err) - // os.Exit(tt.ERR) - // } - // fmt.Printf("%+v\n", object2) - // tt.PrintTestFooter() - - // tt.PrintTestHeader("DeleteObject") - // var delObj *baremetal.DeleteObject - // if delObj, err = client.DeleteObject(*namespace, bucket2Name, objectID, &baremetal.DeleteObjectOptions{}); err != nil { - // log.Println(err) - // os.Exit(tt.ERR) - // } - // fmt.Printf("%+v\n", delObj) - // tt.PrintTestFooter() - - tt.PrintTestHeader("DeleteBucket") - if err = client.DeleteBucket(bucketName, *namespace, &baremetal.IfMatchOptions{IfMatch: bucket2.ETag}); err != nil { - log.Println(err) - os.Exit(tt.ERR) - } - tt.PrintTestFooter() - - fmt.Printf("PASS\n") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/test/shared/shared.go b/vendor/github.com/oracle/bmcs-go-sdk/test/shared/shared.go deleted file mode 100644 index f13e06eb46..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/test/shared/shared.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package shared - -import ( - "fmt" - "os" - - "github.com/joho/godotenv" -) - -const ( - prettyString = "===========================================================" - ERR = 1 -) - -func PrintTestHeader(funcUnderTest string) { - fmt.Println("===", funcUnderTest, "===") - fmt.Println(prettyString) -} - -func PrintTestFooter() { - fmt.Println(prettyString) -} - -func PrintResults(v interface{}) { - fmt.Printf("%+v\n", v) - PrintTestFooter() -} - -var TestVals = map[string]string{} - -func init() { - - if err := godotenv.Load(); err != nil { - fmt.Println(err) - os.Exit(ERR) - } - - keys := []string{ - "BAREMETAL_PRIVATE_KEY_PATH", - "BAREMETAL_TENANCY_OCID", - "BAREMETAL_USER_OCID", - "BAREMETAL_FINGERPRINT", - "BAREMETAL_KEY_PASSWORD", - "TEST_COMPARTMENT_ID", - } - - fmt.Println("=== TEST ENVIRONMENT ===") - - fmt.Println(prettyString) - - for _, key := range keys { - val := os.Getenv(key) - fmt.Println(key, "=>", val) - TestVals[key] = val - } - - fmt.Println(prettyString) - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/time.go b/vendor/github.com/oracle/bmcs-go-sdk/time.go deleted file mode 100644 index 65152ee3e6..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/time.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import "time" - -type Time struct { - time.Time -} - -//const baremetalTimeFormat = "2006-01-02T15:04:05.999+0000" -const baremetalTimeFormat = time.RFC3339 - -func (t *Time) UnmarshalJSON(data []byte) (e error) { - s := string(data) - if s == "null" { - t.Time = time.Time{} - } else { - t.Time, e = time.Parse(`"`+baremetalTimeFormat+`"`, string(data)) - } - return -} - -func (t *Time) MarshalJSON() (buff []byte, e error) { - s := t.Format(baremetalTimeFormat) - - buff = []byte(`"` + s + `"`) - return -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/time_test.go b/vendor/github.com/oracle/bmcs-go-sdk/time_test.go deleted file mode 100644 index f276b1e46a..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/time_test.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestTimeJSONMarshalling(t *testing.T) { - buffer := []byte(`"2016-08-12T19:20:48Z"`) - - var tyme Time - err := json.Unmarshal(buffer, &tyme) - - assert.Nil(t, err) - - actual, err := tyme.MarshalJSON() - - assert.Nil(t, err) - assert.Equal(t, string(buffer), string(actual)) - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/url_builder.go b/vendor/github.com/oracle/bmcs-go-sdk/url_builder.go deleted file mode 100644 index 430e9ef6e8..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/url_builder.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "errors" - "fmt" - "net/url" - "regexp" - "strconv" -) - -type urlBuilderFn func(string, string, resourceName, url.Values, ...interface{}) (string, error) - -var urlTemplateReg = regexp.MustCompile(`^.*%s+.*%s+.*$`) - -func baseUrlHelper(urlTemplate string, service string, region string) string { - if !urlTemplateReg.MatchString(urlTemplate) { - panic("Invalid urlTemplate:" + urlTemplate) - } - - return fmt.Sprintf(urlTemplate, service, region) -} - -func buildCoreURL(urlTemplate string, region string, resource resourceName, query url.Values, ids ...interface{}) (string, error) { - baseUrl := baseUrlHelper(urlTemplate, coreServiceAPI, region) - urlStr := fmt.Sprintf("%s/%s/%s", baseUrl, coreServiceAPIVersion, resource) - return buildURL(urlStr, query, ids...) -} - -func buildIdentityURL(urlTemplate string, region string, resource resourceName, query url.Values, ids ...interface{}) (string, error) { - baseUrl := baseUrlHelper(urlTemplate, identityServiceAPI, region) - urlStr := fmt.Sprintf("%s/%s/%s", baseUrl, identityServiceAPIVersion, resource) - return buildURL(urlStr, query, ids...) -} - -func buildDatabaseURL(urlTemplate string, region string, resource resourceName, query url.Values, ids ...interface{}) (string, error) { - baseUrl := baseUrlHelper(urlTemplate, databaseServiceAPI, region) - urlStr := fmt.Sprintf("%s/%s/%s", baseUrl, databaseServiceAPIVersion, resource) - return buildURL(urlStr, query, ids...) -} - -func buildObjectStorageURL(urlTemplate string, region string, resource resourceName, query url.Values, ids ...interface{}) (string, error) { - baseUrl := baseUrlHelper(urlTemplate, objectStorageServiceAPI, region) - urlStr := fmt.Sprintf("%s/%s", baseUrl, resourceNamespaces) - if resource == resourcePAR { - return buildURL(urlStr, make(map[string][]string), ids...) - } - return buildURL(urlStr, query, ids...) -} - -func buildLoadBalancerURL(urlTemplate string, region string, resource resourceName, query url.Values, ids ...interface{}) (string, error) { - baseUrl := baseUrlHelper(urlTemplate, loadBalancerServiceAPI, region) - urlStr := fmt.Sprintf("%s/%s/%s", baseUrl, loadBalancerServiceAPIVersion, resource) - return buildURL(urlStr, query, ids...) -} - -func buildURL(urlStr string, query url.Values, ids ...interface{}) (string, error) { - const separator = "/" - for _, id := range ids { - var strVal string - - switch id := id.(type) { - default: - return "", errors.New("Unsupported type") - case bool: - strVal = strconv.FormatBool(id) - case uint64: - strVal = strconv.FormatUint(id, 10) - case string: - strVal = id - case resourceName: - strVal = string(id) - case Namespace: - strVal = string(id) - } - - if strVal != separator { - urlStr += separator - } - - urlStr += strVal - } - - u, e := url.Parse(urlStr) - if e != nil { - return "", e - } - if query != nil { - q := u.Query() - for key, vals := range query { - for _, val := range vals { - q.Add(key, val) - } - } - - u.RawQuery += q.Encode() - } - - return u.String(), nil - -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/url_builder_test.go b/vendor/github.com/oracle/bmcs-go-sdk/url_builder_test.go deleted file mode 100644 index 40a02acc59..0000000000 --- a/vendor/github.com/oracle/bmcs-go-sdk/url_builder_test.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - -package baremetal - -import ( - "net/url" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestBuildIdentityURL(t *testing.T) { - urlTemplate := "https://%s.%s.oraclecloud.com" - region := "fake-region" - baseUrl := baseUrlHelper(urlTemplate, identityServiceAPI, region) - expected := baseUrl + "/" + SDKVersion + "/policies/" - actual, _ := buildIdentityURL(urlTemplate, region, resourcePolicies, nil, "/") - assert.Equal(t, expected, actual) - - expected = baseUrl + "/" + SDKVersion + "/policies?foo=bar%2Fbaz" - actual, _ = buildIdentityURL(urlTemplate, region, resourcePolicies, url.Values{"foo": []string{"bar/baz"}}) - assert.Equal(t, expected, actual) - - expected = baseUrl + "/" + SDKVersion + "/policies/one/two?foo=bar%2Fbaz" - actual, _ = buildIdentityURL(urlTemplate, region, resourcePolicies, url.Values{"foo": []string{"bar/baz"}}, "one", "two") - assert.Equal(t, expected, actual) - - expected = baseUrl + "/" + SDKVersion + "/policies/one/two" - actual, _ = buildIdentityURL(urlTemplate, region, resourcePolicies, nil, "one", "two") - assert.Equal(t, expected, actual) - - expected = baseUrl + "/" + SDKVersion + "/policies/one/two/" - actual, _ = buildIdentityURL(urlTemplate, region, resourcePolicies, nil, "one", "two", "/") - assert.Equal(t, expected, actual) -} - -func TestBuildObjectStorageURL(t *testing.T) { - urlTemplate := "https://%s.%s.oraclecloud.com" - region := "fake-region" - baseUrl := baseUrlHelper(urlTemplate, objectStorageServiceAPI, region) - - expected := baseUrl + "/n/example_namespace/b" - actual, _ := buildObjectStorageURL(urlTemplate, region, resourceBuckets, nil, "example_namespace", "b") - assert.Equal(t, expected, actual) - - expected = baseUrl + "/n/example_namespace/b/foo" - actual, _ = buildObjectStorageURL(urlTemplate, region, resourceBuckets, nil, "example_namespace", "b", "foo") - assert.Equal(t, expected, actual) -} - -func TestBuildCoreURL(t *testing.T) { - urlTemplate := "https://%s.%s.oraclecloud.com" - region := "fake-region" - baseUrl := baseUrlHelper(urlTemplate, coreServiceAPI, region) - - expected := baseUrl + "/" + SDKVersion + "/cpes" - actual, _ := buildCoreURL(urlTemplate, region, resourceCustomerPremiseEquipment, nil) - assert.Equal(t, expected, actual) - - expected = baseUrl + "/" + SDKVersion + "/instanceConsoleHistories/12/data" - actual, _ = buildCoreURL(urlTemplate, region, resourceInstanceConsoleHistories, nil, "12", "data") - assert.Equal(t, expected, actual) -} - -func TestUnparsableURL(t *testing.T) { - urlTemplate := "%!@%s.%s" - region := "fake-region" - - _, err := buildCoreURL(urlTemplate, region, resourceInstanceConsoleHistories, nil, "12", "data") - assert.NotNil(t, err) - urlError := err.(*url.Error) - assert.Equal(t, "parse", urlError.Op) -} - -func TestBadType(t *testing.T) { - urlTemplate := "https://%s.%s.oraclecloud.com" - region := "fake-region" - - // Floats are not a supported type in the "ids" field. - _, err := buildCoreURL(urlTemplate, region, resourceInstanceConsoleHistories, nil, 1.23) - assert.Error(t, err, "Unsupported type") -} diff --git a/vendor/github.com/oracle/bmcs-go-sdk/LICENSE.md b/vendor/github.com/oracle/oci-go-sdk/LICENSE.txt similarity index 87% rename from vendor/github.com/oracle/bmcs-go-sdk/LICENSE.md rename to vendor/github.com/oracle/oci-go-sdk/LICENSE.txt index 7f128e02de..63bc0c882e 100644 --- a/vendor/github.com/oracle/bmcs-go-sdk/LICENSE.md +++ b/vendor/github.com/oracle/oci-go-sdk/LICENSE.txt @@ -1,9 +1,9 @@ -Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. -This software is dual-licensed to you under the Universal Permissive License (UPL) and Apache License 2.0. See below for license terms. You may choose either license, or both. - ____________________________ +This software is dual-licensed to you under the Universal Permissive License (UPL) and Apache License 2.0.  See below for license terms.  You may choose either license, or both. + ____________________________ The Universal Permissive License (UPL), Version 1.0 -Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. Subject to the condition set forth below, permission is hereby granted to any person obtaining a copy of this software, associated documentation and/or data (collectively the "Software"), free of charge and under any and all copyright rights in the Software, and any and all patent rights owned or freely licensable by each licensor hereunder covering either (i) the unmodified Software as contributed to or provided by such licensor, or (ii) the Larger Works (as defined below), to deal in both @@ -19,7 +19,7 @@ The above copyright notice and either this complete permission notice or at a mi THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. The Apache Software License, Version 2.0 -Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); You may not use this product except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. A copy of the license is also reproduced below. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. @@ -27,7 +27,7 @@ Apache License Version 2.0, January 2004 -http://www.apache.org/licenses/ +http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. @@ -46,39 +46,37 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. -You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. +If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - END OF TERMS AND CONDITIONS + APPENDIX: How to apply the Apache License to your work. + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] + Copyright [yyyy] [name of copyright owner] -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/oracle/oci-go-sdk/audit/audit_client.go b/vendor/github.com/oracle/oci-go-sdk/audit/audit_client.go new file mode 100644 index 0000000000..ce0ad0c553 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/audit/audit_client.go @@ -0,0 +1,113 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Audit API +// +// API for the Audit Service. You can use this API for queries, but not bulk-export operations. +// + +package audit + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +//AuditClient a client for Audit +type AuditClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewAuditClientWithConfigurationProvider Creates a new default Audit client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewAuditClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client AuditClient, err error) { + baseClient, err := common.NewClientWithConfig(configProvider) + if err != nil { + return + } + + client = AuditClient{BaseClient: baseClient} + client.BasePath = "20160918" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *AuditClient) SetRegion(region string) { + client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "audit", region) +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *AuditClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.config = &configProvider + client.SetRegion(region) + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *AuditClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// GetConfiguration Get the configuration +func (client AuditClient) GetConfiguration(ctx context.Context, request GetConfigurationRequest) (response GetConfigurationResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/configuration", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListEvents Returns all audit events for the specified compartment that were processed within the specified time range. +func (client AuditClient) ListEvents(ctx context.Context, request ListEventsRequest) (response ListEventsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/auditEvents", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateConfiguration Update the configuration +func (client AuditClient) UpdateConfiguration(ctx context.Context, request UpdateConfigurationRequest) (response UpdateConfigurationResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/configuration", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/audit/audit_event.go b/vendor/github.com/oracle/oci-go-sdk/audit/audit_event.go new file mode 100644 index 0000000000..bc0012c6d5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/audit/audit_event.go @@ -0,0 +1,78 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Audit API +// +// API for the Audit Service. You can use this API for queries, but not bulk-export operations. +// + +package audit + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// AuditEvent The representation of AuditEvent +type AuditEvent struct { + + // The OCID of the tenant. + TenantId *string `mandatory:"false" json:"tenantId"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // The GUID of the event. + EventId *string `mandatory:"false" json:"eventId"` + + // The source of the event. + EventSource *string `mandatory:"false" json:"eventSource"` + + // The type of the event. + EventType *string `mandatory:"false" json:"eventType"` + + // The time the event occurred, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + EventTime *common.SDKTime `mandatory:"false" json:"eventTime"` + + // The OCID of the user whose action triggered the event. + PrincipalId *string `mandatory:"false" json:"principalId"` + + // The credential ID of the user. This value is extracted from the HTTP 'Authorization' request header. It consists of the tenantId, userId, and user fingerprint, all delimited by a slash (/). + CredentialId *string `mandatory:"false" json:"credentialId"` + + // The HTTP method of the request. + RequestAction *string `mandatory:"false" json:"requestAction"` + + // The opc-request-id of the request. + RequestId *string `mandatory:"false" json:"requestId"` + + // The user agent of the client that made the request. + RequestAgent *string `mandatory:"false" json:"requestAgent"` + + // The HTTP header fields and values in the request. + RequestHeaders map[string][]string `mandatory:"false" json:"requestHeaders"` + + // The IP address of the source of the request. + RequestOrigin *string `mandatory:"false" json:"requestOrigin"` + + // The query parameter fields and values for the request. + RequestParameters map[string][]string `mandatory:"false" json:"requestParameters"` + + // The resource targeted by the request. + RequestResource *string `mandatory:"false" json:"requestResource"` + + // The headers of the response. + ResponseHeaders map[string][]string `mandatory:"false" json:"responseHeaders"` + + // The status code of the response. + ResponseStatus *string `mandatory:"false" json:"responseStatus"` + + // The time of the response to the audited request, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + ResponseTime *common.SDKTime `mandatory:"false" json:"responseTime"` + + // Metadata of interest from the response payload. For example, the OCID of a resource. + ResponsePayload map[string]interface{} `mandatory:"false" json:"responsePayload"` +} + +func (m AuditEvent) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/audit/configuration.go b/vendor/github.com/oracle/oci-go-sdk/audit/configuration.go new file mode 100644 index 0000000000..35d0c9b075 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/audit/configuration.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Audit API +// +// API for the Audit Service. You can use this API for queries, but not bulk-export operations. +// + +package audit + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Configuration The representation of Configuration +type Configuration struct { + + // The retention period days + RetentionPeriodDays *int `mandatory:"false" json:"retentionPeriodDays"` +} + +func (m Configuration) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/audit/get_configuration_request_response.go b/vendor/github.com/oracle/oci-go-sdk/audit/get_configuration_request_response.go new file mode 100644 index 0000000000..684d790b0b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/audit/get_configuration_request_response.go @@ -0,0 +1,34 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package audit + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetConfigurationRequest wrapper for the GetConfiguration operation +type GetConfigurationRequest struct { + + // ID of the root compartment (tenancy) + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` +} + +func (request GetConfigurationRequest) String() string { + return common.PointerString(request) +} + +// GetConfigurationResponse wrapper for the GetConfiguration operation +type GetConfigurationResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Configuration instance + Configuration `presentIn:"body"` +} + +func (response GetConfigurationResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/audit/list_events_request_response.go b/vendor/github.com/oracle/oci-go-sdk/audit/list_events_request_response.go new file mode 100644 index 0000000000..e8c6b8d6b1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/audit/list_events_request_response.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package audit + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListEventsRequest wrapper for the ListEvents operation +type ListEventsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // Returns events that were processed at or after this start date and time, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. + // For example, a start value of `2017-01-15T11:30:00Z` will retrieve a list of all events processed since 30 minutes after the 11th hour of January 15, 2017, in Coordinated Universal Time (UTC). + // You can specify a value with granularity to the minute. Seconds (and milliseconds, if included) must be set to `0`. + StartTime *common.SDKTime `mandatory:"true" contributesTo:"query" name:"startTime"` + + // Returns events that were processed before this end date and time, expressed in RFC 3339 (https://tools.ietf.org/html/rfc3339) timestamp format. For example, a start value of `2017-01-01T00:00:00Z` and an end value of `2017-01-02T00:00:00Z` will retrieve a list of all events processed on January 1, 2017. + // Similarly, a start value of `2017-01-01T00:00:00Z` and an end value of `2017-02-01T00:00:00Z` will result in a list of all events processed between January 1, 2017 and January 31, 2017. + // You can specify a value with granularity to the minute. Seconds (and milliseconds, if included) must be set to `0`. + EndTime *common.SDKTime `mandatory:"true" contributesTo:"query" name:"endTime"` + + // The value of the `opc-next-page` response header from the previous list query. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // Unique Oracle-assigned identifier for the request. + // If you need to contact Oracle about a particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request ListEventsRequest) String() string { + return common.PointerString(request) +} + +// ListEventsResponse wrapper for the ListEvents operation +type ListEventsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []AuditEvent instance + Items []AuditEvent `presentIn:"body"` + + // For pagination of a list of audit events. When this header appears in the response, + // it means you received a partial list and there are more results. + // Include this value as the `page` parameter for the subsequent ListEvents request to get the next batch of events. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListEventsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/audit/update_configuration_details.go b/vendor/github.com/oracle/oci-go-sdk/audit/update_configuration_details.go new file mode 100644 index 0000000000..a1129293bc --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/audit/update_configuration_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Audit API +// +// API for the Audit Service. You can use this API for queries, but not bulk-export operations. +// + +package audit + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateConfigurationDetails The representation of UpdateConfigurationDetails +type UpdateConfigurationDetails struct { + + // The retention period days + RetentionPeriodDays *int `mandatory:"false" json:"retentionPeriodDays"` +} + +func (m UpdateConfigurationDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/audit/update_configuration_request_response.go b/vendor/github.com/oracle/oci-go-sdk/audit/update_configuration_request_response.go new file mode 100644 index 0000000000..2d709a8a82 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/audit/update_configuration_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package audit + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateConfigurationRequest wrapper for the UpdateConfiguration operation +type UpdateConfigurationRequest struct { + + // ID of the root compartment (tenancy) + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The configuration properties + UpdateConfigurationDetails `contributesTo:"body"` +} + +func (request UpdateConfigurationRequest) String() string { + return common.PointerString(request) +} + +// UpdateConfigurationResponse wrapper for the UpdateConfiguration operation +type UpdateConfigurationResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response UpdateConfigurationResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/cmd/genver/main.go b/vendor/github.com/oracle/oci-go-sdk/cmd/genver/main.go new file mode 100644 index 0000000000..d9ba965c39 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/cmd/genver/main.go @@ -0,0 +1,66 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +// Package main The following code is used to generate the version of the go sdk +// +build ignore + +package main + +import ( + "bytes" + "flag" + "fmt" + "html/template" + "io/ioutil" + "log" + "os" +) + +// Environment variables for version information +const ( + majorVer = "VER_MAJOR" + minorVer = "VER_MINOR" + patchVer = "VER_PATCH" + tag = "VER_TAG" +) + +var output = flag.String("output", "", "output for the file") + +func getEnvOrDefault(envkey, defaultValue string) string { + if val := os.Getenv(envkey); val != "" { + return val + } + return defaultValue +} + +// Reads the output file as a flag and version information from environment variables +func main() { + flag.Parse() + genTemplate := template.Must(template.New("version").Parse(versionTemplate)) + + versions := struct { + Major, Minor, Patch string + Tag string + }{ + getEnvOrDefault(majorVer, "0"), + getEnvOrDefault(minorVer, "0" ), + getEnvOrDefault(patchVer, "0"), + getEnvOrDefault(tag, ""), + } + + var buf bytes.Buffer + + if err := genTemplate.Execute(&buf, versions); err != nil { + log.Printf("error while generation version: %s", err) + return + } + + if *output == "" { + fmt.Print(buf.String()) + return + } + + if err := ioutil.WriteFile(*output, buf.Bytes(), 0644); err != nil { + log.Printf("could not write output file: %s", err) + return + } +} diff --git a/vendor/github.com/oracle/oci-go-sdk/cmd/genver/version_template.go b/vendor/github.com/oracle/oci-go-sdk/cmd/genver/version_template.go new file mode 100644 index 0000000000..5c684fd5e4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/cmd/genver/version_template.go @@ -0,0 +1,42 @@ +package main + + +const versionTemplate = ` +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated by go generate; DO NOT EDIT + +package common + +import ( + "bytes" + "fmt" + "sync" +) + +const ( + major = "{{.Major}}" + minor = "{{.Minor}}" + patch = "{{.Patch}}" + tag = "{{.Tag}}" +) + +var once sync.Once +var version string + +// Version returns semantic version of the sdk +func Version() string { + once.Do(func() { + ver := fmt.Sprintf("%s.%s.%s", major, minor, patch) + verBuilder := bytes.NewBufferString(ver) + if tag != "" && tag != "-" { + _, err := verBuilder.WriteString(tag) + if err == nil { + verBuilder = bytes.NewBufferString(ver) + } + } + version = verBuilder.String() + }) + return version +} +` + diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/certificate_retriever.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/certificate_retriever.go new file mode 100644 index 0000000000..e2e04ee7a8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/certificate_retriever.go @@ -0,0 +1,154 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package auth + +import ( + "bytes" + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "sync" +) + +// x509CertificateRetriever provides an X509 certificate with the RSA private key +type x509CertificateRetriever interface { + Refresh() error + CertificatePemRaw() []byte + Certificate() *x509.Certificate + PrivateKeyPemRaw() []byte + PrivateKey() *rsa.PrivateKey +} + +// urlBasedX509CertificateRetriever retrieves PEM-encoded X509 certificates from the given URLs. +type urlBasedX509CertificateRetriever struct { + certURL string + privateKeyURL string + passphrase string + certificatePemRaw []byte + certificate *x509.Certificate + privateKeyPemRaw []byte + privateKey *rsa.PrivateKey + mux sync.Mutex +} + +func newURLBasedX509CertificateRetriever(certURL, privateKeyURL, passphrase string) x509CertificateRetriever { + return &urlBasedX509CertificateRetriever{ + certURL: certURL, + privateKeyURL: privateKeyURL, + passphrase: passphrase, + mux: sync.Mutex{}, + } +} + +// Refresh() is failure atomic, i.e., CertificatePemRaw(), Certificate(), PrivateKeyPemRaw(), and PrivateKey() would +// return their previous values if Refresh() fails. +func (r *urlBasedX509CertificateRetriever) Refresh() error { + common.Debugln("Refreshing certificate") + + r.mux.Lock() + defer r.mux.Unlock() + + var err error + + var certificatePemRaw []byte + var certificate *x509.Certificate + if certificatePemRaw, certificate, err = r.renewCertificate(r.certURL); err != nil { + return fmt.Errorf("failed to renew certificate: %s", err.Error()) + } + + var privateKeyPemRaw []byte + var privateKey *rsa.PrivateKey + if r.privateKeyURL != "" { + if privateKeyPemRaw, privateKey, err = r.renewPrivateKey(r.privateKeyURL, r.passphrase); err != nil { + return fmt.Errorf("failed to renew private key: %s", err.Error()) + } + } + + r.certificatePemRaw = certificatePemRaw + r.certificate = certificate + r.privateKeyPemRaw = privateKeyPemRaw + r.privateKey = privateKey + return nil +} + +func (r *urlBasedX509CertificateRetriever) renewCertificate(url string) (certificatePemRaw []byte, certificate *x509.Certificate, err error) { + var body bytes.Buffer + if body, err = httpGet(url); err != nil { + return nil, nil, fmt.Errorf("failed to get certificate from %s: %s", url, err.Error()) + } + + certificatePemRaw = body.Bytes() + var block *pem.Block + block, _ = pem.Decode(certificatePemRaw) + if certificate, err = x509.ParseCertificate(block.Bytes); err != nil { + return nil, nil, fmt.Errorf("failed to parse the new certificate: %s", err.Error()) + } + + return certificatePemRaw, certificate, nil +} + +func (r *urlBasedX509CertificateRetriever) renewPrivateKey(url, passphrase string) (privateKeyPemRaw []byte, privateKey *rsa.PrivateKey, err error) { + var body bytes.Buffer + if body, err = httpGet(url); err != nil { + return nil, nil, fmt.Errorf("failed to get private key from %s: %s", url, err.Error()) + } + + privateKeyPemRaw = body.Bytes() + if privateKey, err = common.PrivateKeyFromBytes(privateKeyPemRaw, &passphrase); err != nil { + return nil, nil, fmt.Errorf("failed to parse the new private key: %s", err.Error()) + } + + return privateKeyPemRaw, privateKey, nil +} + +func (r *urlBasedX509CertificateRetriever) CertificatePemRaw() []byte { + r.mux.Lock() + defer r.mux.Unlock() + + if r.certificatePemRaw == nil { + return nil + } + + c := make([]byte, len(r.certificatePemRaw)) + copy(c, r.certificatePemRaw) + return c +} + +func (r *urlBasedX509CertificateRetriever) Certificate() *x509.Certificate { + r.mux.Lock() + defer r.mux.Unlock() + + if r.certificate == nil { + return nil + } + + c := *r.certificate + return &c +} + +func (r *urlBasedX509CertificateRetriever) PrivateKeyPemRaw() []byte { + r.mux.Lock() + defer r.mux.Unlock() + + if r.privateKeyPemRaw == nil { + return nil + } + + c := make([]byte, len(r.privateKeyPemRaw)) + copy(c, r.privateKeyPemRaw) + return c +} + +func (r *urlBasedX509CertificateRetriever) PrivateKey() *rsa.PrivateKey { + r.mux.Lock() + defer r.mux.Unlock() + + if r.privateKey == nil { + return nil + } + + c := *r.privateKey + return &c +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/certificate_retriever_test.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/certificate_retriever_test.go new file mode 100644 index 0000000000..42dea43ed3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/certificate_retriever_test.go @@ -0,0 +1,210 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package auth + +import ( + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "crypto/x509/pkix" + "encoding/pem" + "fmt" + "github.com/stretchr/testify/assert" + "math/big" + "net/http" + "net/http/httptest" + "testing" + "time" +) + +func TestUrlBasedX509CertificateRetriever_RefreshWithoutPrivateKeyUrl(t *testing.T) { + _, expectedCert := generateRandomCertificate() + certServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, string(expectedCert)) + })) + defer certServer.Close() + + retriever := newURLBasedX509CertificateRetriever(certServer.URL, "", "") + err := retriever.Refresh() + + assert.NoError(t, err) + + assert.Equal(t, expectedCert, retriever.CertificatePemRaw()) + actualCert := retriever.Certificate() + actualCertPem := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: actualCert.Raw}) + assert.Equal(t, expectedCert, actualCertPem) + + assert.Nil(t, retriever.PrivateKeyPemRaw()) + assert.Nil(t, retriever.PrivateKey()) +} + +func TestUrlBasedX509CertificateRetriever_RefreshWithPrivateKeyUrl(t *testing.T) { + expectedPrivateKey, expectedCert := generateRandomCertificate() + certServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, string(expectedCert)) + })) + defer certServer.Close() + privateKeyServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, string(expectedPrivateKey)) + })) + defer privateKeyServer.Close() + + retriever := newURLBasedX509CertificateRetriever(certServer.URL, privateKeyServer.URL, "") + err := retriever.Refresh() + + assert.NoError(t, err) + + assert.Equal(t, expectedCert, retriever.CertificatePemRaw()) + actualCert := retriever.Certificate() + actualCertPem := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: actualCert.Raw}) + assert.Equal(t, expectedCert, actualCertPem) + + assert.Equal(t, expectedPrivateKey, retriever.PrivateKeyPemRaw()) + actualPrivateKey := retriever.PrivateKey() + actualPrivateKeyPem := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(actualPrivateKey)}) + assert.Equal(t, expectedPrivateKey, actualPrivateKeyPem) +} + +func TestUrlBasedX509CertificateRetriever_RefreshCertNotFound(t *testing.T) { + certServer := httptest.NewServer(http.NotFoundHandler()) + defer certServer.Close() + + retriever := newURLBasedX509CertificateRetriever(certServer.URL, "", "") + err := retriever.Refresh() + + assert.Error(t, err) + assert.Nil(t, retriever.CertificatePemRaw()) + assert.Nil(t, retriever.Certificate()) + assert.Nil(t, retriever.PrivateKeyPemRaw()) + assert.Nil(t, retriever.PrivateKey()) +} + +func TestUrlBasedX509CertificateRetriever_RefreshPrivateKeyNotFound(t *testing.T) { + _, expectedCert := generateRandomCertificate() + certServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, string(expectedCert)) + })) + defer certServer.Close() + privateKeyServer := httptest.NewServer(http.NotFoundHandler()) + defer privateKeyServer.Close() + + retriever := newURLBasedX509CertificateRetriever(certServer.URL, privateKeyServer.URL, "") + err := retriever.Refresh() + + assert.Error(t, err) + assert.Nil(t, retriever.CertificatePemRaw()) + assert.Nil(t, retriever.Certificate()) + assert.Nil(t, retriever.PrivateKeyPemRaw()) + assert.Nil(t, retriever.PrivateKey()) +} + +func internalServerError(w http.ResponseWriter, r *http.Request) { + http.Error(w, "500 internal server error", http.StatusInternalServerError) +} + +func TestUrlBasedX509CertificateRetriever_RefreshCertInternalServerError(t *testing.T) { + certServer := httptest.NewServer(http.HandlerFunc(internalServerError)) + defer certServer.Close() + + retriever := newURLBasedX509CertificateRetriever(certServer.URL, "", "") + err := retriever.Refresh() + + assert.Error(t, err) + assert.Nil(t, retriever.CertificatePemRaw()) + assert.Nil(t, retriever.Certificate()) + assert.Nil(t, retriever.PrivateKeyPemRaw()) + assert.Nil(t, retriever.PrivateKey()) +} + +func TestUrlBasedX509CertificateRetriever_RefreshPrivateKeyInternalServerError(t *testing.T) { + _, expectedCert := generateRandomCertificate() + certServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, string(expectedCert)) + })) + defer certServer.Close() + privateKeyServer := httptest.NewServer(http.HandlerFunc(internalServerError)) + defer privateKeyServer.Close() + + retriever := newURLBasedX509CertificateRetriever(certServer.URL, privateKeyServer.URL, "") + err := retriever.Refresh() + + assert.Error(t, err) + assert.Nil(t, retriever.CertificatePemRaw()) + assert.Nil(t, retriever.Certificate()) + assert.Nil(t, retriever.PrivateKeyPemRaw()) + assert.Nil(t, retriever.PrivateKey()) +} + +func TestUrlBasedX509CertificateRetriever_FailureAtomicity(t *testing.T) { + privateKeyServerFailed := false + + expectedPrivateKey, expectedCert := generateRandomCertificate() + _, anotherCert := generateRandomCertificate() + + certServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if privateKeyServerFailed { + fmt.Fprint(w, string(anotherCert)) + + } else { + fmt.Fprint(w, string(expectedCert)) + } + })) + defer certServer.Close() + + privateKeyServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if privateKeyServerFailed { + internalServerError(w, r) + } else { + fmt.Fprint(w, string(expectedPrivateKey)) + } + })) + defer privateKeyServer.Close() + + retriever := newURLBasedX509CertificateRetriever(certServer.URL, privateKeyServer.URL, "") + err := retriever.Refresh() + + assert.NoError(t, err) + + privateKeyServerFailed = true + + err = retriever.Refresh() + + assert.Error(t, err) + assert.Equal(t, expectedCert, retriever.CertificatePemRaw()) // Not anotherCert but expectedCert + actualCert := retriever.Certificate() + actualCertPem := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: actualCert.Raw}) + assert.Equal(t, expectedCert, actualCertPem) + + assert.Equal(t, expectedPrivateKey, retriever.PrivateKeyPemRaw()) + actualPrivateKey := retriever.PrivateKey() + actualPrivateKeyPem := pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(actualPrivateKey)}) + assert.Equal(t, expectedPrivateKey, actualPrivateKeyPem) +} + +func generateRandomCertificate() (privateKeyPem, certPem []byte) { + serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) + serialNumber, _ := rand.Int(rand.Reader, serialNumberLimit) + notBefore := time.Now() + notAfter := notBefore.Add(365 * 24 * time.Hour) + + template := x509.Certificate{ + SerialNumber: serialNumber, + Issuer: pkix.Name{ + CommonName: "PKISVC Identity Intermediate r2", + }, + Subject: pkix.Name{ + CommonName: "ocid1.instance.oc1.phx.bluhbluhbluh", + }, + NotBefore: notBefore, + NotAfter: notAfter, + PublicKeyAlgorithm: x509.RSA, + SignatureAlgorithm: x509.SHA256WithRSA, + } + + privateKey, _ := rsa.GenerateKey(rand.Reader, 2048) + newCertBytes, _ := x509.CreateCertificate(rand.Reader, &template, &template, privateKey.Public(), privateKey) + + privateKeyPem = pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(privateKey)}) + certPem = pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: newCertBytes}) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/configuration.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/configuration.go new file mode 100644 index 0000000000..b0f455e9b3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/configuration.go @@ -0,0 +1,61 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package auth + +import ( + "crypto/rsa" + "fmt" + "github.com/oracle/oci-go-sdk/common" +) + +type instancePrincipalConfigurationProvider struct { + keyProvider *instancePrincipalKeyProvider + region *common.Region +} + +//InstancePrincipalConfigurationProvider returns a configuration for instance principals +func InstancePrincipalConfigurationProvider() (common.ConfigurationProvider, error) { + var err error + var keyProvider *instancePrincipalKeyProvider + if keyProvider, err = newInstancePrincipalKeyProvider(); err != nil { + return nil, fmt.Errorf("failed to create a new key provider for instance principal: %s", err.Error()) + } + return instancePrincipalConfigurationProvider{keyProvider: keyProvider, region: nil}, nil +} + +//InstancePrincipalConfigurationProviderForRegion returns a configuration for instance principals with a given region +func InstancePrincipalConfigurationProviderForRegion(region common.Region) (common.ConfigurationProvider, error) { + var err error + var keyProvider *instancePrincipalKeyProvider + if keyProvider, err = newInstancePrincipalKeyProvider(); err != nil { + return nil, fmt.Errorf("failed to create a new key provider for instance principal: %s", err.Error()) + } + return instancePrincipalConfigurationProvider{keyProvider: keyProvider, region: ®ion}, nil +} + +func (p instancePrincipalConfigurationProvider) PrivateRSAKey() (*rsa.PrivateKey, error) { + return p.keyProvider.PrivateRSAKey() +} + +func (p instancePrincipalConfigurationProvider) KeyID() (string, error) { + return p.keyProvider.KeyID() +} + +func (p instancePrincipalConfigurationProvider) TenancyOCID() (string, error) { + return "", nil +} + +func (p instancePrincipalConfigurationProvider) UserOCID() (string, error) { + return "", nil +} + +func (p instancePrincipalConfigurationProvider) KeyFingerprint() (string, error) { + return "", nil +} + +func (p instancePrincipalConfigurationProvider) Region() (string, error) { + if p.region == nil { + return string(p.keyProvider.RegionForFederationClient()), nil + } + return string(*p.region), nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/federation_client.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/federation_client.go new file mode 100644 index 0000000000..f15aff82d3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/federation_client.go @@ -0,0 +1,288 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +// Package auth provides supporting functions and structs for authentication +package auth + +import ( + "context" + "crypto/rand" + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" + "strings" + "sync" +) + +// federationClient is a client to retrieve the security token for an instance principal necessary to sign a request. +// It also provides the private key whose corresponding public key is used to retrieve the security token. +type federationClient interface { + PrivateKey() (*rsa.PrivateKey, error) + SecurityToken() (string, error) +} + +// x509FederationClient retrieves a security token from Auth service. +type x509FederationClient struct { + tenancyID string + sessionKeySupplier sessionKeySupplier + leafCertificateRetriever x509CertificateRetriever + intermediateCertificateRetrievers []x509CertificateRetriever + securityToken securityToken + authClient *common.BaseClient + mux sync.Mutex +} + +func newX509FederationClient(region common.Region, tenancyID string, leafCertificateRetriever x509CertificateRetriever, intermediateCertificateRetrievers []x509CertificateRetriever) federationClient { + client := &x509FederationClient{ + tenancyID: tenancyID, + leafCertificateRetriever: leafCertificateRetriever, + intermediateCertificateRetrievers: intermediateCertificateRetrievers, + } + client.sessionKeySupplier = newSessionKeySupplier() + client.authClient = newAuthClient(region, client) + return client +} + +var ( + genericHeaders = []string{"date", "(request-target)"} // "host" is not needed for the federation endpoint. Don't ask me why. + bodyHeaders = []string{"content-length", "content-type", "x-content-sha256"} +) + +func newAuthClient(region common.Region, provider common.KeyProvider) *common.BaseClient { + signer := common.RequestSigner(provider, genericHeaders, bodyHeaders) + client := common.DefaultBaseClientWithSigner(signer) + client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "auth", string(region)) + client.BasePath = "v1/x509" + return &client +} + +// For authClient to sign requests to X509 Federation Endpoint +func (c *x509FederationClient) KeyID() (string, error) { + tenancy := c.tenancyID + fingerprint := fingerprint(c.leafCertificateRetriever.Certificate()) + return fmt.Sprintf("%s/fed-x509/%s", tenancy, fingerprint), nil +} + +// For authClient to sign requests to X509 Federation Endpoint +func (c *x509FederationClient) PrivateRSAKey() (*rsa.PrivateKey, error) { + return c.leafCertificateRetriever.PrivateKey(), nil +} + +func (c *x509FederationClient) PrivateKey() (*rsa.PrivateKey, error) { + c.mux.Lock() + defer c.mux.Unlock() + + if err := c.renewSecurityTokenIfNotValid(); err != nil { + return nil, err + } + return c.sessionKeySupplier.PrivateKey(), nil +} + +func (c *x509FederationClient) SecurityToken() (token string, err error) { + c.mux.Lock() + defer c.mux.Unlock() + + if err = c.renewSecurityTokenIfNotValid(); err != nil { + return "", err + } + return c.securityToken.String(), nil +} + +func (c *x509FederationClient) renewSecurityTokenIfNotValid() (err error) { + if c.securityToken == nil || !c.securityToken.Valid() { + if err = c.renewSecurityToken(); err != nil { + return fmt.Errorf("failed to renew security token: %s", err.Error()) + } + } + return nil +} + +func (c *x509FederationClient) renewSecurityToken() (err error) { + if err = c.sessionKeySupplier.Refresh(); err != nil { + return fmt.Errorf("failed to refresh session key: %s", err.Error()) + } + + if err = c.leafCertificateRetriever.Refresh(); err != nil { + return fmt.Errorf("failed to refresh leaf certificate: %s", err.Error()) + } + + updatedTenancyID := extractTenancyIDFromCertificate(c.leafCertificateRetriever.Certificate()) + if c.tenancyID != updatedTenancyID { + err = fmt.Errorf("unexpected update of tenancy OCID in the leaf certificate. Previous tenancy: %s, Updated: %s", c.tenancyID, updatedTenancyID) + return + } + + for _, retriever := range c.intermediateCertificateRetrievers { + if err = retriever.Refresh(); err != nil { + return fmt.Errorf("failed to refresh intermediate certificate: %s", err.Error()) + } + } + + if c.securityToken, err = c.getSecurityToken(); err != nil { + return fmt.Errorf("failed to get security token: %s", err.Error()) + } + + return nil +} + +func (c *x509FederationClient) getSecurityToken() (securityToken, error) { + request := c.makeX509FederationRequest() + + var err error + var httpRequest http.Request + if httpRequest, err = common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "", request); err != nil { + return nil, fmt.Errorf("failed to make http request: %s", err.Error()) + } + + var httpResponse *http.Response + defer common.CloseBodyIfValid(httpResponse) + if httpResponse, err = c.authClient.Call(context.Background(), &httpRequest); err != nil { + return nil, fmt.Errorf("failed to call: %s", err.Error()) + } + + response := x509FederationResponse{} + if err = common.UnmarshalResponse(httpResponse, &response); err != nil { + return nil, fmt.Errorf("failed to unmarshal the response: %s", err.Error()) + } + + return newInstancePrincipalToken(response.Token.Token) +} + +type x509FederationRequest struct { + X509FederationDetails `contributesTo:"body"` +} + +// X509FederationDetails x509 federation details +type X509FederationDetails struct { + Certificate string `mandatory:"true" json:"certificate,omitempty"` + PublicKey string `mandatory:"true" json:"publicKey,omitempty"` + IntermediateCertificates []string `mandatory:"false" json:"intermediateCertificates,omitempty"` +} + +type x509FederationResponse struct { + Token `presentIn:"body"` +} + +// Token token +type Token struct { + Token string `mandatory:"true" json:"token,omitempty"` +} + +func (c *x509FederationClient) makeX509FederationRequest() *x509FederationRequest { + certificate := c.sanitizeCertificateString(string(c.leafCertificateRetriever.CertificatePemRaw())) + publicKey := c.sanitizeCertificateString(string(c.sessionKeySupplier.PublicKeyPemRaw())) + var intermediateCertificates []string + for _, retriever := range c.intermediateCertificateRetrievers { + intermediateCertificates = append(intermediateCertificates, c.sanitizeCertificateString(string(retriever.CertificatePemRaw()))) + } + + details := X509FederationDetails{ + Certificate: certificate, + PublicKey: publicKey, + IntermediateCertificates: intermediateCertificates, + } + return &x509FederationRequest{details} +} + +func (c *x509FederationClient) sanitizeCertificateString(certString string) string { + certString = strings.Replace(certString, "-----BEGIN CERTIFICATE-----", "", -1) + certString = strings.Replace(certString, "-----END CERTIFICATE-----", "", -1) + certString = strings.Replace(certString, "-----BEGIN PUBLIC KEY-----", "", -1) + certString = strings.Replace(certString, "-----END PUBLIC KEY-----", "", -1) + certString = strings.Replace(certString, "\n", "", -1) + return certString +} + +// sessionKeySupplier provides an RSA keypair which can be re-generated by calling Refresh(). +type sessionKeySupplier interface { + Refresh() error + PrivateKey() *rsa.PrivateKey + PublicKeyPemRaw() []byte +} + +// inMemorySessionKeySupplier implements sessionKeySupplier to vend an RSA keypair. +// Refresh() generates a new RSA keypair with a random source, and keeps it in memory. +// +// inMemorySessionKeySupplier is not thread-safe. +type inMemorySessionKeySupplier struct { + keySize int + privateKey *rsa.PrivateKey + publicKeyPemRaw []byte +} + +// newSessionKeySupplier creates and returns a sessionKeySupplier instance which generates key pairs of size 2048. +func newSessionKeySupplier() sessionKeySupplier { + return &inMemorySessionKeySupplier{keySize: 2048} +} + +// Refresh() is failure atomic, i.e., PrivateKey() and PublicKeyPemRaw() would return their previous values +// if Refresh() fails. +func (s *inMemorySessionKeySupplier) Refresh() (err error) { + common.Debugln("Refreshing session key") + + var privateKey *rsa.PrivateKey + privateKey, err = rsa.GenerateKey(rand.Reader, s.keySize) + if err != nil { + return fmt.Errorf("failed to generate a new keypair: %s", err) + } + + var publicKeyAsnBytes []byte + if publicKeyAsnBytes, err = x509.MarshalPKIXPublicKey(privateKey.Public()); err != nil { + return fmt.Errorf("failed to marshal the public part of the new keypair: %s", err.Error()) + } + publicKeyPemRaw := pem.EncodeToMemory(&pem.Block{ + Type: "PUBLIC KEY", + Bytes: publicKeyAsnBytes, + }) + + s.privateKey = privateKey + s.publicKeyPemRaw = publicKeyPemRaw + return nil +} + +func (s *inMemorySessionKeySupplier) PrivateKey() *rsa.PrivateKey { + if s.privateKey == nil { + return nil + } + + c := *s.privateKey + return &c +} + +func (s *inMemorySessionKeySupplier) PublicKeyPemRaw() []byte { + if s.publicKeyPemRaw == nil { + return nil + } + + c := make([]byte, len(s.publicKeyPemRaw)) + copy(c, s.publicKeyPemRaw) + return c +} + +type securityToken interface { + fmt.Stringer + Valid() bool +} + +type instancePrincipalToken struct { + tokenString string + jwtToken *jwtToken +} + +func newInstancePrincipalToken(tokenString string) (newToken securityToken, err error) { + var jwtToken *jwtToken + if jwtToken, err = parseJwt(tokenString); err != nil { + return nil, fmt.Errorf("failed to parse the token string \"%s\": %s", tokenString, err.Error()) + } + return &instancePrincipalToken{tokenString, jwtToken}, nil +} + +func (t *instancePrincipalToken) String() string { + return t.tokenString +} + +func (t *instancePrincipalToken) Valid() bool { + return !t.jwtToken.expired() +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/federation_client_test.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/federation_client_test.go new file mode 100644 index 0000000000..f358fd1949 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/federation_client_test.go @@ -0,0 +1,535 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package auth + +import ( + "bytes" + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "net/http" + "net/http/httptest" + "strings" + "testing" +) + +func TestX509FederationClient_VeryFirstSecurityToken(t *testing.T) { + authServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Verify request + expectedKeyID := fmt.Sprintf("%s/fed-x509/%s", tenancyID, leafCertFingerprint) + assert.True(t, strings.HasPrefix(r.Header.Get("Authorization"), fmt.Sprintf(`Signature version="1",headers="date (request-target) content-length content-type x-content-sha256",keyId="%s",algorithm="rsa-sha256",signature=`, expectedKeyID))) + expectedBody := fmt.Sprintf(`{"certificate":"%s","intermediateCertificates":["%s"],"publicKey":"%s"}`, + leafCertBodyNoNewLine, intermediateCertBodyNoNewLine, sessionPublicKeyBodyNoNewLine) + + var buf bytes.Buffer + buf.ReadFrom(r.Body) + assert.Equal(t, expectedBody, buf.String()) + + // Return response + fmt.Fprintf(w, "\n{\n \"token\" : \"%s\"\n}\n", expectedSecurityToken) + })) + defer authServer.Close() + + mockSessionKeySupplier := new(mockSessionKeySupplier) + mockSessionKeySupplier.On("Refresh").Return(nil).Once() + mockSessionKeySupplier.On("PublicKeyPemRaw").Return([]byte(sessionPublicKeyPem)) + + mockLeafCertificateRetriever := new(mockCertificateRetriever) + mockLeafCertificateRetriever.On("Refresh").Return(nil).Once() + mockLeafCertificateRetriever.On("CertificatePemRaw").Return([]byte(leafCertPem)) + mockLeafCertificateRetriever.On("Certificate").Return(parseCertificate(leafCertPem)) + mockLeafCertificateRetriever.On("PrivateKey").Return(parsePrivateKey(leafCertPrivateKeyPem)) + + mockIntermediateCertificateRetriever := new(mockCertificateRetriever) + mockIntermediateCertificateRetriever.On("Refresh").Return(nil).Once() + mockIntermediateCertificateRetriever.On("CertificatePemRaw").Return([]byte(intermediateCertPem)) + + federationClient := &x509FederationClient{ + tenancyID: tenancyID, + sessionKeySupplier: mockSessionKeySupplier, + leafCertificateRetriever: mockLeafCertificateRetriever, + intermediateCertificateRetrievers: []x509CertificateRetriever{mockIntermediateCertificateRetriever}, + } + federationClient.authClient = newAuthClient(whateverRegion, federationClient) + // Overwrite with the authServer's URL + federationClient.authClient.Host = authServer.URL + federationClient.authClient.BasePath = "" + + actualSecurityToken, err := federationClient.SecurityToken() + + assert.NoError(t, err) + assert.Equal(t, expectedSecurityToken, actualSecurityToken) + mockSessionKeySupplier.AssertExpectations(t) + mockLeafCertificateRetriever.AssertExpectations(t) + mockIntermediateCertificateRetriever.AssertExpectations(t) +} + +func TestX509FederationClient_RenewSecurityToken(t *testing.T) { + authServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Verify request + expectedKeyID := fmt.Sprintf("%s/fed-x509/%s", tenancyID, leafCertFingerprint) + assert.True(t, strings.HasPrefix(r.Header.Get("Authorization"), fmt.Sprintf(`Signature version="1",headers="date (request-target) content-length content-type x-content-sha256",keyId="%s",algorithm="rsa-sha256",signature=`, expectedKeyID))) + + expectedBody := fmt.Sprintf(`{"certificate":"%s","intermediateCertificates":["%s"],"publicKey":"%s"}`, + leafCertBodyNoNewLine, intermediateCertBodyNoNewLine, sessionPublicKeyBodyNoNewLine) + var buf bytes.Buffer + buf.ReadFrom(r.Body) + assert.Equal(t, expectedBody, buf.String()) + + // Return response + fmt.Fprintf(w, "\n{\n \"token\" : \"%s\"\n}\n", expectedSecurityToken) + })) + defer authServer.Close() + + mockSessionKeySupplier := new(mockSessionKeySupplier) + mockSessionKeySupplier.On("Refresh").Return(nil).Once() + mockSessionKeySupplier.On("PublicKeyPemRaw").Return([]byte(sessionPublicKeyPem)) + + mockLeafCertificateRetriever := new(mockCertificateRetriever) + mockLeafCertificateRetriever.On("Refresh").Return(nil).Once() + mockLeafCertificateRetriever.On("CertificatePemRaw").Return([]byte(leafCertPem)) + mockLeafCertificateRetriever.On("Certificate").Return(parseCertificate(leafCertPem)) + mockLeafCertificateRetriever.On("PrivateKey").Return(parsePrivateKey(leafCertPrivateKeyPem)) + + mockIntermediateCertificateRetriever := new(mockCertificateRetriever) + mockIntermediateCertificateRetriever.On("Refresh").Return(nil).Once() + mockIntermediateCertificateRetriever.On("CertificatePemRaw").Return([]byte(intermediateCertPem)) + + mockSecurityToken := new(mockSecurityToken) + mockSecurityToken.On("Valid").Return(false) + + federationClient := &x509FederationClient{ + tenancyID: tenancyID, + sessionKeySupplier: mockSessionKeySupplier, + leafCertificateRetriever: mockLeafCertificateRetriever, + intermediateCertificateRetrievers: []x509CertificateRetriever{mockIntermediateCertificateRetriever}, + } + federationClient.authClient = newAuthClient(whateverRegion, federationClient) + // Overwrite with the authServer's URL + federationClient.authClient.Host = authServer.URL + federationClient.authClient.BasePath = "" + federationClient.securityToken = mockSecurityToken + + actualSecurityToken, err := federationClient.SecurityToken() + + assert.NoError(t, err) + assert.Equal(t, expectedSecurityToken, actualSecurityToken) + mockSessionKeySupplier.AssertExpectations(t) + mockLeafCertificateRetriever.AssertExpectations(t) + mockIntermediateCertificateRetriever.AssertExpectations(t) +} + +func TestX509FederationClient_GetCachedSecurityToken(t *testing.T) { + mockSessionKeySupplier := new(mockSessionKeySupplier) + mockLeafCertificateRetriever := new(mockCertificateRetriever) + mockIntermediateCertificateRetriever := new(mockCertificateRetriever) + + mockSecurityToken := new(mockSecurityToken) + mockSecurityToken.On("Valid").Return(true) + mockSecurityToken.On("String").Return(expectedSecurityToken) + + federationClient := &x509FederationClient{ + tenancyID: tenancyID, + sessionKeySupplier: mockSessionKeySupplier, + leafCertificateRetriever: mockLeafCertificateRetriever, + intermediateCertificateRetrievers: []x509CertificateRetriever{mockIntermediateCertificateRetriever}, + } + federationClient.authClient = newAuthClient(whateverRegion, federationClient) + federationClient.securityToken = mockSecurityToken + + actualSecurityToken, err := federationClient.SecurityToken() + + assert.NoError(t, err) + assert.Equal(t, expectedSecurityToken, actualSecurityToken) + + mockSessionKeySupplier.AssertNotCalled(t, "Refresh") + mockSessionKeySupplier.AssertNotCalled(t, "PublicKeyPemRaw") + mockLeafCertificateRetriever.AssertNotCalled(t, "Refresh") + mockLeafCertificateRetriever.AssertNotCalled(t, "CertificatePemRaw") + mockLeafCertificateRetriever.AssertNotCalled(t, "Certificate") + mockLeafCertificateRetriever.AssertNotCalled(t, "PrivateKey") + mockIntermediateCertificateRetriever.AssertNotCalled(t, "Refresh") + mockIntermediateCertificateRetriever.AssertNotCalled(t, "CertificatePemRaw") +} + +func TestX509FederationClient_RenewSecurityTokenSessionKeySupplierError(t *testing.T) { + mockSessionKeySupplier := new(mockSessionKeySupplier) + expectedErrorMessage := "TestSessionKeySupplierRefreshError" + mockSessionKeySupplier.On("Refresh").Return(fmt.Errorf(expectedErrorMessage)).Once() + + mockLeafCertificateRetriever := new(mockCertificateRetriever) + mockIntermediateCertificateRetriever := new(mockCertificateRetriever) + + mockSecurityToken := new(mockSecurityToken) + mockSecurityToken.On("Valid").Return(false) + + federationClient := &x509FederationClient{ + tenancyID: tenancyID, + sessionKeySupplier: mockSessionKeySupplier, + leafCertificateRetriever: mockLeafCertificateRetriever, + intermediateCertificateRetrievers: []x509CertificateRetriever{mockIntermediateCertificateRetriever}, + } + federationClient.authClient = newAuthClient(whateverRegion, federationClient) + federationClient.securityToken = mockSecurityToken + + actualSecurityToken, actualError := federationClient.SecurityToken() + + assert.Empty(t, actualSecurityToken) + assert.EqualError(t, actualError, fmt.Sprintf("failed to renew security token: failed to refresh session key: %s", expectedErrorMessage)) +} + +func TestX509FederationClient_RenewSecurityTokenLeafCertificateRetrieverError(t *testing.T) { + mockSessionKeySupplier := new(mockSessionKeySupplier) + mockSessionKeySupplier.On("Refresh").Return(nil).Once() + + mockLeafCertificateRetriever := new(mockCertificateRetriever) + expectedErrorMessage := "TestLeafCertificateRetrieverError" + mockLeafCertificateRetriever.On("Refresh").Return(fmt.Errorf(expectedErrorMessage)).Once() + + mockIntermediateCertificateRetriever := new(mockCertificateRetriever) + + mockSecurityToken := new(mockSecurityToken) + mockSecurityToken.On("Valid").Return(false) + + federationClient := &x509FederationClient{ + tenancyID: tenancyID, + sessionKeySupplier: mockSessionKeySupplier, + leafCertificateRetriever: mockLeafCertificateRetriever, + intermediateCertificateRetrievers: []x509CertificateRetriever{mockIntermediateCertificateRetriever}, + } + federationClient.authClient = newAuthClient(whateverRegion, federationClient) + federationClient.securityToken = mockSecurityToken + + actualSecurityToken, actualError := federationClient.SecurityToken() + + assert.Empty(t, actualSecurityToken) + assert.EqualError(t, actualError, fmt.Sprintf("failed to renew security token: failed to refresh leaf certificate: %s", expectedErrorMessage)) +} + +func TestX509FederationClient_RenewSecurityTokenIntermediateCertificateRetrieverError(t *testing.T) { + mockSessionKeySupplier := new(mockSessionKeySupplier) + mockSessionKeySupplier.On("Refresh").Return(nil).Once() + + mockLeafCertificateRetriever := new(mockCertificateRetriever) + mockLeafCertificateRetriever.On("Refresh").Return(nil).Once() + mockLeafCertificateRetriever.On("Certificate").Return(parseCertificate(leafCertPem)) + + mockIntermediateCertificateRetriever := new(mockCertificateRetriever) + expectedErrorMessage := "TestLeafCertificateRetrieverError" + mockIntermediateCertificateRetriever.On("Refresh").Return(fmt.Errorf(expectedErrorMessage)).Once() + + mockSecurityToken := new(mockSecurityToken) + mockSecurityToken.On("Valid").Return(false) + + federationClient := &x509FederationClient{ + tenancyID: tenancyID, + sessionKeySupplier: mockSessionKeySupplier, + leafCertificateRetriever: mockLeafCertificateRetriever, + intermediateCertificateRetrievers: []x509CertificateRetriever{mockIntermediateCertificateRetriever}, + } + federationClient.authClient = newAuthClient(whateverRegion, federationClient) + federationClient.securityToken = mockSecurityToken + + actualSecurityToken, actualError := federationClient.SecurityToken() + + assert.Empty(t, actualSecurityToken) + assert.EqualError(t, actualError, fmt.Sprintf("failed to renew security token: failed to refresh intermediate certificate: %s", expectedErrorMessage)) +} + +func TestX509FederationClient_RenewSecurityTokenUnexpectedTenancyIdUpdateError(t *testing.T) { + mockSessionKeySupplier := new(mockSessionKeySupplier) + mockSessionKeySupplier.On("Refresh").Return(nil).Once() + + mockLeafCertificateRetriever := new(mockCertificateRetriever) + mockLeafCertificateRetriever.On("Refresh").Return(nil).Once() + mockLeafCertificateRetriever.On("Certificate").Return(parseCertificate(leafCertPem)) + + mockIntermediateCertificateRetriever := new(mockCertificateRetriever) + + mockSecurityToken := new(mockSecurityToken) + mockSecurityToken.On("Valid").Return(false) + + previousTenancyID := "ocidv1:tenancy:oc1:phx:1234567890:foobarfoobar" + + federationClient := &x509FederationClient{ + tenancyID: previousTenancyID, + sessionKeySupplier: mockSessionKeySupplier, + leafCertificateRetriever: mockLeafCertificateRetriever, + intermediateCertificateRetrievers: []x509CertificateRetriever{mockIntermediateCertificateRetriever}, + } + federationClient.authClient = newAuthClient(whateverRegion, federationClient) + federationClient.securityToken = mockSecurityToken + + actualSecurityToken, actualError := federationClient.SecurityToken() + + assert.Empty(t, actualSecurityToken) + assert.EqualError(t, actualError, fmt.Sprintf("failed to renew security token: unexpected update of tenancy OCID in the leaf certificate. Previous tenancy: %s, Updated: %s", previousTenancyID, tenancyID)) +} + +func TestX509FederationClient_AuthServerInternalError(t *testing.T) { + authServer := httptest.NewServer(http.HandlerFunc(internalServerError)) + defer authServer.Close() + + mockSessionKeySupplier := new(mockSessionKeySupplier) + mockSessionKeySupplier.On("Refresh").Return(nil).Once() + mockSessionKeySupplier.On("PublicKeyPemRaw").Return([]byte(sessionPublicKeyPem)) + + mockLeafCertificateRetriever := new(mockCertificateRetriever) + mockLeafCertificateRetriever.On("Refresh").Return(nil).Once() + mockLeafCertificateRetriever.On("CertificatePemRaw").Return([]byte(leafCertPem)) + mockLeafCertificateRetriever.On("Certificate").Return(parseCertificate(leafCertPem)) + mockLeafCertificateRetriever.On("PrivateKey").Return(parsePrivateKey(leafCertPrivateKeyPem)) + + mockIntermediateCertificateRetriever := new(mockCertificateRetriever) + mockIntermediateCertificateRetriever.On("Refresh").Return(nil).Once() + mockIntermediateCertificateRetriever.On("CertificatePemRaw").Return([]byte(intermediateCertPem)) + + federationClient := &x509FederationClient{ + tenancyID: tenancyID, + sessionKeySupplier: mockSessionKeySupplier, + leafCertificateRetriever: mockLeafCertificateRetriever, + intermediateCertificateRetrievers: []x509CertificateRetriever{mockIntermediateCertificateRetriever}, + } + federationClient.authClient = newAuthClient(whateverRegion, federationClient) + // Overwrite with the authServer's URL + federationClient.authClient.Host = authServer.URL + federationClient.authClient.BasePath = "" + + _, err := federationClient.SecurityToken() + + assert.Error(t, err) +} + +func parseCertificate(certPem string) *x509.Certificate { + var block *pem.Block + block, _ = pem.Decode([]byte(certPem)) + cert, _ := x509.ParseCertificate(block.Bytes) + return cert +} + +func parsePrivateKey(privateKeyPem string) *rsa.PrivateKey { + block, _ := pem.Decode([]byte(privateKeyPem)) + key, _ := x509.ParsePKCS1PrivateKey(block.Bytes) + return key +} + +const ( + leafCertBody = `MIIEfzCCA2egAwIBAgIRAJNzEqD3n5To66H1rEDhKyMwDQYJKoZIhvcNAQELBQAw +gfgxgccwHAYDVQQLExVvcGMtY2VydHR5cGU6aW5zdGFuY2UwKgYDVQQLEyNvcGMt +aW5zdGFuY2Uub2NpZDEucGh4LmJsdWhibHVoYmx1aDA5BgNVBAsTMm9wYy1jb21w +YXJ0bWVudDpvY2lkMS5jb21wYXJ0bWVudC5vYzEuYmx1aGJsdWhibHVoMEAGA1UE +CxM5b3BjLXRlbmFudDpvY2lkdjE6dGVuYW5jeTpvYzE6cGh4OjEyMzQ1Njc4OTA6 +Ymx1aGJsdWhibHVoMSwwKgYDVQQDEyNvY2lkMS5pbnN0YW5jZS5vYzEucGh4LmJs +dWhibHVoYmx1aDAeFw0xNzExMzAwMDA4MzRaFw0xODExMzAwMDA4MzRaMIH4MYHH +MBwGA1UECxMVb3BjLWNlcnR0eXBlOmluc3RhbmNlMCoGA1UECxMjb3BjLWluc3Rh +bmNlLm9jaWQxLnBoeC5ibHVoYmx1aGJsdWgwOQYDVQQLEzJvcGMtY29tcGFydG1l +bnQ6b2NpZDEuY29tcGFydG1lbnQub2MxLmJsdWhibHVoYmx1aDBABgNVBAsTOW9w +Yy10ZW5hbnQ6b2NpZHYxOnRlbmFuY3k6b2MxOnBoeDoxMjM0NTY3ODkwOmJsdWhi +bHVoYmx1aDEsMCoGA1UEAxMjb2NpZDEuaW5zdGFuY2Uub2MxLnBoeC5ibHVoYmx1 +aGJsdWgwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDOEGPhWFLIU/1w +gncMPddP01Mo80GEZ1h2A+QGC/1ha0gxp/yVNIi2rNwwjLiqtAGaMbGnVicaPpOm +uNiHWf92E2jwEcy2Q0kA+FwHINDjmzrjMgQFTI4MDIA0bLdZY9KX5CFqw3pwqkyC +KfsZRjUiOmlELbnCb7NQIyd5t3zZfgFv6EOFW4qPdTHrr5Gql1knpUNjUeYR4ZxI +BB6NIxBV3Dm3PRDClP/2/Q5zwsZepRYmWyBe6WsfIvB86x5xH19CGe4HGYrNr1YF ++q9+iDb8PuLfr+gxW7PJPo/TxBgdko0h981nPYzbju9eVa2KKjK6fmzjSvNkgJWn +11ngT5mBAgMBAAGjAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQANjXNFgZ+q/OGZ4bBY +uyFUU/yWz+BtkTzukZa7HT78w4qVE+Gjunc9ad5D2Afr+qTl4sazTTVWTI+KyRJW +5aHWwTUSXSwYrUOQbV0rktLbS4vJggVnU50Y8pdaXq1q+3B4t1DIJwrN2sWu3krA +bQKgOQzEUwm2OZJf0lPA9bp+HVv0iA17wUazgvHVPt/93Yr8e1VQT43ygG990KIT +gipcAk/44ONyBS8W8QRhzpuErEHCcSR+3+KBtwVZgzaVR6+mb5KFYFpXBrgs8YOe +P2X4jUFjRbpUMbNi9Q6V8mAzejPc8Hqk3116Fpl62PGiW802n4CMtDXYxawJSRxV +WO1p` + leafCertPrivateKeyBody = `MIIEowIBAAKCAQEAzhBj4VhSyFP9cIJ3DD3XT9NTKPNBhGdYdgPkBgv9YWtIMaf8 +lTSItqzcMIy4qrQBmjGxp1YnGj6TprjYh1n/dhNo8BHMtkNJAPhcByDQ45s64zIE +BUyODAyANGy3WWPSl+QhasN6cKpMgin7GUY1IjppRC25wm+zUCMnebd82X4Bb+hD +hVuKj3Ux66+RqpdZJ6VDY1HmEeGcSAQejSMQVdw5tz0QwpT/9v0Oc8LGXqUWJlsg +XulrHyLwfOsecR9fQhnuBxmKza9WBfqvfog2/D7i36/oMVuzyT6P08QYHZKNIffN +Zz2M247vXlWtiioyun5s40rzZICVp9dZ4E+ZgQIDAQABAoIBAQCdvLAoVIrx7FEp +6cSla0VBRrv2sdbqOo3dsPbApjbsdsoJsNTJhjBM3Z+jzmShzy8W0Il0VZ+TGGnA +Cuk9GuhRg2QluQpiTrk4c+VGU5lzUWVPev7W65YkpQESoFHtrFsNiEUIS+CTE9mD +Hg2neDW+IMZpuTLkIss5Qd+67Xk1pj19CtHfWVbeqc7B9DPAZa4CBCVsWFPhaiyv +tsz/PJKFDDXllgrQaAyCK1gyrKR4q4noARKhOcfMUPFFTK+1lPqLxLlkQbfr/T5n +izhXHsf1e8cK0gFIa5iE3acaxwbsuFcIDlYEqWiTGxIYk2mXNz7uXlY8QpkbDHQR +z1RFTjABAoGBAPa1g/mFvhYzCZnKOskDyAyZikZqZgTlLtXMoxKhGBsZU072xUQl +Z6USrRy+00rbn8ankkjZRqOnVc6jAi0mvfyVLYMG96q8jN24RwUD52IPKWpHS/BK +LUbQlkg9ajASQm5qt83AU6czdW5X/8nxsV4uOpEML5bsI4s/SfKFLtxBAoGBANXT +BaukiAQSCUDHjXFaLnt/rbdhfhFjflzCbNDCF/Ym3nqCHDL8uHOtAIkCY5LwGKxd +xL2wd81M10Dld+WOtzdt4VVibhT3NfYScr3aa5o3GoUznfkgJsBKP2TE1/NyC1lF +LTgpgu2uU7j8TjvXyQMjzmK38vbfQv6b6V0bIm1BAoGAaQnpcdCGmS8LtGXM1477 +mpm4rLhaTVVCtpaVC7Z46/jBZopcfOIsGbU07Vs13NZbVZo9BzUzBTSWrQ7sO0sW +crcVFIdf5Vq34yK1YiZCWpa3/F70rw717gObKJC1aFgt3pMjRL/RHgwjwGJJLrLv +4HhwSRdWH7zUeVHt6wrXY8ECgYBmfwQN1g2ZHegvlDh56Ie1jWuBJwueXDn7TvuI +SjHgPZuR0AKickAcuwYxpuKCUfMR1NT1NL0IvVfFdPm3IWUz/cjw/ADWrfXA4fD8 +jtHbl6Rvy2FjRQUuUaj3rd/yg21rOlzFuihXtKPPXapGx1ZE2goZiiG+MyFTGPuR +NOuYwQKBgDH+p2Ec/CZ5lFJYqqGBVR7fESBBeqpxr6UgfO8NBIXGuL5CCi5iCK07 +hKG53Vba9OYmWWmVVYdTTjUBoG6ObqLbgzfNbkF1E70ShPoWO+6WZYpaMuO/2DjA +ysvMnQwaC0432ceRJ3r6vPAI2EPRd9KOE7Va1IFNJNmOuIkmRx8t` + // The code to generate the PEM encoded bytes for "leafCertBody" and "leafCertPrivateKeyBody" above: + // + //func generateLeafCertificate() (privateKeyPem, certPem []byte) { + // serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) + // serialNumber, _ := rand.Int(rand.Reader, serialNumberLimit) + // notBefore := time.now() + // notAfter := notBefore.Add(365 * 24 * time.Hour) + // + // template := x509.Certificate{ + // SerialNumber: serialNumber, + // Issuer: pkix.Name{ + // CommonName: "PKISVC Identity Intermediate r2", + // }, + // Subject: pkix.Name{ + // CommonName: "ocid1.instance.oc1.phx.bluhbluhbluh", + // OrganizationalUnit: []string{ + // "opc-certtype:instance", + // "opc-instance.ocid1.phx.bluhbluhbluh", + // "opc-compartment:ocid1.compartment.oc1.bluhbluhbluh", + // fmt.Sprintf("opc-tenant:%s", tenancyID), + // }, + // }, + // NotBefore: notBefore, + // NotAfter: notAfter, + // PublicKeyAlgorithm: x509.RSA, + // SignatureAlgorithm: x509.SHA256WithRSA, + // } + // + // privateKey, _ := rsa.GenerateKey(rand.Reader, 2048) + // newCertBytes, _ := x509.CreateCertificate(rand.Reader, &template, &template, privateKey.Public(), privateKey) + // + // privateKeyPem = pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(privateKey)}) + // certPem = pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: newCertBytes}) + // return + //} + leafCertFingerprint = `52:3c:9d:93:8b:b8:07:21:ce:36:30:98:ba:fc:e2:4a:bc:3a:2e:0b` + intermediateCertBody = `MIIC4TCCAcmgAwIBAgIRAK7jQKVEO6ssUBICuPw4OwQwDQYJKoZIhvcNAQELBQAw +KjEoMCYGA1UEAxMfUEtJU1ZDIElkZW50aXR5IEludGVybWVkaWF0ZSByMjAeFw0x +NzExMzAwMDE0MDhaFw0xODExMzAwMDE0MDhaMCoxKDAmBgNVBAMTH1BLSVNWQyBJ +ZGVudGl0eSBJbnRlcm1lZGlhdGUgcjIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQCj06NzfxfPYK6BLDKiD3tb6YLCi/XsksdBFpBsfp77eE0Wc8d6Te9M +fVaAswknpmxl4idHar7vIvJDtXq8U7UwyM75di3eMp46QR1UtmhzvCRRCQrj7uKX +ax1tAg73CJ/364YKIZpXc5p4ngOLb6bsyvd81oNDvnRXBFo3nIOpL451DiuIQGrt +6xa1wDGczvlbmTkecWH/ncIyy8JveaTsTbWfLTOgneeZEOj0OJm4eg6fudXQwqQX +TrQJTq7Nnsr1zV4eA0FVy+qVqIlGiloZHKSWkzO6ubIVmLBkKg4BXwV+zC3Lm+pW +w9U+pBoRnt5FjVHLK9U2NgfT2vTOO6G5AgMBAAGjAjAAMA0GCSqGSIb3DQEBCwUA +A4IBAQAwYegxBGNQUKTQT1OYPO6bBogzonzknPRyRcHoPdcisTUnq1EFwxz6PVrv +2cU+MrljCYblhFgnsUiwVTwBM8Eqb88HU/+8wbOyNtIc8EO4CjD7r1IU9hTv8CET +DB2LhVHN0ADwbvHGpUjC6uyyMG+5ZT+fTssx9ukCMO8hJNi2P8tBU0KGJAc0HoWV +4fEVcp0GPcXZ5IAnQfsfF4cV6DKSXGmeRZozDDlIPnWtD0f9rc3sqRtERIYS8ReS +NwVA90jrn5mKp+9B8L+o6e8qHNGoFOCY9MlM8UCqeH+wI7xUliNS9RkkYjKFg9ao +gAv8TMjAPcdnYRUXgs3UAxJQSgtB` + // The code to generate the PEM encoded bytes for "intermediateCertBody" above: + // + //func generateIntermediateCertificate() (privateKeyPem, certPem []byte) { + // serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) + // serialNumber, _ := rand.Int(rand.Reader, serialNumberLimit) + // notBefore := time.now() + // notAfter := notBefore.Add(365 * 24 * time.Hour) + // + // template := x509.Certificate{ + // SerialNumber: serialNumber, + // Issuer: pkix.Name{ + // CommonName: "Oracle BMCS Instance Identity Root - r2", + // }, + // Subject: pkix.Name{ + // CommonName: "PKISVC Identity Intermediate r2", + // }, + // NotBefore: notBefore, + // NotAfter: notAfter, + // PublicKeyAlgorithm: x509.RSA, + // SignatureAlgorithm: x509.SHA256WithRSA, + // } + // + // privateKey, _ := rsa.GenerateKey(rand.Reader, 2048) + // newCertBytes, _ := x509.CreateCertificate(rand.Reader, &template, &template, privateKey.Public(), privateKey) + // + // privateKeyPem = pem.EncodeToMemory(&pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(privateKey)}) + // certPem = pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: newCertBytes}) + // return + //} + sessionPublicKeyBody = `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyQn1VgH+aBOfN8PfN6WU +ZOyiGWbozd1WaxDyP/rYCPJJIinKupp1ZcissN+A2dgcknQqJteX9XWYz31WzeAk +NEVAi9R4ZnrP0u/4921ZWmiCKIqBVxSWGE+PJcHUWJRSFNS1mQcX//UjwEYNPDKV +tPcwQqt7CYTxL77YFy0Z+s9WUmZaOJakgrCLSokeQBWdi0JibYp1mZPZv6pqsIm9 +X86ef1hXyNjvEQRxuf1Bx96Y32m7FjsD251XeOEzzdESCa90Z+bHN6k7wsTRrU79 +dYZF0puZUEmHID4xIF5AprOHVarrhawiddwayMQWH7GZuVzhJ2Z/Q4CK2DneR8Lr +fwIDAQAB` + tenancyID = `ocidv1:tenancy:oc1:phx:1234567890:bluhbluhbluh` + expectedSecurityToken = `eyJhbGciOiJSUzI1NiIsImtpZCI6ImFzdyIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJvcGMub3JhY2xlLmNvbSIsImV4cCI6MTUxMTgzODc5MywiaWF0IjoxNTExODE3MTkzLCJpc3MiOiJhdXRoU2VydmljZS5vcmFjbGUuY29tIiwib3BjLWNlcnR0eXBlIjoiaW5zdGFuY2UiLCJvcGMtY29tcGFydG1lbnQiOiJvY2lkMS5jb21wYXJ0bWVudC5vYzEuLmJsdWhibHVoYmx1aCIsIm9wYy1pbnN0YW5jZSI6Im9jaWQxLmluc3RhbmNlLm9jMS5waHguYmx1aGJsdWhibHVoIiwib3BjLXRlbmFudCI6Im9jaWR2MTp0ZW5hbmN5Om9jMTpwaHg6MTIzNDU2Nzg5MDpibHVoYmx1aGJsdWgiLCJwdHlwZSI6Imluc3RhbmNlIiwic3ViIjoib2NpZDEuaW5zdGFuY2Uub2MxLnBoeC5ibHVoYmx1aGJsdWgiLCJ0ZW5hbnQiOiJvY2lkdjE6dGVuYW5jeTpvYzE6cGh4OjEyMzQ1Njc4OTA6Ymx1aGJsdWhibHVoIiwidHR5cGUiOiJ4NTA5In0.zen7q2yJSpMjzH4ym_H7VEwZA0-vTT4Wcild-HRfLxX6A1ej4tlpACa7A24j5JoZYI4mHooZVJ8e7ZezFenK0zZx5j8RbIjsqJKwroYXExOiBXLCUwMWOLXIndEsUzzGLqnPfKHXd80vrhMLmtkVTCJqBMzvPUSYkH_ciWgmjP9m0YETdQ9ifghkADhZGt9IlnOswg0s3Bx9ASwxFZEtom0BmU9GwEuITTTZfKvndk785BlNeZMOjhovaD97-LYpv5B_PiWEz8zialK5zxjijLCw06zyA8CQRQqmVCagNUPilfz_BcPyImzvFDuzQcPyDkTcsB7weX35tafHmA_Ulg` +) + +var ( + leafCertPem = fmt.Sprintf("-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----\n", leafCertBody) + leafCertBodyNoNewLine = strings.Replace(leafCertBody, "\n", "", -1) + leafCertPrivateKeyPem = fmt.Sprintf("-----BEGIN RSA PRIVATE KEY-----\n%s\n-----END RSA PRIVATE KEY-----\n", leafCertPrivateKeyBody) + intermediateCertPem = fmt.Sprintf("-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----\n", intermediateCertBody) + intermediateCertBodyNoNewLine = strings.Replace(intermediateCertBody, "\n", "", -1) + sessionPublicKeyPem = fmt.Sprintf("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----\n", sessionPublicKeyBody) + sessionPublicKeyBodyNoNewLine = strings.Replace(sessionPublicKeyBody, "\n", "", -1) +) + +const whateverRegion = common.RegionPHX + +type mockSessionKeySupplier struct { + mock.Mock +} + +func (m *mockSessionKeySupplier) Refresh() error { + args := m.Called() + return args.Error(0) +} + +func (m *mockSessionKeySupplier) PrivateKey() *rsa.PrivateKey { + args := m.Called() + return args.Get(0).(*rsa.PrivateKey) +} + +func (m *mockSessionKeySupplier) PublicKeyPemRaw() []byte { + args := m.Called() + return args.Get(0).([]byte) +} + +type mockCertificateRetriever struct { + mock.Mock +} + +func (m *mockCertificateRetriever) Refresh() error { + args := m.Called() + return args.Error(0) +} + +func (m *mockCertificateRetriever) CertificatePemRaw() []byte { + args := m.Called() + return args.Get(0).([]byte) +} + +func (m *mockCertificateRetriever) Certificate() *x509.Certificate { + args := m.Called() + return args.Get(0).(*x509.Certificate) +} + +func (m *mockCertificateRetriever) PrivateKeyPemRaw() []byte { + args := m.Called() + return args.Get(0).([]byte) +} + +func (m *mockCertificateRetriever) PrivateKey() *rsa.PrivateKey { + args := m.Called() + return args.Get(0).(*rsa.PrivateKey) +} + +type mockSecurityToken struct { + mock.Mock +} + +func (m *mockSecurityToken) String() string { + args := m.Called() + return args.String(0) +} + +func (m *mockSecurityToken) Valid() bool { + args := m.Called() + return args.Bool(0) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/instance_principal_key_provider.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/instance_principal_key_provider.go new file mode 100644 index 0000000000..ecf14b072b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/instance_principal_key_provider.go @@ -0,0 +1,95 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package auth + +import ( + "bytes" + "crypto/rsa" + "fmt" + "github.com/oracle/oci-go-sdk/common" +) + +const ( + regionURL = `http://169.254.169.254/opc/v1/instance/region` + leafCertificateURL = `http://169.254.169.254/opc/v1/identity/cert.pem` + leafCertificateKeyURL = `http://169.254.169.254/opc/v1/identity/key.pem` + leafCertificateKeyPassphrase = `` // No passphrase for the private key for Compute instances + intermediateCertificateURL = `http://169.254.169.254/opc/v1/identity/intermediate.pem` + intermediateCertificateKeyURL = `` + intermediateCertificateKeyPassphrase = `` // No passphrase for the private key for Compute instances +) + +// instancePrincipalKeyProvider implements KeyProvider to provide a key ID and its corresponding private key +// for an instance principal by getting a security token via x509FederationClient. +// +// The region name of the endpoint for x509FederationClient is obtained from the metadata service on the compute +// instance. +type instancePrincipalKeyProvider struct { + regionForFederationClient common.Region + federationClient federationClient +} + +// newInstancePrincipalKeyProvider creates and returns an instancePrincipalKeyProvider instance based on +// x509FederationClient. +// +// NOTE: There is a race condition between PrivateRSAKey() and KeyID(). These two pieces are tightly coupled; KeyID +// includes a security token obtained from Auth service by giving a public key which is paired with PrivateRSAKey. +// The x509FederationClient caches the security token in memory until it is expired. Thus, even if a client obtains a +// KeyID that is not expired at the moment, the PrivateRSAKey that the client acquires at a next moment could be +// invalid because the KeyID could be already expired. +func newInstancePrincipalKeyProvider() (provider *instancePrincipalKeyProvider, err error) { + var region common.Region + if region, err = getRegionForFederationClient(regionURL); err != nil { + err = fmt.Errorf("failed to get the region name from %s: %s", regionURL, err.Error()) + common.Logln(err) + return nil, err + } + + leafCertificateRetriever := newURLBasedX509CertificateRetriever( + leafCertificateURL, leafCertificateKeyURL, leafCertificateKeyPassphrase) + intermediateCertificateRetrievers := []x509CertificateRetriever{ + newURLBasedX509CertificateRetriever( + intermediateCertificateURL, intermediateCertificateKeyURL, intermediateCertificateKeyPassphrase), + } + + if err = leafCertificateRetriever.Refresh(); err != nil { + err = fmt.Errorf("failed to refresh the leaf certificate: %s", err.Error()) + return nil, err + } + tenancyID := extractTenancyIDFromCertificate(leafCertificateRetriever.Certificate()) + + federationClient := newX509FederationClient( + region, tenancyID, leafCertificateRetriever, intermediateCertificateRetrievers) + + provider = &instancePrincipalKeyProvider{regionForFederationClient: region, federationClient: federationClient} + return +} + +func getRegionForFederationClient(url string) (r common.Region, err error) { + var body bytes.Buffer + if body, err = httpGet(url); err != nil { + return + } + return common.StringToRegion(body.String()), nil +} + +func (p *instancePrincipalKeyProvider) RegionForFederationClient() common.Region { + return p.regionForFederationClient +} + +func (p *instancePrincipalKeyProvider) PrivateRSAKey() (privateKey *rsa.PrivateKey, err error) { + if privateKey, err = p.federationClient.PrivateKey(); err != nil { + err = fmt.Errorf("failed to get private key: %s", err.Error()) + return nil, err + } + return privateKey, nil +} + +func (p *instancePrincipalKeyProvider) KeyID() (string, error) { + var securityToken string + var err error + if securityToken, err = p.federationClient.SecurityToken(); err != nil { + return "", fmt.Errorf("failed to get security token: %s", err.Error()) + } + return fmt.Sprintf("ST$%s", securityToken), nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/instance_principal_key_provider_test.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/instance_principal_key_provider_test.go new file mode 100644 index 0000000000..273450bd44 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/instance_principal_key_provider_test.go @@ -0,0 +1,113 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package auth + +import ( + "crypto/rsa" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "net/http" + "net/http/httptest" + "testing" +) + +func TestInstancePrincipalKeyProvider_getRegionForFederationClient(t *testing.T) { + regionServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, "phx") + })) + defer regionServer.Close() + + actualRegion, err := getRegionForFederationClient(regionServer.URL) + + assert.NoError(t, err) + assert.Equal(t, common.RegionPHX, actualRegion) +} + +func TestInstancePrincipalKeyProvider_getRegionForFederationClientNotFound(t *testing.T) { + regionServer := httptest.NewServer(http.NotFoundHandler()) + defer regionServer.Close() + + _, err := getRegionForFederationClient(regionServer.URL) + + assert.Error(t, err) +} + +func TestInstancePrincipalKeyProvider_getRegionForFederationClientInternalServerError(t *testing.T) { + regionServer := httptest.NewServer(http.HandlerFunc(internalServerError)) + defer regionServer.Close() + + _, err := getRegionForFederationClient(regionServer.URL) + + assert.Error(t, err) +} + +func TestInstancePrincipalKeyProvider_PrivateRSAKey(t *testing.T) { + mockFederationClient := new(mockFederationClient) + expectedPrivateKey := new(rsa.PrivateKey) + mockFederationClient.On("PrivateKey").Return(expectedPrivateKey, nil).Once() + + keyProvider := &instancePrincipalKeyProvider{federationClient: mockFederationClient} + + actualPrivateKey, err := keyProvider.PrivateRSAKey() + + assert.NoError(t, err) + assert.Equal(t, expectedPrivateKey, actualPrivateKey) + mockFederationClient.AssertExpectations(t) +} + +func TestInstancePrincipalKeyProvider_PrivateRSAKeyError(t *testing.T) { + mockFederationClient := new(mockFederationClient) + var nilPtr *rsa.PrivateKey + expectedErrorMessage := "TestPrivateRSAKeyError" + mockFederationClient.On("PrivateKey").Return(nilPtr, fmt.Errorf(expectedErrorMessage)).Once() + + keyProvider := &instancePrincipalKeyProvider{federationClient: mockFederationClient} + + actualPrivateKey, actualError := keyProvider.PrivateRSAKey() + + assert.Nil(t, actualPrivateKey) + assert.EqualError(t, actualError, fmt.Sprintf("failed to get private key: %s", expectedErrorMessage)) + mockFederationClient.AssertExpectations(t) +} + +func TestInstancePrincipalKeyProvider_KeyID(t *testing.T) { + mockFederationClient := new(mockFederationClient) + mockFederationClient.On("SecurityToken").Return("TestSecurityTokenString", nil).Once() + + keyProvider := &instancePrincipalKeyProvider{federationClient: mockFederationClient} + + actualKeyID, err := keyProvider.KeyID() + + assert.NoError(t, err) + assert.Equal(t, "ST$TestSecurityTokenString", actualKeyID) +} + +func TestInstancePrincipalKeyProvider_KeyIDError(t *testing.T) { + mockFederationClient := new(mockFederationClient) + expectedErrorMessage := "TestSecurityTokenError" + mockFederationClient.On("SecurityToken").Return("", fmt.Errorf(expectedErrorMessage)).Once() + + keyProvider := &instancePrincipalKeyProvider{federationClient: mockFederationClient} + + actualKeyID, actualError := keyProvider.KeyID() + + assert.Equal(t, "", actualKeyID) + assert.EqualError(t, actualError, fmt.Sprintf("failed to get security token: %s", expectedErrorMessage)) + mockFederationClient.AssertExpectations(t) +} + +type mockFederationClient struct { + mock.Mock +} + +func (m *mockFederationClient) PrivateKey() (*rsa.PrivateKey, error) { + args := m.Called() + return args.Get(0).(*rsa.PrivateKey), args.Error(1) +} + +func (m *mockFederationClient) SecurityToken() (string, error) { + args := m.Called() + return args.String(0), args.Error(1) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/jwt.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/jwt.go new file mode 100644 index 0000000000..b199a4d687 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/jwt.go @@ -0,0 +1,61 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package auth + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "fmt" + "strings" + "time" +) + +type jwtToken struct { + raw string + header map[string]interface{} + payload map[string]interface{} +} + +func (t *jwtToken) expired() bool { + exp := int64(t.payload["exp"].(float64)) + return exp <= time.Now().Unix() +} + +func parseJwt(tokenString string) (*jwtToken, error) { + parts := strings.Split(tokenString, ".") + if len(parts) != 3 { + return nil, fmt.Errorf("the given token string contains an invalid number of parts") + } + + token := &jwtToken{raw: tokenString} + var err error + + // Parse Header part + var headerBytes []byte + if headerBytes, err = decodePart(parts[0]); err != nil { + return nil, fmt.Errorf("failed to decode the header bytes: %s", err.Error()) + } + if err = json.Unmarshal(headerBytes, &token.header); err != nil { + return nil, err + } + + // Parse Payload part + var payloadBytes []byte + if payloadBytes, err = decodePart(parts[1]); err != nil { + return nil, fmt.Errorf("failed to decode the payload bytes: %s", err.Error()) + } + decoder := json.NewDecoder(bytes.NewBuffer(payloadBytes)) + if err = decoder.Decode(&token.payload); err != nil { + return nil, fmt.Errorf("failed to decode the payload json: %s", err.Error()) + } + + return token, nil +} + +func decodePart(partString string) ([]byte, error) { + if l := len(partString) % 4; 0 < l { + partString += strings.Repeat("=", 4-l) + } + return base64.URLEncoding.DecodeString(partString) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/jwt_test.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/jwt_test.go new file mode 100644 index 0000000000..d06667175b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/jwt_test.go @@ -0,0 +1,68 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package auth + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +const validJwtTokenString = `eyJhbGciOiJSUzI1NiIsImtpZCI6ImFzdyIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJvcGMub3JhY2xlLmNvbSIsImV4cCI6MTUxMTgzODc5MywiaWF0IjoxNTExODE3MTkzLCJpc3MiOiJhdXRoU2VydmljZS5vcmFjbGUuY29tIiwib3BjLWNlcnR0eXBlIjoiaW5zdGFuY2UiLCJvcGMtY29tcGFydG1lbnQiOiJvY2lkMS5jb21wYXJ0bWVudC5vYzEuLmJsdWhibHVoYmx1aCIsIm9wYy1pbnN0YW5jZSI6Im9jaWQxLmluc3RhbmNlLm9jMS5waHguYmx1aGJsdWhibHVoIiwib3BjLXRlbmFudCI6Im9jaWR2MTp0ZW5hbmN5Om9jMTpwaHg6MTIzNDU2Nzg5MDpibHVoYmx1aGJsdWgiLCJwdHlwZSI6Imluc3RhbmNlIiwic3ViIjoib2NpZDEuaW5zdGFuY2Uub2MxLnBoeC5ibHVoYmx1aGJsdWgiLCJ0ZW5hbnQiOiJvY2lkdjE6dGVuYW5jeTpvYzE6cGh4OjEyMzQ1Njc4OTA6Ymx1aGJsdWhibHVoIiwidHR5cGUiOiJ4NTA5In0.zen7q2yJSpMjzH4ym_H7VEwZA0-vTT4Wcild-HRfLxX6A1ej4tlpACa7A24j5JoZYI4mHooZVJ8e7ZezFenK0zZx5j8RbIjsqJKwroYXExOiBXLCUwMWOLXIndEsUzzGLqnPfKHXd80vrhMLmtkVTCJqBMzvPUSYkH_ciWgmjP9m0YETdQ9ifghkADhZGt9IlnOswg0s3Bx9ASwxFZEtom0BmU9GwEuITTTZfKvndk785BlNeZMOjhovaD97-LYpv5B_PiWEz8zialK5zxjijLCw06zyA8CQRQqmVCagNUPilfz_BcPyImzvFDuzQcPyDkTcsB7weX35tafHmA_Ulg` + +func TestJwtToken_ParseJwt(t *testing.T) { + token, err := parseJwt(validJwtTokenString) + + assert.NoError(t, err) + + expectedHeader := map[string]interface{}{ + "alg": "RS256", + "kid": "asw", + "typ": "JWT", + } + assert.Equal(t, expectedHeader, token.header) + + expectedPayload := map[string]interface{}{ + "aud": "opc.oracle.com", + "exp": float64(1511838793), + "iat": float64(1511817193), + "iss": "authService.oracle.com", + "opc-certtype": "instance", + "opc-compartment": "ocid1.compartment.oc1..bluhbluhbluh", + "opc-instance": "ocid1.instance.oc1.phx.bluhbluhbluh", + "opc-tenant": "ocidv1:tenancy:oc1:phx:1234567890:bluhbluhbluh", + "ptype": "instance", + "sub": "ocid1.instance.oc1.phx.bluhbluhbluh", + "tenant": "ocidv1:tenancy:oc1:phx:1234567890:bluhbluhbluh", + "ttype": "x509", + } + assert.Equal(t, expectedPayload, token.payload) + + assert.Equal(t, true, token.expired()) +} + +const headerMissingJwtTokenString = `eyJhdWQiOiJvcGMub3JhY2xlLmNvbSIsImV4cCI6MTUxMTgzODc5MywiaWF0IjoxNTExODE3MTkzLCJpc3MiOiJhdXRoU2VydmljZS5vcmFjbGUuY29tIiwib3BjLWNlcnR0eXBlIjoiaW5zdGFuY2UiLCJvcGMtY29tcGFydG1lbnQiOiJvY2lkMS5jb21wYXJ0bWVudC5vYzEuLmJsdWhibHVoYmx1aCIsIm9wYy1pbnN0YW5jZSI6Im9jaWQxLmluc3RhbmNlLm9jMS5waHguYmx1aGJsdWhibHVoIiwib3BjLXRlbmFudCI6Im9jaWR2MTp0ZW5hbmN5Om9jMTpwaHg6MTIzNDU2Nzg5MDpibHVoYmx1aGJsdWgiLCJwdHlwZSI6Imluc3RhbmNlIiwic3ViIjoib2NpZDEuaW5zdGFuY2Uub2MxLnBoeC5ibHVoYmx1aGJsdWgiLCJ0ZW5hbnQiOiJvY2lkdjE6dGVuYW5jeTpvYzE6cGh4OjEyMzQ1Njc4OTA6Ymx1aGJsdWhibHVoIiwidHR5cGUiOiJ4NTA5In0.zen7q2yJSpMjzH4ym_H7VEwZA0-vTT4Wcild-HRfLxX6A1ej4tlpACa7A24j5JoZYI4mHooZVJ8e7ZezFenK0zZx5j8RbIjsqJKwroYXExOiBXLCUwMWOLXIndEsUzzGLqnPfKHXd80vrhMLmtkVTCJqBMzvPUSYkH_ciWgmjP9m0YETdQ9ifghkADhZGt9IlnOswg0s3Bx9ASwxFZEtom0BmU9GwEuITTTZfKvndk785BlNeZMOjhovaD97-LYpv5B_PiWEz8zialK5zxjijLCw06zyA8CQRQqmVCagNUPilfz_BcPyImzvFDuzQcPyDkTcsB7weX35tafHmA_Ulg` + +func TestJwtToken_ParseJwtInvalidNumberOfParts(t *testing.T) { + token, err := parseJwt(headerMissingJwtTokenString) + + assert.Nil(t, token) + assert.EqualError(t, err, "the given token string contains an invalid number of parts") +} + +const invalidHeaderJwtTokenString = `INVALIDHEADER.eyJhdWQiOiJvcGMub3JhY2xlLmNvbSIsImV4cCI6MTUxMTgzODc5MywiaWF0IjoxNTExODE3MTkzLCJpc3MiOiJhdXRoU2VydmljZS5vcmFjbGUuY29tIiwib3BjLWNlcnR0eXBlIjoiaW5zdGFuY2UiLCJvcGMtY29tcGFydG1lbnQiOiJvY2lkMS5jb21wYXJ0bWVudC5vYzEuLmJsdWhibHVoYmx1aCIsIm9wYy1pbnN0YW5jZSI6Im9jaWQxLmluc3RhbmNlLm9jMS5waHguYmx1aGJsdWhibHVoIiwib3BjLXRlbmFudCI6Im9jaWR2MTp0ZW5hbmN5Om9jMTpwaHg6MTIzNDU2Nzg5MDpibHVoYmx1aGJsdWgiLCJwdHlwZSI6Imluc3RhbmNlIiwic3ViIjoib2NpZDEuaW5zdGFuY2Uub2MxLnBoeC5ibHVoYmx1aGJsdWgiLCJ0ZW5hbnQiOiJvY2lkdjE6dGVuYW5jeTpvYzE6cGh4OjEyMzQ1Njc4OTA6Ymx1aGJsdWhibHVoIiwidHR5cGUiOiJ4NTA5In0.zen7q2yJSpMjzH4ym_H7VEwZA0-vTT4Wcild-HRfLxX6A1ej4tlpACa7A24j5JoZYI4mHooZVJ8e7ZezFenK0zZx5j8RbIjsqJKwroYXExOiBXLCUwMWOLXIndEsUzzGLqnPfKHXd80vrhMLmtkVTCJqBMzvPUSYkH_ciWgmjP9m0YETdQ9ifghkADhZGt9IlnOswg0s3Bx9ASwxFZEtom0BmU9GwEuITTTZfKvndk785BlNeZMOjhovaD97-LYpv5B_PiWEz8zialK5zxjijLCw06zyA8CQRQqmVCagNUPilfz_BcPyImzvFDuzQcPyDkTcsB7weX35tafHmA_Ulg` + +func TestJwtToken_ParseJwtInvalidHeader(t *testing.T) { + token, err := parseJwt(invalidHeaderJwtTokenString) + + assert.Nil(t, token) + assert.Error(t, err) +} + +const invalidPayloadJwtTokenString = `eyJhbGciOiJSUzI1NiIsImtpZCI6ImFzdyIsInR5cCI6IkpXVCJ9.INVALIDPAYLOAD.zen7q2yJSpMjzH4ym_H7VEwZA0-vTT4Wcild-HRfLxX6A1ej4tlpACa7A24j5JoZYI4mHooZVJ8e7ZezFenK0zZx5j8RbIjsqJKwroYXExOiBXLCUwMWOLXIndEsUzzGLqnPfKHXd80vrhMLmtkVTCJqBMzvPUSYkH_ciWgmjP9m0YETdQ9ifghkADhZGt9IlnOswg0s3Bx9ASwxFZEtom0BmU9GwEuITTTZfKvndk785BlNeZMOjhovaD97-LYpv5B_PiWEz8zialK5zxjijLCw06zyA8CQRQqmVCagNUPilfz_BcPyImzvFDuzQcPyDkTcsB7weX35tafHmA_Ulg` + +func TestJwtToken_ParseJwtInvalidPayload(t *testing.T) { + token, err := parseJwt(invalidPayloadJwtTokenString) + + assert.Nil(t, token) + assert.Error(t, err) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/auth/utils.go b/vendor/github.com/oracle/oci-go-sdk/common/auth/utils.go new file mode 100644 index 0000000000..f84490c7d1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/auth/utils.go @@ -0,0 +1,64 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package auth + +import ( + "bytes" + "crypto/sha1" + "crypto/x509" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" + "net/http/httputil" + "strings" +) + +// httpGet makes a simple HTTP GET request to the given URL, expecting only "200 OK" status code. +// This is basically for the Instance Metadata Service. +func httpGet(url string) (body bytes.Buffer, err error) { + var response *http.Response + if response, err = http.Get(url); err != nil { + return + } + + common.IfDebug(func() { + if dump, e := httputil.DumpResponse(response, true); e == nil { + common.Logf("Dump Response %v", string(dump)) + } else { + common.Debugln(e) + } + }) + + defer response.Body.Close() + if _, err = body.ReadFrom(response.Body); err != nil { + return + } + + if response.StatusCode != http.StatusOK { + err = fmt.Errorf("HTTP Get failed: URL: %s, Status: %s, Message: %s", + url, response.Status, body.String()) + return + } + + return +} + +func extractTenancyIDFromCertificate(cert *x509.Certificate) string { + for _, nameAttr := range cert.Subject.Names { + value := nameAttr.Value.(string) + if strings.HasPrefix(value, "opc-tenant:") { + return value[len("opc-tenant:"):] + } + } + return "" +} + +func fingerprint(certificate *x509.Certificate) string { + fingerprint := sha1.Sum(certificate.Raw) + return colonSeparatedString(fingerprint) +} + +func colonSeparatedString(fingerprint [sha1.Size]byte) string { + spaceSeparated := fmt.Sprintf("% x", fingerprint) + return strings.Replace(spaceSeparated, " ", ":", -1) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/client.go b/vendor/github.com/oracle/oci-go-sdk/common/client.go new file mode 100644 index 0000000000..d67e997779 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/client.go @@ -0,0 +1,253 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +// Package common provides supporting functions and structs used by service packages +package common + +import ( + "context" + "fmt" + "net/http" + "net/http/httputil" + "net/url" + "os" + "os/user" + "path" + "runtime" + "strings" + "time" +) + +const ( + // DefaultHostURLTemplate The default url template for service hosts + DefaultHostURLTemplate = "%s.%s.oraclecloud.com" + defaultScheme = "https" + defaultSDKMarker = "Oracle-GoSDK" + defaultUserAgentTemplate = "%s/%s (%s/%s; go/%s)" //SDK/SDKVersion (OS/OSVersion; Lang/LangVersion) + defaultTimeout = time.Second * 30 + defaultConfigFileName = "config" + defaultConfigDirName = ".oci" + secondaryConfigDirName = ".oraclebmc" + maxBodyLenForDebug = 1024 * 1000 +) + +// RequestInterceptor function used to customize the request before calling the underlying service +type RequestInterceptor func(*http.Request) error + +// HTTPRequestDispatcher wraps the execution of a http request, it is generally implemented by +// http.Client.Do, but can be customized for testing +type HTTPRequestDispatcher interface { + Do(req *http.Request) (*http.Response, error) +} + +// BaseClient struct implements all basic operations to call oci web services. +type BaseClient struct { + //HTTPClient performs the http network operations + HTTPClient HTTPRequestDispatcher + + //Signer performs auth operation + Signer HTTPRequestSigner + + //A request interceptor can be used to customize the request before signing and dispatching + Interceptor RequestInterceptor + + //The host of the service + Host string + + //The user agent + UserAgent string + + //Base path for all operations of this client + BasePath string +} + +func defaultUserAgent() string { + userAgent := fmt.Sprintf(defaultUserAgentTemplate, defaultSDKMarker, Version(), runtime.GOOS, runtime.GOARCH, runtime.Version()) + return userAgent +} + +func newBaseClient(signer HTTPRequestSigner, dispatcher HTTPRequestDispatcher) BaseClient { + return BaseClient{ + UserAgent: defaultUserAgent(), + Interceptor: nil, + Signer: signer, + HTTPClient: dispatcher, + } +} + +func defaultHTTPDispatcher() http.Client { + httpClient := http.Client{ + Timeout: defaultTimeout, + } + return httpClient +} + +func defaultBaseClient(provider KeyProvider) BaseClient { + dispatcher := defaultHTTPDispatcher() + signer := DefaultRequestSigner(provider) + return newBaseClient(signer, &dispatcher) +} + +//DefaultBaseClientWithSigner creates a default base client with a given signer +func DefaultBaseClientWithSigner(signer HTTPRequestSigner) BaseClient { + dispatcher := defaultHTTPDispatcher() + return newBaseClient(signer, &dispatcher) +} + +// NewClientWithConfig Create a new client with a configuration provider, the configuration provider +// will be used for the default signer as well as reading the region +// This function does not check for valid regions to implement forward compatibility +func NewClientWithConfig(configProvider ConfigurationProvider) (client BaseClient, err error) { + var ok bool + if ok, err = IsConfigurationProviderValid(configProvider); !ok { + err = fmt.Errorf("can not create client, bad configuration: %s", err.Error()) + return + } + + client = defaultBaseClient(configProvider) + return +} + +func getHomeFolder() string { + current, e := user.Current() + if e != nil { + //Give up and try to return something sensible + home := os.Getenv("HOME") + if home == "" { + home = os.Getenv("USERPROFILE") + } + return home + } + return current.HomeDir +} + +// DefaultConfigProvider returns the default config provider. The default config provider +// will look for configurations in 3 places: file in $HOME/.oci/config, HOME/.obmcs/config and +// variables names starting with the string TF_VAR. If the same configuration is found in multiple +// places the provider will prefer the first one. +func DefaultConfigProvider() ConfigurationProvider { + homeFolder := getHomeFolder() + defaultConfigFile := path.Join(homeFolder, defaultConfigDirName, defaultConfigFileName) + secondaryConfigFile := path.Join(homeFolder, secondaryConfigDirName, defaultConfigFileName) + + defaultFileProvider, _ := ConfigurationProviderFromFile(defaultConfigFile, "") + secondaryFileProvider, _ := ConfigurationProviderFromFile(secondaryConfigFile, "") + environmentProvider := environmentConfigurationProvider{EnvironmentVariablePrefix: "TF_VAR"} + + provider, _ := ComposingConfigurationProvider([]ConfigurationProvider{defaultFileProvider, secondaryFileProvider, environmentProvider}) + Debugf("Configuration provided by: %s", provider) + return provider +} + +func (client *BaseClient) prepareRequest(request *http.Request) (err error) { + if client.UserAgent == "" { + return fmt.Errorf("user agent can not be blank") + } + + if request.Header == nil { + request.Header = http.Header{} + } + request.Header.Set("User-Agent", client.UserAgent) + + if !strings.Contains(client.Host, "http") && + !strings.Contains(client.Host, "https") { + client.Host = fmt.Sprintf("%s://%s", defaultScheme, client.Host) + } + + clientURL, err := url.Parse(client.Host) + if err != nil { + return fmt.Errorf("host is invalid. %s", err.Error()) + } + request.URL.Host = clientURL.Host + request.URL.Scheme = clientURL.Scheme + currentPath := request.URL.Path + request.URL.Path = path.Clean(fmt.Sprintf("/%s/%s", client.BasePath, currentPath)) + return +} + +func (client BaseClient) intercept(request *http.Request) (err error) { + if client.Interceptor != nil { + err = client.Interceptor(request) + } + return +} + +func checkForSuccessfulResponse(res *http.Response) error { + familyStatusCode := res.StatusCode / 100 + if familyStatusCode == 4 || familyStatusCode == 5 { + return newServiceFailureFromResponse(res) + } + return nil + +} + +//Call executes the underlying http requrest with the given context +func (client BaseClient) Call(ctx context.Context, request *http.Request) (response *http.Response, err error) { + Debugln("Atempting to call downstream service") + request = request.WithContext(ctx) + + err = client.prepareRequest(request) + if err != nil { + return + } + + //Intercept + err = client.intercept(request) + if err != nil { + return + } + + //Sign the request + err = client.Signer.Sign(request) + if err != nil { + return + } + + IfDebug(func() { + dumpBody := true + if request.ContentLength > maxBodyLenForDebug { + Logln("not dumping body too big") + dumpBody = false + } + if dump, e := httputil.DumpRequest(request, dumpBody); e == nil { + Logf("Dump Request %v", string(dump)) + } else { + Debugln(e) + } + }) + + //Execute the http request + response, err = client.HTTPClient.Do(request) + + IfDebug(func() { + if err != nil { + Logln(err) + return + } + + dumpBody := true + if response.ContentLength > maxBodyLenForDebug { + Logln("not dumping body too big") + dumpBody = false + } + + if dump, e := httputil.DumpResponse(response, dumpBody); e == nil { + Logf("Dump Response %v", string(dump)) + } else { + Debugln(e) + } + }) + + if err != nil { + return + } + + err = checkForSuccessfulResponse(response) + return +} + +//CloseBodyIfValid closes the body of an http response if the response and the body are valid +func CloseBodyIfValid(httpResponse *http.Response) { + if httpResponse != nil && httpResponse.Body != nil { + httpResponse.Body.Close() + } +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/client_test.go b/vendor/github.com/oracle/oci-go-sdk/common/client_test.go new file mode 100644 index 0000000000..b99ddb6e59 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/client_test.go @@ -0,0 +1,371 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "bytes" + "context" + "crypto/rsa" + "fmt" + "io/ioutil" + "net/http" + "net/url" + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +type customConfig struct { + Reg Region +} + +func (c customConfig) Region() (string, error) { + return string(c.Reg), nil +} + +func (c customConfig) KeyFingerprint() (string, error) { + return "a/a/a", nil +} +func (c customConfig) UserOCID() (string, error) { + return "ocid", nil +} +func (c customConfig) TenancyOCID() (string, error) { + return "ocid1", nil +} +func (c customConfig) PrivateRSAKey() (*rsa.PrivateKey, error) { + key, _ := PrivateKeyFromBytes([]byte(testPrivateKeyConf), nil) + return key, nil +} +func (c customConfig) KeyID() (string, error) { + return "b/b/b", nil +} + +func testClientWithRegion(r Region) BaseClient { + p := customConfig{Reg: r} + c, _ := NewClientWithConfig(p) + return c +} + +func TestClient_prepareRequestDefScheme(t *testing.T) { + host := "somehost:9000" + basePath := "basePath" + restPath := "somepath" + + c := BaseClient{UserAgent: "asdf"} + c.Host = host + c.BasePath = basePath + + request := http.Request{} + request.URL = &url.URL{Path: restPath} + c.prepareRequest(&request) + assert.Equal(t, "https", request.URL.Scheme) + assert.Equal(t, host, request.URL.Host) +} + +func TestDefaultHTTPDispatcher_transportNotSet(t *testing.T) { + client := defaultHTTPDispatcher() + + if client.Transport != nil { + t.Errorf("Expecting default http transport to be nil") + } +} + +func TestClient_prepareRequestSetScheme(t *testing.T) { + host := "http://somehost:9000" + basePath := "basePath" + restPath := "somepath" + + c := BaseClient{UserAgent: "asdf"} + c.Host = host + c.BasePath = basePath + + request := http.Request{} + request.URL = &url.URL{Path: restPath} + c.prepareRequest(&request) + assert.Equal(t, "http", request.URL.Scheme) + assert.Equal(t, "somehost:9000", request.URL.Host) +} + +func TestClient_containsUserAgent(t *testing.T) { + host := "http://somehost:9000" + basePath := "basePath" + restPath := "somepath" + userAgent := "myuserAgent" + + c := BaseClient{} + c.Host = host + c.BasePath = basePath + c.UserAgent = userAgent + + request := http.Request{} + request.URL = &url.URL{Path: restPath} + c.prepareRequest(&request) + assert.Equal(t, userAgent, request.UserAgent()) +} + +func TestClient_userAgentBlank(t *testing.T) { + host := "http://somehost:9000" + basePath := "basePath" + restPath := "somepath" + userAgent := "" + + c := BaseClient{} + c.Host = host + c.BasePath = basePath + c.UserAgent = userAgent + + request := http.Request{} + request.URL = &url.URL{Path: restPath} + e := c.prepareRequest(&request) + assert.Error(t, e) +} + +func TestClient_clientForRegion(t *testing.T) { + region := RegionPHX + c := testClientWithRegion(region) + assert.Equal(t, defaultUserAgent(), c.UserAgent) + assert.NotNil(t, c.HTTPClient) + assert.Nil(t, c.Interceptor) + assert.NotNil(t, c.Signer) + +} + +func TestClient_customClientForRegion(t *testing.T) { + host := "http://somehost:9000" + basePath := "basePath" + restPath := "somepath" + userAgent := "suseragent" + + region := RegionPHX + c := testClientWithRegion(region) + c.Host = host + c.UserAgent = userAgent + c.BasePath = basePath + + request := http.Request{} + request.URL = &url.URL{Path: restPath} + c.prepareRequest(&request) + + assert.Equal(t, userAgent, c.UserAgent) + assert.NotNil(t, c.HTTPClient) + assert.Nil(t, c.Interceptor) + assert.NotNil(t, c.Signer) + assert.Equal(t, "http", request.URL.Scheme) + assert.Equal(t, "somehost:9000", request.URL.Host) +} + +type fakeCaller struct { + CustomResponse *http.Response + Customcall func(r *http.Request) (*http.Response, error) +} + +func (f fakeCaller) Do(req *http.Request) (*http.Response, error) { + if f.CustomResponse != nil { + return f.CustomResponse, nil + } + return f.Customcall(req) +} + +func TestBaseClient_Call(t *testing.T) { + response := http.Response{ + Header: http.Header{}, + StatusCode: 200, + } + body := `{"key" : "RegionFRA","name" : "eu-frankfurt-1"}` + c := testClientWithRegion(RegionIAD) + host := "http://somehost:9000" + basePath := "basePath/" + restPath := "/somepath" + caller := fakeCaller{ + Customcall: func(r *http.Request) (*http.Response, error) { + assert.Equal(t, "somehost:9000", r.URL.Host) + assert.Equal(t, defaultUserAgent(), r.UserAgent()) + assert.Contains(t, r.Header.Get("Authorization"), "signature") + assert.Contains(t, r.URL.Path, "basePath/somepath") + bodyBuffer := bytes.NewBufferString(body) + response.Body = ioutil.NopCloser(bodyBuffer) + return &response, nil + }, + } + + c.Host = host + c.BasePath = basePath + c.HTTPClient = caller + + request := http.Request{} + request.URL = &url.URL{Path: restPath} + retRes, err := c.Call(context.Background(), &request) + assert.Equal(t, &response, retRes) + assert.NoError(t, err) + +} + +func TestBaseClient_CallWithInterceptor(t *testing.T) { + response := http.Response{ + Header: http.Header{}, + StatusCode: 200, + } + body := `{"key" : "RegionFRA","name" : "eu-frankfurt-1"}` + c := testClientWithRegion(RegionIAD) + c.Interceptor = func(request *http.Request) error { + request.Header.Set("Custom-Header", "CustomValue") + return nil + } + host := "http://somehost:9000" + basePath := "basePath/" + restPath := "/somepath" + caller := fakeCaller{ + Customcall: func(r *http.Request) (*http.Response, error) { + assert.Equal(t, "somehost:9000", r.URL.Host) + assert.Equal(t, defaultUserAgent(), r.UserAgent()) + assert.Contains(t, r.Header.Get("Authorization"), "signature") + assert.Contains(t, r.URL.Path, "basePath/somepath") + assert.Equal(t, "CustomValue", r.Header.Get("Custom-Header")) + bodyBuffer := bytes.NewBufferString(body) + response.Body = ioutil.NopCloser(bodyBuffer) + return &response, nil + }, + } + + c.Host = host + c.BasePath = basePath + c.HTTPClient = caller + + request := http.Request{} + request.URL = &url.URL{Path: restPath} + retRes, err := c.Call(context.Background(), &request) + assert.Equal(t, &response, retRes) + assert.NoError(t, err) + +} + +func TestBaseClient_CallError(t *testing.T) { + response := http.Response{ + Header: http.Header{}, + StatusCode: 400, + } + body := `{"code" : "some fake error","message" : "fake error not here"}` + c := testClientWithRegion(RegionIAD) + host := "http://somehost:9000" + basePath := "basePath/" + restPath := "/somepath" + caller := fakeCaller{ + Customcall: func(r *http.Request) (*http.Response, error) { + assert.Equal(t, "somehost:9000", r.URL.Host) + assert.Equal(t, defaultUserAgent(), r.UserAgent()) + assert.Contains(t, r.Header.Get("Authorization"), "signature") + assert.Contains(t, r.URL.Path, "basePath/somepath") + bodyBuffer := bytes.NewBufferString(body) + response.Body = ioutil.NopCloser(bodyBuffer) + return &response, nil + }, + } + + c.Host = host + c.BasePath = basePath + c.HTTPClient = caller + + request := http.Request{} + request.URL = &url.URL{Path: restPath} + retRes, err := c.Call(context.Background(), &request) + assert.Error(t, err) + assert.Equal(t, &response, retRes) + +} + +func TestBaseClient_CreateWithInvalidConfig(t *testing.T) { + dataTpl := `[DEFAULT] +user=someuser +fingerprint=somefingerprint +key_file=%s +region=us-ashburn-1 +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(keyFile) + + configurationProvider, _ := ConfigurationProviderFromFile(tmpConfFile, "") + + _, err := NewClientWithConfig(configurationProvider) + assert.Error(t, err) +} + +func TestBaseClient_CreateWithConfig(t *testing.T) { + dataTpl := `[DEFAULT] +tenancy=sometenancy +user=someuser +fingerprint=somefingerprint +key_file=%s +region=us-ashburn-1 +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(keyFile) + + configurationProvider, errConf := ConfigurationProviderFromFile(tmpConfFile, "") + assert.NoError(t, errConf) + + client, err := NewClientWithConfig(configurationProvider) + assert.NotNil(t, client) + assert.NoError(t, err) +} + +func TestBaseClient_CreateWithBadRegion(t *testing.T) { + dataTpl := `[DEFAULT] +tenancy=sometenancy +user=someuser +fingerprint=somefingerprint +key_file=%s +region=noregion +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(keyFile) + + configurationProvider, errConf := ConfigurationProviderFromFile(tmpConfFile, "") + assert.NoError(t, errConf) + + _, err := NewClientWithConfig(configurationProvider) + assert.NoError(t, err) +} + +func TestBaseClient_CreateWithoutRegion(t *testing.T) { + dataTpl := `[DEFAULT] +tenancy=sometenancy +user=someuser +fingerprint=somefingerprint +key_file=%s +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(keyFile) + + configurationProvider, errConf := ConfigurationProviderFromFile(tmpConfFile, "") + assert.NoError(t, errConf) + + _, err := NewClientWithConfig(configurationProvider) + assert.Error(t, err) +} + +func TestHomeDir(t *testing.T) { + h := getHomeFolder() + _, e := os.Stat(h) + assert.NoError(t, e) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/common.go b/vendor/github.com/oracle/oci-go-sdk/common/common.go new file mode 100644 index 0000000000..9164562b40 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/common.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "strings" +) + +//Region type for regions +type Region string + +const ( + //RegionSEA region SEA + RegionSEA Region = "sea" + //RegionPHX region PHX + RegionPHX Region = "us-phoenix-1" + //RegionIAD region IAD + RegionIAD Region = "us-ashburn-1" + //RegionFRA region FRA + RegionFRA Region = "eu-frankfurt-1" +) + +//StringToRegion convert a string to Region type +func StringToRegion(stringRegion string) (r Region) { + switch strings.ToLower(stringRegion) { + case "sea": + r = RegionSEA + case "phx", "us-phoenix-1": + r = RegionPHX + case "iad", "us-ashburn-1": + r = RegionIAD + case "fra", "eu-frankfurt-1": + r = RegionFRA + default: + r = Region(stringRegion) + Debugf("region named: %s, is not recognized", stringRegion) + } + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/configuration.go b/vendor/github.com/oracle/oci-go-sdk/common/configuration.go new file mode 100644 index 0000000000..d2292bb9d8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/configuration.go @@ -0,0 +1,487 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "crypto/rsa" + "errors" + "fmt" + "io/ioutil" + "os" + "regexp" + "strings" +) + +// ConfigurationProvider wraps information about the account owner +type ConfigurationProvider interface { + KeyProvider + TenancyOCID() (string, error) + UserOCID() (string, error) + KeyFingerprint() (string, error) + Region() (string, error) +} + +// IsConfigurationProviderValid Tests all parts of the configuration provider do not return an error +func IsConfigurationProviderValid(conf ConfigurationProvider) (ok bool, err error) { + baseFn := []func() (string, error){conf.TenancyOCID, conf.UserOCID, conf.KeyFingerprint, conf.Region, conf.KeyID} + for _, fn := range baseFn { + _, err = fn() + ok = err == nil + if err != nil { + return + } + } + + _, err = conf.PrivateRSAKey() + ok = err == nil + if err != nil { + return + } + return true, nil +} + +// rawConfigurationProvider allows a user to simply construct a configuration provider from raw values. +type rawConfigurationProvider struct { + tenancy string + user string + region string + fingerprint string + privateKey string + privateKeyPassphrase *string +} + +// NewRawConfigurationProvider will create a rawConfigurationProvider +func NewRawConfigurationProvider(tenancy, user, region, fingerprint, privateKey string, privateKeyPassphrase *string) ConfigurationProvider { + return rawConfigurationProvider{tenancy, user, region, fingerprint, privateKey, privateKeyPassphrase} +} + +func (p rawConfigurationProvider) PrivateRSAKey() (key *rsa.PrivateKey, err error) { + return PrivateKeyFromBytes([]byte(p.privateKey), p.privateKeyPassphrase) +} + +func (p rawConfigurationProvider) KeyID() (keyID string, err error) { + tenancy, err := p.TenancyOCID() + if err != nil { + return + } + + user, err := p.UserOCID() + if err != nil { + return + } + + fingerprint, err := p.KeyFingerprint() + if err != nil { + return + } + + return fmt.Sprintf("%s/%s/%s", tenancy, user, fingerprint), nil +} + +func (p rawConfigurationProvider) TenancyOCID() (string, error) { + return p.tenancy, nil +} + +func (p rawConfigurationProvider) UserOCID() (string, error) { + return p.user, nil +} + +func (p rawConfigurationProvider) KeyFingerprint() (string, error) { + return p.fingerprint, nil +} + +func (p rawConfigurationProvider) Region() (string, error) { + return p.region, nil +} + +// environmentConfigurationProvider reads configuration from environment variables +type environmentConfigurationProvider struct { // TODO: Support Instance Principal + PrivateKeyPassword string + EnvironmentVariablePrefix string +} + +// ConfigurationProviderEnvironmentVariables creates a ConfigurationProvider from a uniform set of environment variables starting with a prefix +// The env variables should look like: [prefix]_private_key_path, [prefix]_tenancy_ocid, [prefix]_user_ocid, [prefix]_fingerprint +// [prefix]_region +func ConfigurationProviderEnvironmentVariables(environmentVariablePrefix, privateKeyPassword string) ConfigurationProvider { + return environmentConfigurationProvider{EnvironmentVariablePrefix: environmentVariablePrefix, + PrivateKeyPassword: privateKeyPassword} +} + +func (p environmentConfigurationProvider) String() string { + return fmt.Sprintf("Configuration provided by environment variables prefixed with: %s", p.EnvironmentVariablePrefix) +} + +func (p environmentConfigurationProvider) PrivateRSAKey() (key *rsa.PrivateKey, err error) { + environmentVariable := fmt.Sprintf("%s_%s", p.EnvironmentVariablePrefix, "private_key_path") + var ok bool + var value string + if value, ok = os.LookupEnv(environmentVariable); !ok { + return nil, fmt.Errorf("can not read PrivateKey from env variable: %s", environmentVariable) + } + + pemFileContent, err := ioutil.ReadFile(value) + if err != nil { + Debugln("Can not read PrivateKey location from environment variable: " + environmentVariable) + return + } + + key, err = PrivateKeyFromBytes(pemFileContent, &p.PrivateKeyPassword) + return +} + +func (p environmentConfigurationProvider) KeyID() (keyID string, err error) { + ocid, err := p.TenancyOCID() + if err != nil { + return + } + + userocid, err := p.UserOCID() + if err != nil { + return + } + + fingerprint, err := p.KeyFingerprint() + if err != nil { + return + } + + return fmt.Sprintf("%s/%s/%s", ocid, userocid, fingerprint), nil +} + +func (p environmentConfigurationProvider) TenancyOCID() (value string, err error) { + environmentVariable := fmt.Sprintf("%s_%s", p.EnvironmentVariablePrefix, "tenancy_ocid") + var ok bool + if value, ok = os.LookupEnv(environmentVariable); !ok { + err = fmt.Errorf("can not read Tenancy from environment variable %s", environmentVariable) + } + return +} + +func (p environmentConfigurationProvider) UserOCID() (value string, err error) { + environmentVariable := fmt.Sprintf("%s_%s", p.EnvironmentVariablePrefix, "user_ocid") + var ok bool + if value, ok = os.LookupEnv(environmentVariable); !ok { + err = fmt.Errorf("can not read user id from environment variable %s", environmentVariable) + } + return +} + +func (p environmentConfigurationProvider) KeyFingerprint() (value string, err error) { + environmentVariable := fmt.Sprintf("%s_%s", p.EnvironmentVariablePrefix, "fingerprint") + var ok bool + if value, ok = os.LookupEnv(environmentVariable); !ok { + err = fmt.Errorf("can not read fingerprint from environment variable %s", environmentVariable) + } + return +} + +func (p environmentConfigurationProvider) Region() (value string, err error) { + environmentVariable := fmt.Sprintf("%s_%s", p.EnvironmentVariablePrefix, "region") + var ok bool + if value, ok = os.LookupEnv(environmentVariable); !ok { + err = fmt.Errorf("can not read region from environment variable %s", environmentVariable) + } + return +} + +// fileConfigurationProvider. reads configuration information from a file +type fileConfigurationProvider struct { // TODO: Support Instance Principal + //The path to the configuration file + ConfigPath string + + //The password for the private key + PrivateKeyPassword string + + //The profile for the configuration + Profile string + + //ConfigFileInfo + FileInfo *configFileInfo +} + +// ConfigurationProviderFromFile creates a configuration provider from a configuration file +// by reading the "DEFAULT" profile +func ConfigurationProviderFromFile(configFilePath, privateKeyPassword string) (ConfigurationProvider, error) { + if configFilePath == "" { + return nil, fmt.Errorf("config file path can not be empty") + } + + return fileConfigurationProvider{ + ConfigPath: configFilePath, + PrivateKeyPassword: privateKeyPassword, + Profile: "DEFAULT"}, nil +} + +// ConfigurationProviderFromFileWithProfile creates a configuration provider from a configuration file +// and the given profile +func ConfigurationProviderFromFileWithProfile(configFilePath, profile, privateKeyPassword string) (ConfigurationProvider, error) { + if configFilePath == "" { + return nil, fmt.Errorf("config file path can not be empty") + } + + return fileConfigurationProvider{ + ConfigPath: configFilePath, + PrivateKeyPassword: privateKeyPassword, + Profile: profile}, nil +} + +type configFileInfo struct { + UserOcid, Fingerprint, KeyFilePath, TenancyOcid, Region string + PresentConfiguration byte +} + +const ( + hasTenancy = 1 << iota + hasUser + hasFingerprint + hasRegion + hasKeyFile + none +) + +var profileRegex = regexp.MustCompile(`^\[(.*)\]`) + +func parseConfigFile(data []byte, profile string) (info *configFileInfo, err error) { + + if len(data) == 0 { + return nil, fmt.Errorf("configuration file content is empty") + } + + content := string(data) + splitContent := strings.Split(content, "\n") + + //Look for profile + for i, line := range splitContent { + if match := profileRegex.FindStringSubmatch(line); match != nil && len(match) > 1 && match[1] == profile { + start := i + 1 + return parseConfigAtLine(start, splitContent) + } + } + + return nil, fmt.Errorf("configuration file did not contain profile: %s", profile) +} + +func parseConfigAtLine(start int, content []string) (info *configFileInfo, err error) { + var configurationPresent byte + info = &configFileInfo{} + for i := start; i < len(content); i++ { + line := content[i] + if profileRegex.MatchString(line) { + break + } + + if !strings.Contains(line, "=") { + continue + } + + splits := strings.Split(line, "=") + switch key, value := strings.TrimSpace(splits[0]), strings.TrimSpace(splits[1]); strings.ToLower(key) { + case "user": + configurationPresent = configurationPresent | hasUser + info.UserOcid = value + case "fingerprint": + configurationPresent = configurationPresent | hasFingerprint + info.Fingerprint = value + case "key_file": + configurationPresent = configurationPresent | hasKeyFile + info.KeyFilePath = value + case "tenancy": + configurationPresent = configurationPresent | hasTenancy + info.TenancyOcid = value + case "region": + configurationPresent = configurationPresent | hasRegion + info.Region = value + } + } + info.PresentConfiguration = configurationPresent + return + +} + +func openConfigFile(configFilePath string) (data []byte, err error) { + data, err = ioutil.ReadFile(configFilePath) + if err != nil { + err = fmt.Errorf("can not read config file: %s due to: %s", configFilePath, err.Error()) + } + + return +} + +func (p fileConfigurationProvider) String() string { + return fmt.Sprintf("Configuration provided by file: %s", p.ConfigPath) +} + +func (p fileConfigurationProvider) readAndParseConfigFile() (info *configFileInfo, err error) { + if p.FileInfo != nil { + return p.FileInfo, nil + } + + if p.ConfigPath == "" { + return nil, fmt.Errorf("configuration path can not be empty") + } + + data, err := openConfigFile(p.ConfigPath) + if err != nil { + err = fmt.Errorf("error while parsing config file: %s. Due to: %s", p.ConfigPath, err.Error()) + return + } + + p.FileInfo, err = parseConfigFile(data, p.Profile) + return p.FileInfo, err +} + +func presentOrError(value string, expectedConf, presentConf byte, confMissing string) (string, error) { + if presentConf&expectedConf == expectedConf { + return value, nil + } + return "", errors.New(confMissing + " configuration is missing from file") +} + +func (p fileConfigurationProvider) TenancyOCID() (value string, err error) { + info, err := p.readAndParseConfigFile() + if err != nil { + err = fmt.Errorf("can not read tenancy configuration due to: %s", err.Error()) + return + } + + value, err = presentOrError(info.TenancyOcid, hasTenancy, info.PresentConfiguration, "tenancy") + return +} + +func (p fileConfigurationProvider) UserOCID() (value string, err error) { + info, err := p.readAndParseConfigFile() + if err != nil { + err = fmt.Errorf("can not read tenancy configuration due to: %s", err.Error()) + return + } + + value, err = presentOrError(info.UserOcid, hasUser, info.PresentConfiguration, "user") + return +} + +func (p fileConfigurationProvider) KeyFingerprint() (value string, err error) { + info, err := p.readAndParseConfigFile() + if err != nil { + err = fmt.Errorf("can not read tenancy configuration due to: %s", err.Error()) + return + } + value, err = presentOrError(info.Fingerprint, hasFingerprint, info.PresentConfiguration, "fingerprint") + return +} + +func (p fileConfigurationProvider) KeyID() (keyID string, err error) { + info, err := p.readAndParseConfigFile() + if err != nil { + err = fmt.Errorf("can not read tenancy configuration due to: %s", err.Error()) + return + } + + return fmt.Sprintf("%s/%s/%s", info.TenancyOcid, info.UserOcid, info.Fingerprint), nil +} + +func (p fileConfigurationProvider) PrivateRSAKey() (key *rsa.PrivateKey, err error) { + info, err := p.readAndParseConfigFile() + if err != nil { + err = fmt.Errorf("can not read tenancy configuration due to: %s", err.Error()) + return + } + + filePath, err := presentOrError(info.KeyFilePath, hasKeyFile, info.PresentConfiguration, "key file path") + if err != nil { + return + } + pemFileContent, err := ioutil.ReadFile(filePath) + if err != nil { + err = fmt.Errorf("can not read PrivateKey from configuration file due to: %s", err.Error()) + return + } + + key, err = PrivateKeyFromBytes(pemFileContent, &p.PrivateKeyPassword) + return +} + +func (p fileConfigurationProvider) Region() (value string, err error) { + info, err := p.readAndParseConfigFile() + if err != nil { + err = fmt.Errorf("can not read region configuration due to: %s", err.Error()) + return + } + + value, err = presentOrError(info.Region, hasRegion, info.PresentConfiguration, "region") + return +} + +// A configuration provider that look for information in multiple configuration providers +type composingConfigurationProvider struct { + Providers []ConfigurationProvider +} + +// ComposingConfigurationProvider creates a composing configuration provider with the given slice of configuration providers +// A composing provider will return the configuration of the first provider that has the required property +// if no provider has the property it will return an error. +func ComposingConfigurationProvider(providers []ConfigurationProvider) (ConfigurationProvider, error) { + if len(providers) == 0 { + return nil, fmt.Errorf("providers can not be an empty slice") + } + return composingConfigurationProvider{Providers: providers}, nil +} + +func (c composingConfigurationProvider) TenancyOCID() (string, error) { + for _, p := range c.Providers { + val, err := p.TenancyOCID() + if err == nil { + return val, nil + } + } + return "", fmt.Errorf("did not find a proper configuration for tenancy") +} + +func (c composingConfigurationProvider) UserOCID() (string, error) { + for _, p := range c.Providers { + val, err := p.UserOCID() + if err == nil { + return val, nil + } + } + return "", fmt.Errorf("did not find a proper configuration for user") +} + +func (c composingConfigurationProvider) KeyFingerprint() (string, error) { + for _, p := range c.Providers { + val, err := p.KeyFingerprint() + if err == nil { + return val, nil + } + } + return "", fmt.Errorf("did not find a proper configuration for keyFingerprint") +} +func (c composingConfigurationProvider) Region() (string, error) { + for _, p := range c.Providers { + val, err := p.Region() + if err == nil { + return val, nil + } + } + return "", fmt.Errorf("did not find a proper configuration for region") +} + +func (c composingConfigurationProvider) KeyID() (string, error) { + for _, p := range c.Providers { + val, err := p.KeyID() + if err == nil { + return val, nil + } + } + return "", fmt.Errorf("did not find a proper configuration for key id") +} + +func (c composingConfigurationProvider) PrivateRSAKey() (*rsa.PrivateKey, error) { + for _, p := range c.Providers { + val, err := p.PrivateRSAKey() + if err == nil { + return val, nil + } + } + return nil, fmt.Errorf("did not find a proper configuration for private key") +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/configuration_test.go b/vendor/github.com/oracle/oci-go-sdk/common/configuration_test.go new file mode 100644 index 0000000000..53c18f785a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/configuration_test.go @@ -0,0 +1,445 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "fmt" + "io/ioutil" + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +var ( + tuser = "someuser" + tfingerprint = "somefingerprint" + tkeyfile = "somelocation" + ttenancy = "sometenancy" + tregion = "someregion" + testPrivateKeyConf = `-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF +NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F +UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB +AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA +QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK +kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg +f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u +412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc +mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7 +kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA +gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW +G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI +7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA== +-----END RSA PRIVATE KEY-----` +) + +func removeFileFn(filename string) func() { + return func() { + os.Remove(filename) + } +} + +func writeTempFile(data string) (filename string) { + f, _ := ioutil.TempFile("", "gosdkTest") + f.WriteString(data) + filename = f.Name() + return +} + +func TestRawConfigurationProvider(t *testing.T) { + var ( + testTenancy = "ocid1.tenancy.oc1..aaaaaaaaxf3fuazos" + testUser = "ocid1.user.oc1..aaaaaaaa3p67n2kmpxnbcnff" + testRegion = "us-ashburn-1" + testFingerprint = "af:81:71:8e:d2" + ) + + c := NewRawConfigurationProvider(testTenancy, testUser, testRegion, testFingerprint, testPrivateKeyConf, nil) + + user, err := c.UserOCID() + assert.NoError(t, err) + assert.Equal(t, user, testUser) + + fingerprint, err := c.KeyFingerprint() + assert.NoError(t, err) + assert.Equal(t, fingerprint, testFingerprint) + + region, err := c.Region() + assert.NoError(t, err) + assert.Equal(t, region, testRegion) + + rsaKey, err := c.PrivateRSAKey() + assert.NoError(t, err) + assert.NotEmpty(t, rsaKey) + + keyID, err := c.KeyID() + assert.NoError(t, err) + assert.NotEmpty(t, keyID) + + assert.Equal(t, keyID, "ocid1.tenancy.oc1..aaaaaaaaxf3fuazos/ocid1.user.oc1..aaaaaaaa3p67n2kmpxnbcnff/af:81:71:8e:d2") + +} + +func TestFileConfigurationProvider_parseConfigFileData(t *testing.T) { + data := `[DEFAULT] +user=someuser +fingerprint=somefingerprint +key_file=somelocation +tenancy=sometenancy +compartment = somecompartment +region=someregion +` + c, e := parseConfigFile([]byte(data), "DEFAULT") + + assert.NoError(t, e) + assert.Equal(t, c.UserOcid, tuser) + assert.Equal(t, c.Fingerprint, tfingerprint) + assert.Equal(t, c.KeyFilePath, tkeyfile) + assert.Equal(t, c.TenancyOcid, ttenancy) + assert.Equal(t, c.Region, tregion) +} + +func TestFileConfigurationProvider_ParseEmptyFile(t *testing.T) { + data := `` + _, e := parseConfigFile([]byte(data), "DEFAULT") + assert.Error(t, e) +} + +func TestFileConfigurationProvider_FromFile(t *testing.T) { + expected := []string{ttenancy, tuser, tfingerprint, tkeyfile} + data := `[DEFAULT] +user=someuser +fingerprint=somefingerprint +key_file=somelocation +tenancy=sometenancy +compartment = somecompartment +region=someregion +` + filename := writeTempFile(data) + defer removeFileFn(filename) + + c := fileConfigurationProvider{ConfigPath: filename, Profile: "DEFAULT"} + fns := []func() (string, error){c.TenancyOCID, c.UserOCID, c.KeyFingerprint} + + for i, fn := range fns { + val, e := fn() + assert.NoError(t, e) + assert.Equal(t, expected[i], val) + } +} + +func TestFileConfigurationProvider_FromFileEmptyProfile(t *testing.T) { + expected := []string{ttenancy, tuser, tfingerprint, tkeyfile} + data := ` +[DEFAULT] +user=a +fingerprint=a +key_file=a +tenancy=a +compartment = b +region=b + +[] +user=someuser +fingerprint=somefingerprint +key_file=somelocation +tenancy=sometenancy +compartment = somecompartment +region=someregion +` + filename := writeTempFile(data) + defer removeFileFn(filename) + + c := fileConfigurationProvider{ConfigPath: filename, Profile: ""} + fns := []func() (string, error){c.TenancyOCID, c.UserOCID, c.KeyFingerprint} + + for i, fn := range fns { + val, e := fn() + assert.NoError(t, e) + assert.Equal(t, expected[i], val) + } +} + +func TestFileConfigurationProvider_FromFileBadConfig(t *testing.T) { + data := ` +user=someuser +fingerprint=somefingerprint +key_file=somelocation +tenancy=sometenancy +compartment = somecompartment +region=someregion +` + filename := writeTempFile(data) + defer removeFileFn(filename) + + c := fileConfigurationProvider{ConfigPath: filename, Profile: "PROFILE"} + fns := []func() (string, error){c.TenancyOCID, c.UserOCID, c.KeyFingerprint} + + for _, fn := range fns { + _, e := fn() + assert.Error(t, e) + } +} + +func TestFileConfigurationProvider_FromFileMultipleProfiles(t *testing.T) { + expected := []string{ttenancy, tuser, tfingerprint, tkeyfile} + data := ` +[DEFAULT] +user=a +fingerprint=a +key_file=a +tenancy=a +compartment = b +region=b + +[PROFILE] +user=someuser +fingerprint=somefingerprint +key_file=somelocation +tenancy=sometenancy +compartment = somecompartment +region=someregion + +[PROFILE2] +user=someuser +fingerprint=somefingerprint +key_file=somelocation +tenancy=sometenancy +compartment = somecompartment +region=someregion +` + filename := writeTempFile(data) + defer removeFileFn(filename) + + c := fileConfigurationProvider{ConfigPath: filename, Profile: "PROFILE"} + fns := []func() (string, error){c.TenancyOCID, c.UserOCID, c.KeyFingerprint} + + for i, fn := range fns { + val, e := fn() + assert.NoError(t, e) + assert.Equal(t, expected[i], val) + } +} + +func TestFileConfigurationProvider_NoFile(t *testing.T) { + c := fileConfigurationProvider{ConfigPath: "/no/file"} + fns := []func() (string, error){c.TenancyOCID, c.UserOCID, c.KeyFingerprint} + + for _, fn := range fns { + _, e := fn() + assert.Error(t, e) + } +} + +func TestFileConfigurationProvider_KeyProvider(t *testing.T) { + dataTpl := `[DEFAULT] +user=someuser +fingerprint=somefingerprint +key_file=%s +tenancy=sometenancy +compartment = somecompartment +region=someregion +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(keyFile) + + c := fileConfigurationProvider{ConfigPath: tmpConfFile, Profile: "DEFAULT"} + rskey, e := c.PrivateRSAKey() + keyID, e1 := c.KeyID() + assert.NoError(t, e) + assert.NotEmpty(t, rskey) + assert.NoError(t, e1) + assert.NotEmpty(t, keyID) +} + +func TestFileConfigurationProvider_FromFileFn(t *testing.T) { + dataTpl := `[DEFAULT] +user=someuser +fingerprint=somefingerprint +key_file=%s +tenancy=sometenancy +compartment = somecompartment +region=someregion +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(keyFile) + + c, e0 := ConfigurationProviderFromFile(tmpConfFile, "") + assert.NoError(t, e0) + rskey, e := c.PrivateRSAKey() + keyID, e1 := c.KeyID() + assert.NoError(t, e) + assert.NotEmpty(t, rskey) + assert.NoError(t, e1) + assert.NotEmpty(t, keyID) +} + +func TestFileConfigurationProvider_FromFileAndProfile(t *testing.T) { + dataTpl := `[DEFAULT] +user=someuser +fingerprint=somefingerprint +key_file=%s +tenancy=sometenancy +compartment = somecompartment +region=someregion + +[PROFILE2] +user=user2 +fingerprint=f2 +key_file=%s +tenancy=tenancy2 +compartment = compartment2 +region=region2 + +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile, keyFile) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(keyFile) + + c, e0 := ConfigurationProviderFromFile(tmpConfFile, "") + assert.NoError(t, e0) + rskey, e := c.PrivateRSAKey() + keyID, e1 := c.KeyID() + assert.NoError(t, e) + assert.NotEmpty(t, rskey) + assert.NoError(t, e1) + assert.NotEmpty(t, keyID) + + c, e0 = ConfigurationProviderFromFileWithProfile(tmpConfFile, "PROFILE2", "") + assert.NoError(t, e0) + rskey, e = c.PrivateRSAKey() + keyID, e1 = c.KeyID() + assert.NoError(t, e) + assert.NotEmpty(t, rskey) + assert.NoError(t, e1) + assert.NotEmpty(t, keyID) + +} + +func TestFileConfigurationProvider_FromFileIncomplete(t *testing.T) { + dataTpl := `[DEFAULT] +user=someuser +fingerprint=somefingerprint +key_file=%s +compartment = somecompartment +region=someregion +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(keyFile) + + c, e0 := ConfigurationProviderFromFile(tmpConfFile, "") + assert.NoError(t, e0) + _, e1 := c.KeyID() + assert.NoError(t, e1) + _, e1 = c.TenancyOCID() + assert.Error(t, e1) + +} + +func TestFileConfigurationProvider_FromFileIncomplete2(t *testing.T) { + dataTpl := `[DEFAULT] +user=someuser +fingerprint=somefingerprint +key_file=%s +compartment = somecompartment +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(keyFile) + + c, e0 := ConfigurationProviderFromFile(tmpConfFile, "") + assert.NoError(t, e0) + _, e1 := c.KeyID() + assert.NoError(t, e1) + _, e1 = c.TenancyOCID() + assert.Error(t, e1) + _, e1 = c.Region() + assert.Error(t, e1) + +} + +func TestComposingConfigurationProvider_MultipleFiles(t *testing.T) { + dataTpl0 := `` + dataTpl := `[DEFAULT] +user=someuser +fingerprint=somefingerprint +key_file=%s +tenancy=sometenancy +compartment = somecompartment +region=someregion +` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile0 := writeTempFile(dataTpl0) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(tmpConfFile0) + defer removeFileFn(keyFile) + + c0, _ := ConfigurationProviderFromFile(tmpConfFile, "") + c, _ := ConfigurationProviderFromFile(tmpConfFile, "") + + provider, ec := ComposingConfigurationProvider([]ConfigurationProvider{c0, c}) + assert.NoError(t, ec) + fns := []func() (string, error){provider.TenancyOCID, provider.UserOCID, provider.KeyFingerprint} + + for _, fn := range fns { + val, e := fn() + assert.NoError(t, e) + assert.NotEmpty(t, val) + } + key, _ := provider.PrivateRSAKey() + assert.NotNil(t, key) +} + +func TestComposingConfigurationProvider_MultipleFilesNoConf(t *testing.T) { + dataTpl0 := `` + dataTpl := ` ` + + keyFile := writeTempFile(testPrivateKeyConf) + data := fmt.Sprintf(dataTpl, keyFile) + tmpConfFile0 := writeTempFile(dataTpl0) + tmpConfFile := writeTempFile(data) + + defer removeFileFn(tmpConfFile) + defer removeFileFn(tmpConfFile0) + defer removeFileFn(keyFile) + + c0, _ := ConfigurationProviderFromFile(tmpConfFile, "") + c, _ := ConfigurationProviderFromFile(tmpConfFile, "") + + provider, ec := ComposingConfigurationProvider([]ConfigurationProvider{c0, c}) + assert.NoError(t, ec) + fns := []func() (string, error){provider.TenancyOCID, provider.UserOCID, provider.KeyFingerprint} + + for _, fn := range fns { + _, e := fn() + assert.Error(t, e) + } +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/errors.go b/vendor/github.com/oracle/oci-go-sdk/common/errors.go new file mode 100644 index 0000000000..290bd08bf5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/errors.go @@ -0,0 +1,80 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" +) + +// ServiceError models all potential errors generated the service call +type ServiceError interface { + // The http status code of the error + GetHTTPStatusCode() int + + // The human-readable error string as sent by the service + GetMessage() string + + // A short error code that defines the error, meant for programmatic parsing. + // See https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm + GetCode() string +} + +type servicefailure struct { + StatusCode int + Code string `json:"code,omitempty"` + Message string `json:"message,omitempty"` +} + +func newServiceFailureFromResponse(response *http.Response) error { + var err error + + //If there is an error consume the body, entirely + body, err := ioutil.ReadAll(response.Body) + if err != nil { + return servicefailure{ + StatusCode: response.StatusCode, + Code: "BadErrorResponse", + Message: fmt.Sprintf("The body of the response was not readable, due to :%s", err.Error()), + } + } + + se := servicefailure{StatusCode: response.StatusCode} + err = json.Unmarshal(body, &se) + if err != nil { + Debugf("Error response could not be parsed due to: %s", err.Error()) + return servicefailure{ + StatusCode: response.StatusCode, + Code: "BadErrorResponse", + Message: fmt.Sprintf("Error while parsing failure from response"), + } + } + return se +} + +func (se servicefailure) Error() string { + return fmt.Sprintf("Service error:%s. %s. http status code: %d", + se.Code, se.Message, se.StatusCode) +} + +func (se servicefailure) GetHTTPStatusCode() int { + return se.StatusCode + +} + +func (se servicefailure) GetMessage() string { + return se.Message +} + +func (se servicefailure) GetCode() string { + return se.Code +} + +// IsServiceError returns false if the error is not service side, otherwise true +// additionally it returns an interface representing the ServiceError +func IsServiceError(err error) (failure ServiceError, ok bool) { + failure, ok = err.(servicefailure) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/helpers.go b/vendor/github.com/oracle/oci-go-sdk/common/helpers.go new file mode 100644 index 0000000000..554436944c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/helpers.go @@ -0,0 +1,168 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "fmt" + "reflect" + "strings" + "time" +) + +// String returns a pointer to the provided string +func String(value string) *string { + return &value +} + +// Int returns a pointer to the provided int +func Int(value int) *int { + return &value +} + +// Uint returns a pointer to the provided uint +func Uint(value uint) *uint { + return &value +} + +//Float32 returns a pointer to the provided float32 +func Float32(value float32) *float32 { + return &value +} + +//Float64 returns a pointer to the provided float64 +func Float64(value float64) *float64 { + return &value +} + +//Bool returns a pointer to the provided bool +func Bool(value bool) *bool { + return &value +} + +//PointerString prints the values of pointers in a struct +//Producing a human friendly string for an struct with pointers. +//useful when debugging the values of a struct +func PointerString(datastruct interface{}) (representation string) { + val := reflect.ValueOf(datastruct) + typ := reflect.TypeOf(datastruct) + all := make([]string, 2) + all = append(all, "{") + for i := 0; i < typ.NumField(); i++ { + sf := typ.Field(i) + + //unexported + if sf.PkgPath != "" && !sf.Anonymous { + continue + } + + sv := val.Field(i) + stringValue := "" + if isNil(sv) { + stringValue = fmt.Sprintf("%s=", sf.Name) + } else { + if sv.Type().Kind() == reflect.Ptr { + sv = sv.Elem() + } + stringValue = fmt.Sprintf("%s=%v", sf.Name, sv) + } + all = append(all, stringValue) + } + all = append(all, "}") + representation = strings.TrimSpace(strings.Join(all, " ")) + return +} + +// SDKTime a time struct, which renders to/from json using RFC339 +type SDKTime struct { + time.Time +} + +func sdkTimeFromTime(t time.Time) SDKTime { + return SDKTime{t} +} + +func now() *SDKTime { + t := SDKTime{time.Now()} + return &t +} + +var timeType = reflect.TypeOf(SDKTime{}) +var timeTypePtr = reflect.TypeOf(&SDKTime{}) + +const sdkTimeFormat = time.RFC3339 + +const rfc1123OptionalLeadingDigitsInDay = "Mon, _2 Jan 2006 15:04:05 MST" + +func formatTime(t SDKTime) string { + return t.Format(sdkTimeFormat) +} + +func tryParsingTimeWithValidFormatsForHeaders(data []byte, headerName string) (t time.Time, err error) { + header := strings.ToLower(headerName) + switch header { + case "lastmodified", "date": + t, err = tryParsing(data, time.RFC3339, time.RFC1123, rfc1123OptionalLeadingDigitsInDay, time.RFC850, time.ANSIC) + return + default: //By default we parse with RFC3339 + t, err = time.Parse(sdkTimeFormat, string(data)) + return + } +} + +func tryParsing(data []byte, layouts ...string) (tm time.Time, err error) { + datestring := string(data) + for _, l := range layouts { + tm, err = time.Parse(l, datestring) + if err == nil { + return + } + } + err = fmt.Errorf("Could not parse time: %s with formats: %s", datestring, layouts[:]) + return +} + +// UnmarshalJSON unmarshals from json +func (t *SDKTime) UnmarshalJSON(data []byte) (e error) { + s := string(data) + if s == "null" { + t.Time = time.Time{} + } else { + //Try parsing with RFC3339 + t.Time, e = time.Parse(`"`+sdkTimeFormat+`"`, string(data)) + } + return +} + +// MarshalJSON marshals to JSON +func (t *SDKTime) MarshalJSON() (buff []byte, e error) { + s := t.Format(sdkTimeFormat) + buff = []byte(`"` + s + `"`) + return +} + +// PrivateKeyFromBytes is a helper function that will produce a RSA private +// key from bytes. +func PrivateKeyFromBytes(pemData []byte, password *string) (key *rsa.PrivateKey, e error) { + if pemBlock, _ := pem.Decode(pemData); pemBlock != nil { + decrypted := pemBlock.Bytes + if x509.IsEncryptedPEMBlock(pemBlock) { + if password == nil { + e = fmt.Errorf("private_key_password is required for encrypted private keys") + return + } + if decrypted, e = x509.DecryptPEMBlock(pemBlock, []byte(*password)); e != nil { + return + } + } + + key, e = x509.ParsePKCS1PrivateKey(decrypted) + + } else { + e = fmt.Errorf("PEM data was not found in buffer") + return + } + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/helpers_test.go b/vendor/github.com/oracle/oci-go-sdk/common/helpers_test.go new file mode 100644 index 0000000000..de9006fa25 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/helpers_test.go @@ -0,0 +1,84 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "fmt" + "github.com/stretchr/testify/assert" + "testing" +) + +func TestStructToString(t *testing.T) { + ints := []int{1, 2, 4} + + s := struct { + Anint *int + AString *string + AFloat *float32 + SimpleString string + SimepleInt int + IntSlice *[]int + }{Int(1), + String("one"), + Float32(2.3), + "simple", + 2, &ints} + + str := PointerString(s) + assert.Contains(t, str, "one") + assert.Contains(t, str, "1") + assert.Contains(t, str, "[1 2 4]") +} + +type sample struct { + Anint *int + AString *string + AFloat *float32 + SimpleString string + SimepleInt int + Nested sampleNested +} + +func (s sample) String() string { + str := PointerString(s) + return str +} + +type sampleNested struct { + NestedInt *int + NestedBool *bool + NestedString *string + Thestring string +} + +func (s sampleNested) String() string { + str := PointerString(s) + return str +} + +func TestStructToString_Nested(t *testing.T) { + s := sample{Anint: Int(1), + AString: nil, + AFloat: Float32(2.3), + SimpleString: "simple", + SimepleInt: 2, + } + s.Nested.NestedBool = Bool(true) + s.Nested.NestedString = nil + s.Nested.Thestring = "somestring" + s.Nested.NestedInt = Int(2) + + str := fmt.Sprintf("%s", s) + assert.Contains(t, str, "1") + assert.Contains(t, str, "somestring") + assert.Contains(t, str, "") +} + +func TestDateParsing_LastModifiedHeaderDate(t *testing.T) { + data := []string{"Tue, 2 Jan 2018 17:49:29 GMT", "Tue, 02 Jan 2018 17:49:29 GMT"} + for _, val := range data { + tt, err := tryParsingTimeWithValidFormatsForHeaders([]byte(val), "lastmodified") + assert.NoError(t, err) + assert.Equal(t, tt.Day(), 2) + } +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/http.go b/vendor/github.com/oracle/oci-go-sdk/common/http.go new file mode 100644 index 0000000000..5e75ed4b30 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/http.go @@ -0,0 +1,863 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/url" + "path" + "reflect" + "regexp" + "strconv" + "strings" + "time" +) + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//Request Marshaling +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +func isNil(v reflect.Value) bool { + return v.Kind() == reflect.Ptr && v.IsNil() +} + +// Returns the string representation of a reflect.Value +// Only transforms primitive values +func toStringValue(v reflect.Value, field reflect.StructField) (string, error) { + if v.Kind() == reflect.Ptr { + if v.IsNil() { + return "", fmt.Errorf("can not marshal a nil pointer") + } + v = v.Elem() + } + + if v.Type() == timeType { + t := v.Interface().(SDKTime) + return formatTime(t), nil + } + + switch v.Kind() { + case reflect.Bool: + return strconv.FormatBool(v.Bool()), nil + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return strconv.FormatInt(v.Int(), 10), nil + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return strconv.FormatUint(v.Uint(), 10), nil + case reflect.String: + return v.String(), nil + case reflect.Float32: + return strconv.FormatFloat(v.Float(), 'f', 6, 32), nil + case reflect.Float64: + return strconv.FormatFloat(v.Float(), 'f', 6, 64), nil + default: + return "", fmt.Errorf("marshaling structure to a http.Request does not support field named: %s of type: %v", + field.Name, v.Type().String()) + } +} + +func addBinaryBody(request *http.Request, value reflect.Value) (e error) { + readCloser, ok := value.Interface().(io.ReadCloser) + if !ok { + e = fmt.Errorf("body of the request needs to be an io.ReadCloser interface. Can not marshal body of binary request") + return + } + + request.Body = readCloser + + //Set the default content type to application/octet-stream if not set + if request.Header.Get("Content-Type") == "" { + request.Header.Set("Content-Type", "application/octet-stream") + } + return nil +} + +// getTaggedNilFieldNameOrError, evaluates if a field with json and non mandatory tags is nil +// returns the json tag name, or an error if the tags are incorrectly present +func getTaggedNilFieldNameOrError(field reflect.StructField, fieldValue reflect.Value) (bool, string, error) { + currentTag := field.Tag + jsonTag := currentTag.Get("json") + + if jsonTag == "" { + return false, "", fmt.Errorf("json tag is not valid for field %s", field.Name) + } + + partsJSONTag := strings.Split(jsonTag, ",") + nameJSONField := partsJSONTag[0] + + if _, ok := currentTag.Lookup("mandatory"); !ok { + //No mandatory field set, no-op + return false, nameJSONField, nil + } + isMandatory, err := strconv.ParseBool(currentTag.Get("mandatory")) + if err != nil { + return false, "", fmt.Errorf("mandatory tag is not valid for field %s", field.Name) + } + + // If the field is marked as mandatory, no-op + if isMandatory { + return false, nameJSONField, nil + } + + Debugf("Adjusting tag: mandatory is false and json tag is valid on field: %s", field.Name) + + // If the field can not be nil, then no-op + if !isNillableType(&fieldValue) { + Debugf("WARNING json field is tagged with mandatory flags, but the type can not be nil, field name: %s", field.Name) + return false, nameJSONField, nil + } + + // If field value is nil, tag it as omitEmpty + return fieldValue.IsNil(), nameJSONField, nil + +} + +// isNillableType returns true if the filed can be nil +func isNillableType(value *reflect.Value) bool { + k := value.Kind() + switch k { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Slice: + return true + } + return false +} + +// omitNilFieldsInJSON, removes json keys whose struct value is nil, and the field is tag with the json and +// mandatory:false tags +func omitNilFieldsInJSON(data interface{}, value reflect.Value) (interface{}, error) { + switch value.Kind() { + case reflect.Struct: + jsonMap := data.(map[string]interface{}) + fieldType := value.Type() + for i := 0; i < fieldType.NumField(); i++ { + currentField := fieldType.Field(i) + //unexported skip + if currentField.PkgPath != "" { + continue + } + + //Does not have json tag, no-op + if _, ok := currentField.Tag.Lookup("json"); !ok { + continue + } + + currentFieldValue := value.Field(i) + ok, jsonFieldName, err := getTaggedNilFieldNameOrError(currentField, currentFieldValue) + if err != nil { + return nil, fmt.Errorf("can not omit nil fields for field: %s, due to: %s", + currentField.Name, err.Error()) + } + + //Delete the struct field from the json representation + if ok { + delete(jsonMap, jsonFieldName) + continue + } + + if currentFieldValue.Type() == timeType || currentFieldValue.Type() == timeTypePtr { + continue + } + // does it need to be adjusted? + var adjustedValue interface{} + adjustedValue, err = omitNilFieldsInJSON(jsonMap[jsonFieldName], currentFieldValue) + if err != nil { + return nil, fmt.Errorf("can not omit nil fields for field: %s, due to: %s", + currentField.Name, err.Error()) + } + jsonMap[jsonFieldName] = adjustedValue + } + return jsonMap, nil + case reflect.Slice, reflect.Array: + jsonList := data.([]interface{}) + newList := make([]interface{}, len(jsonList)) + var err error + for i, val := range jsonList { + newList[i], err = omitNilFieldsInJSON(val, value.Index(i)) + if err != nil { + return nil, err + } + } + return newList, nil + case reflect.Map: + jsonMap := data.(map[string]interface{}) + newMap := make(map[string]interface{}, len(jsonMap)) + var err error + for key, val := range jsonMap { + newMap[key], err = omitNilFieldsInJSON(val, value.MapIndex(reflect.ValueOf(key))) + if err != nil { + return nil, err + } + } + return newMap, nil + case reflect.Ptr, reflect.Interface: + valPtr := value.Elem() + return omitNilFieldsInJSON(data, valPtr) + default: + //Otherwise no-op + return data, nil + } +} + +// removeNilFieldsInJSONWithTaggedStruct remove struct fields tagged with json and mandatory false +// that are nil +func removeNilFieldsInJSONWithTaggedStruct(rawJSON []byte, value reflect.Value) ([]byte, error) { + rawMap := make(map[string]interface{}) + json.Unmarshal(rawJSON, &rawMap) + fixedMap, err := omitNilFieldsInJSON(rawMap, value) + if err != nil { + return nil, err + } + return json.Marshal(fixedMap) +} + +func addToBody(request *http.Request, value reflect.Value, field reflect.StructField) (e error) { + Debugln("Marshaling to body from field:", field.Name) + if request.Body != nil { + Logln("The body of the request is already set. Structure: ", field.Name, " will overwrite it") + } + tag := field.Tag + encoding := tag.Get("encoding") + + if encoding == "binary" { + return addBinaryBody(request, value) + } + + rawJSON, e := json.Marshal(value.Interface()) + if e != nil { + return + } + marshaled, e := removeNilFieldsInJSONWithTaggedStruct(rawJSON, value) + if e != nil { + return + } + Debugf("Marshaled body is: %s", string(marshaled)) + bodyBytes := bytes.NewReader(marshaled) + request.ContentLength = int64(bodyBytes.Len()) + request.Header.Set("Content-Length", strconv.FormatInt(request.ContentLength, 10)) + request.Header.Set("Content-Type", "application/json") + request.Body = ioutil.NopCloser(bodyBytes) + request.GetBody = func() (io.ReadCloser, error) { + return ioutil.NopCloser(bodyBytes), nil + } + return +} + +func addToQuery(request *http.Request, value reflect.Value, field reflect.StructField) (e error) { + Debugln("Marshaling to query from field:", field.Name) + if request.URL == nil { + request.URL = &url.URL{} + } + query := request.URL.Query() + var queryParameterValue, queryParameterName string + + if queryParameterName = field.Tag.Get("name"); queryParameterName == "" { + return fmt.Errorf("marshaling request to a query requires the 'name' tag for field: %s ", field.Name) + } + + mandatory, _ := strconv.ParseBool(strings.ToLower(field.Tag.Get("mandatory"))) + + //If mandatory and nil. Error out + if mandatory && isNil(value) { + return fmt.Errorf("marshaling request to a header requires not nil pointer for field: %s", field.Name) + } + + //if not mandatory and nil. Omit + if !mandatory && isNil(value) { + Debugf("Query parameter value is not mandatory and is nil pointer in field: %s. Skipping header", field.Name) + return + } + + if queryParameterValue, e = toStringValue(value, field); e != nil { + return + } + + //check for tag "omitEmpty", this is done to accomodate unset fields that do not + //support an empty string: enums in query params + if omitEmpty, present := field.Tag.Lookup("omitEmpty"); present { + omitEmptyBool, _ := strconv.ParseBool(strings.ToLower(omitEmpty)) + if queryParameterValue != "" || !omitEmptyBool { + query.Set(queryParameterName, queryParameterValue) + } else { + Debugf("Omitting %s, is empty and omitEmpty tag is set", field.Name) + } + } else { + query.Set(queryParameterName, queryParameterValue) + } + + request.URL.RawQuery = query.Encode() + return +} + +// Adds to the path of the url in the order they appear in the structure +func addToPath(request *http.Request, value reflect.Value, field reflect.StructField) (e error) { + var additionalURLPathPart string + if additionalURLPathPart, e = toStringValue(value, field); e != nil { + return fmt.Errorf("can not marshal to path in request for field %s. Due to %s", field.Name, e.Error()) + } + + if request.URL == nil { + request.URL = &url.URL{} + request.URL.Path = "" + } + var currentURLPath = request.URL.Path + + var templatedPathRegex, _ = regexp.Compile(".*{.+}.*") + if !templatedPathRegex.MatchString(currentURLPath) { + Debugln("Marshaling request to path by appending field:", field.Name) + allPath := []string{currentURLPath, additionalURLPathPart} + newPath := strings.Join(allPath, "/") + request.URL.Path = path.Clean(newPath) + } else { + var fieldName string + if fieldName = field.Tag.Get("name"); fieldName == "" { + e = fmt.Errorf("marshaling request to path name and template requires a 'name' tag for field: %s", field.Name) + return + } + urlTemplate := currentURLPath + Debugln("Marshaling to path from field:", field.Name, "in template:", urlTemplate) + request.URL.Path = path.Clean(strings.Replace(urlTemplate, "{"+fieldName+"}", additionalURLPathPart, -1)) + } + return +} + +func setWellKnownHeaders(request *http.Request, headerName, headerValue string) (e error) { + switch strings.ToLower(headerName) { + case "content-length": + var len int + len, e = strconv.Atoi(headerValue) + if e != nil { + return + } + request.ContentLength = int64(len) + } + return nil +} + +func addToHeader(request *http.Request, value reflect.Value, field reflect.StructField) (e error) { + Debugln("Marshaling to header from field:", field.Name) + if request.Header == nil { + request.Header = http.Header{} + } + + var headerName, headerValue string + if headerName = field.Tag.Get("name"); headerName == "" { + return fmt.Errorf("marshaling request to a header requires the 'name' tag for field: %s", field.Name) + } + + mandatory, _ := strconv.ParseBool(strings.ToLower(field.Tag.Get("mandatory"))) + //If mandatory and nil. Error out + if mandatory && isNil(value) { + return fmt.Errorf("marshaling request to a header requires not nil pointer for field: %s", field.Name) + } + + //if not mandatory and nil. Omit + if !mandatory && isNil(value) { + Debugf("Header value is not mandatory and is nil pointer in field: %s. Skipping header", field.Name) + return + } + + //Otherwise get value and set header + if headerValue, e = toStringValue(value, field); e != nil { + return + } + + if e = setWellKnownHeaders(request, headerName, headerValue); e != nil { + return + } + + request.Header.Set(headerName, headerValue) + return +} + +// Header collection is a map of string to string that gets rendered as individual headers with a given prefix +func addToHeaderCollection(request *http.Request, value reflect.Value, field reflect.StructField) (e error) { + Debugln("Marshaling to header-collection from field:", field.Name) + if request.Header == nil { + request.Header = http.Header{} + } + + var headerPrefix string + if headerPrefix = field.Tag.Get("prefix"); headerPrefix == "" { + return fmt.Errorf("marshaling request to a header requires the 'prefix' tag for field: %s", field.Name) + } + + mandatory, _ := strconv.ParseBool(strings.ToLower(field.Tag.Get("mandatory"))) + //If mandatory and nil. Error out + if mandatory && isNil(value) { + return fmt.Errorf("marshaling request to a header requires not nil pointer for field: %s", field.Name) + } + + //if not mandatory and nil. Omit + if !mandatory && isNil(value) { + Debugf("Header value is not mandatory and is nil pointer in field: %s. Skipping header", field.Name) + return + } + + //cast to map + headerValues, ok := value.Interface().(map[string]string) + if !ok { + e = fmt.Errorf("header fields need to be of type map[string]string") + return + } + + for k, v := range headerValues { + headerName := fmt.Sprintf("%s%s", headerPrefix, k) + request.Header.Set(headerName, v) + } + return +} + +// Makes sure the incoming structure is able to be marshalled +// to a request +func checkForValidRequestStruct(s interface{}) (*reflect.Value, error) { + val := reflect.ValueOf(s) + for val.Kind() == reflect.Ptr { + if val.IsNil() { + return nil, fmt.Errorf("can not marshal to request a pointer to structure") + } + val = val.Elem() + } + + if s == nil { + return nil, fmt.Errorf("can not marshal to request a nil structure") + } + + if val.Kind() != reflect.Struct { + return nil, fmt.Errorf("can not marshal to request, expects struct input. Got %v", val.Kind()) + } + + return &val, nil +} + +// Populates the parts of a request by reading tags in the passed structure +// nested structs are followed recursively depth-first. +func structToRequestPart(request *http.Request, val reflect.Value) (err error) { + typ := val.Type() + for i := 0; i < typ.NumField(); i++ { + if err != nil { + return + } + + sf := typ.Field(i) + //unexported + if sf.PkgPath != "" && !sf.Anonymous { + continue + } + + sv := val.Field(i) + tag := sf.Tag.Get("contributesTo") + switch tag { + case "header": + err = addToHeader(request, sv, sf) + case "header-collection": + err = addToHeaderCollection(request, sv, sf) + case "path": + err = addToPath(request, sv, sf) + case "query": + err = addToQuery(request, sv, sf) + case "body": + err = addToBody(request, sv, sf) + case "": + Debugln(sf.Name, "does not contain contributes tag. Skipping.") + default: + err = fmt.Errorf("can not marshal field: %s. It needs to contain valid contributesTo tag", sf.Name) + } + } + + //If headers are and the content type was not set, we default to application/json + if request.Header != nil && request.Header.Get("Content-Type") == "" { + request.Header.Set("Content-Type", "application/json") + } + + return +} + +// HTTPRequestMarshaller marshals a structure to an http request using tag values in the struct +// The marshaller tag should like the following +// type A struct { +// ANumber string `contributesTo="query" name="number"` +// TheBody `contributesTo="body"` +// } +// where the contributesTo tag can be: header, path, query, body +// and the 'name' tag is the name of the value used in the http request(not applicable for path) +// If path is specified as part of the tag, the values are appened to the url path +// in the order they appear in the structure +// The current implementation only supports primitive types, except for the body tag, which needs a struct type. +// The body of a request will be marshaled using the tags of the structure +func HTTPRequestMarshaller(requestStruct interface{}, httpRequest *http.Request) (err error) { + var val *reflect.Value + if val, err = checkForValidRequestStruct(requestStruct); err != nil { + return + } + + Debugln("Marshaling to Request:", val.Type().Name()) + err = structToRequestPart(httpRequest, *val) + return +} + +// MakeDefaultHTTPRequest creates the basic http request with the necessary headers set +func MakeDefaultHTTPRequest(method, path string) (httpRequest http.Request) { + httpRequest = http.Request{ + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: make(http.Header), + URL: &url.URL{}, + } + + httpRequest.Header.Set("Content-Length", "0") + httpRequest.Header.Set("Date", time.Now().UTC().Format(http.TimeFormat)) + httpRequest.Header.Set("Opc-Client-Info", strings.Join([]string{defaultSDKMarker, Version()}, "/")) + httpRequest.Header.Set("Accept", "*/*") + httpRequest.Method = method + httpRequest.URL.Path = path + return +} + +// MakeDefaultHTTPRequestWithTaggedStruct creates an http request from an struct with tagged fields, see HTTPRequestMarshaller +// for more information +func MakeDefaultHTTPRequestWithTaggedStruct(method, path string, requestStruct interface{}) (httpRequest http.Request, err error) { + httpRequest = MakeDefaultHTTPRequest(method, path) + err = HTTPRequestMarshaller(requestStruct, &httpRequest) + return +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//Request UnMarshaling +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Makes sure the incoming structure is able to be unmarshaled +// to a request +func checkForValidResponseStruct(s interface{}) (*reflect.Value, error) { + val := reflect.ValueOf(s) + for val.Kind() == reflect.Ptr { + if val.IsNil() { + return nil, fmt.Errorf("can not unmarshal to response a pointer to nil structure") + } + val = val.Elem() + } + + if s == nil { + return nil, fmt.Errorf("can not unmarshal to response a nil structure") + } + + if val.Kind() != reflect.Struct { + return nil, fmt.Errorf("can not unmarshal to response, expects struct input. Got %v", val.Kind()) + } + + return &val, nil +} + +func intSizeFromKind(kind reflect.Kind) int { + switch kind { + case reflect.Int8, reflect.Uint8: + return 8 + case reflect.Int16, reflect.Uint16: + return 16 + case reflect.Int32, reflect.Uint32: + return 32 + case reflect.Int64, reflect.Uint64: + return 64 + case reflect.Int, reflect.Uint: + return strconv.IntSize + default: + Debugln("The type is not valid: %v. Returing int size for arch", kind.String()) + return strconv.IntSize + } + +} + +func analyzeValue(stringValue string, kind reflect.Kind, field reflect.StructField) (val reflect.Value, valPointer reflect.Value, err error) { + switch kind { + case timeType.Kind(): + var t time.Time + t, err = tryParsingTimeWithValidFormatsForHeaders([]byte(stringValue), field.Name) + if err != nil { + return + } + sdkTime := sdkTimeFromTime(t) + val = reflect.ValueOf(sdkTime) + valPointer = reflect.ValueOf(&sdkTime) + return + case reflect.Bool: + var bVal bool + if bVal, err = strconv.ParseBool(stringValue); err != nil { + return + } + val = reflect.ValueOf(bVal) + valPointer = reflect.ValueOf(&bVal) + return + case reflect.Int: + size := intSizeFromKind(kind) + var iVal int64 + if iVal, err = strconv.ParseInt(stringValue, 10, size); err != nil { + return + } + var iiVal int + iiVal = int(iVal) + val = reflect.ValueOf(iiVal) + valPointer = reflect.ValueOf(&iiVal) + return + case reflect.Int64: + size := intSizeFromKind(kind) + var iVal int64 + if iVal, err = strconv.ParseInt(stringValue, 10, size); err != nil { + return + } + val = reflect.ValueOf(iVal) + valPointer = reflect.ValueOf(&iVal) + return + case reflect.Uint: + size := intSizeFromKind(kind) + var iVal uint64 + if iVal, err = strconv.ParseUint(stringValue, 10, size); err != nil { + return + } + var uiVal uint + uiVal = uint(iVal) + val = reflect.ValueOf(uiVal) + valPointer = reflect.ValueOf(&uiVal) + return + case reflect.String: + val = reflect.ValueOf(stringValue) + valPointer = reflect.ValueOf(&stringValue) + case reflect.Float32: + var fVal float64 + if fVal, err = strconv.ParseFloat(stringValue, 32); err != nil { + return + } + var ffVal float32 + ffVal = float32(fVal) + val = reflect.ValueOf(ffVal) + valPointer = reflect.ValueOf(&ffVal) + return + case reflect.Float64: + var fVal float64 + if fVal, err = strconv.ParseFloat(stringValue, 64); err != nil { + return + } + val = reflect.ValueOf(fVal) + valPointer = reflect.ValueOf(&fVal) + return + default: + err = fmt.Errorf("value for kind: %s not supported", kind) + } + return +} + +// Sets the field of a struct, with the appropiate value of the string +// Only sets basic types +func fromStringValue(newValue string, val *reflect.Value, field reflect.StructField) (err error) { + + if !val.CanSet() { + err = fmt.Errorf("can not set field name: %s of type: %v", field.Name, val.Type().String()) + return + } + + kind := val.Kind() + isPointer := false + if val.Kind() == reflect.Ptr { + isPointer = true + kind = field.Type.Elem().Kind() + } + + value, valPtr, err := analyzeValue(newValue, kind, field) + if err != nil { + return + } + if !isPointer { + val.Set(value) + } else { + val.Set(valPtr) + } + return +} + +// PolymorphicJSONUnmarshaler is the interface to unmarshal polymorphic json payloads +type PolymorphicJSONUnmarshaler interface { + UnmarshalPolymorphicJSON(data []byte) (interface{}, error) +} + +func valueFromPolymorphicJSON(content []byte, unmarshaler PolymorphicJSONUnmarshaler) (val interface{}, err error) { + err = json.Unmarshal(content, unmarshaler) + if err != nil { + return + } + val, err = unmarshaler.UnmarshalPolymorphicJSON(content) + return +} + +func valueFromJSONBody(response *http.Response, value *reflect.Value, unmarshaler PolymorphicJSONUnmarshaler) (val interface{}, err error) { + //Consumes the body, consider implementing it + //without body consumption + var content []byte + content, err = ioutil.ReadAll(response.Body) + if err != nil { + return + } + + if unmarshaler != nil { + val, err = valueFromPolymorphicJSON(content, unmarshaler) + return + } + + val = reflect.New(value.Type()).Interface() + err = json.Unmarshal(content, &val) + return +} + +func addFromBody(response *http.Response, value *reflect.Value, field reflect.StructField, unmarshaler PolymorphicJSONUnmarshaler) (err error) { + Debugln("Unmarshaling from body to field:", field.Name) + if response.Body == nil { + Debugln("Unmarshaling body skipped due to nil body content for field: ", field.Name) + return nil + } + + tag := field.Tag + encoding := tag.Get("encoding") + var iVal interface{} + switch encoding { + case "binary": + value.Set(reflect.ValueOf(response.Body)) + return + case "plain-text": + //Expects UTF-8 + byteArr, e := ioutil.ReadAll(response.Body) + if e != nil { + return e + } + str := string(byteArr) + value.Set(reflect.ValueOf(&str)) + return + default: //If the encoding is not set. we'll decode with json + iVal, err = valueFromJSONBody(response, value, unmarshaler) + if err != nil { + return + } + + newVal := reflect.ValueOf(iVal) + if newVal.Kind() == reflect.Ptr { + newVal = newVal.Elem() + } + value.Set(newVal) + return + } +} + +func addFromHeader(response *http.Response, value *reflect.Value, field reflect.StructField) (err error) { + Debugln("Unmarshaling from header to field:", field.Name) + var headerName string + if headerName = field.Tag.Get("name"); headerName == "" { + return fmt.Errorf("unmarshaling response to a header requires the 'name' tag for field: %s", field.Name) + } + + headerValue := response.Header.Get(headerName) + if headerValue == "" { + Debugf("Unmarshalling did not find header with name:%s", headerName) + return nil + } + + if err = fromStringValue(headerValue, value, field); err != nil { + return fmt.Errorf("unmarshaling response to a header failed for field %s, due to %s", field.Name, + err.Error()) + } + return +} + +func addFromHeaderCollection(response *http.Response, value *reflect.Value, field reflect.StructField) error { + Debugln("Unmarshaling from header-collection to field:", field.Name) + var headerPrefix string + if headerPrefix = field.Tag.Get("prefix"); headerPrefix == "" { + return fmt.Errorf("Unmarshaling response to a header-collection requires the 'prefix' tag for field: %s", field.Name) + } + + mapCollection := make(map[string]string) + for name, value := range response.Header { + nameLowerCase := strings.ToLower(name) + if strings.HasPrefix(nameLowerCase, headerPrefix) { + headerNoPrefix := strings.TrimPrefix(nameLowerCase, headerPrefix) + mapCollection[headerNoPrefix] = value[0] + } + } + + Debugln("Marshalled header collection is:", mapCollection) + value.Set(reflect.ValueOf(mapCollection)) + return nil +} + +// Populates a struct from parts of a request by reading tags of the struct +func responseToStruct(response *http.Response, val *reflect.Value, unmarshaler PolymorphicJSONUnmarshaler) (err error) { + typ := val.Type() + for i := 0; i < typ.NumField(); i++ { + if err != nil { + return + } + + sf := typ.Field(i) + + //unexported + if sf.PkgPath != "" { + continue + } + + sv := val.Field(i) + tag := sf.Tag.Get("presentIn") + switch tag { + case "header": + err = addFromHeader(response, &sv, sf) + case "header-collection": + err = addFromHeaderCollection(response, &sv, sf) + case "body": + err = addFromBody(response, &sv, sf, unmarshaler) + case "": + Debugln(sf.Name, "does not contain presentIn tag. Skipping") + default: + err = fmt.Errorf("can not unmarshal field: %s. It needs to contain valid presentIn tag", sf.Name) + } + } + return +} + +// UnmarshalResponse hydrates the fields of a struct with the values of a http response, guided +// by the field tags. The directive tag is "presentIn" and it can be either +// - "header": Will look for the header tagged as "name" in the headers of the struct and set it value to that +// - "body": It will try to marshal the body from a json string to a struct tagged with 'presentIn: "body"'. +// Further this method will consume the body it should be safe to close it after this function +// Notice the current implementation only supports native types:int, strings, floats, bool as the field types +func UnmarshalResponse(httpResponse *http.Response, responseStruct interface{}) (err error) { + + var val *reflect.Value + if val, err = checkForValidResponseStruct(responseStruct); err != nil { + return + } + + if err = responseToStruct(httpResponse, val, nil); err != nil { + return + } + + return nil +} + +// UnmarshalResponseWithPolymorphicBody similar to UnmarshalResponse but assumes the body of the response +// contains polymorphic json. This function will use the unmarshaler argument to unmarshal json content +func UnmarshalResponseWithPolymorphicBody(httpResponse *http.Response, responseStruct interface{}, unmarshaler PolymorphicJSONUnmarshaler) (err error) { + + var val *reflect.Value + if val, err = checkForValidResponseStruct(responseStruct); err != nil { + return + } + + if err = responseToStruct(httpResponse, val, unmarshaler); err != nil { + return + } + + return nil +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/http_signer.go b/vendor/github.com/oracle/oci-go-sdk/common/http_signer.go new file mode 100644 index 0000000000..3e82931aa4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/http_signer.go @@ -0,0 +1,230 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "bytes" + "crypto" + "crypto/rand" + "crypto/rsa" + "crypto/sha256" + "encoding/base64" + "fmt" + "io" + "io/ioutil" + "net/http" + "strings" +) + +// HTTPRequestSigner the interface to sign a request +type HTTPRequestSigner interface { + Sign(r *http.Request) error +} + +// KeyProvider interface that wraps information about the key's account owner +type KeyProvider interface { + PrivateRSAKey() (*rsa.PrivateKey, error) + KeyID() (string, error) +} + +const signerVersion = "1" + +// SignerBodyHashPredicate a function that allows to disable/enable body hashing +// of requests and headers associated with body content +type SignerBodyHashPredicate func(r *http.Request) bool + +// ociRequestSigner implements the http-signatures-draft spec +// as described in https://tools.ietf.org/html/draft-cavage-http-signatures-08 +type ociRequestSigner struct { + KeyProvider KeyProvider + GenericHeaders []string + BodyHeaders []string + ShouldHashBody SignerBodyHashPredicate +} + +var ( + defaultGenericHeaders = []string{"date", "(request-target)", "host"} + defaultBodyHeaders = []string{"content-length", "content-type", "x-content-sha256"} + defaultBodyHashPredicate = func(r *http.Request) bool { + return r.Method == http.MethodPost || r.Method == http.MethodPut + } +) + +// DefaultRequestSigner creates a signer with default parameters. +func DefaultRequestSigner(provider KeyProvider) HTTPRequestSigner { + return RequestSigner(provider, defaultGenericHeaders, defaultBodyHeaders) +} + +// RequestSigner creates a signer that utilizes the specified headers for signing +// and the default predicate for using the body of the request as part of the signature +func RequestSigner(provider KeyProvider, genericHeaders, bodyHeaders []string) HTTPRequestSigner { + return ociRequestSigner{ + KeyProvider: provider, + GenericHeaders: genericHeaders, + BodyHeaders: bodyHeaders, + ShouldHashBody: defaultBodyHashPredicate} +} + +// RequestSignerWithBodyHashingPredicate creates a signer that utilizes the specified headers for signing, as well as a predicate for using +// the body of the request and bodyHeaders parameter as part of the signature +func RequestSignerWithBodyHashingPredicate(provider KeyProvider, genericHeaders, bodyHeaders []string, shouldHashBody SignerBodyHashPredicate) HTTPRequestSigner { + return ociRequestSigner{ + KeyProvider: provider, + GenericHeaders: genericHeaders, + BodyHeaders: bodyHeaders, + ShouldHashBody: shouldHashBody} +} + +func (signer ociRequestSigner) getSigningHeaders(r *http.Request) []string { + var result []string + result = append(result, signer.GenericHeaders...) + + if signer.ShouldHashBody(r) { + result = append(result, signer.BodyHeaders...) + } + + return result +} + +func (signer ociRequestSigner) getSigningString(request *http.Request) string { + signingHeaders := signer.getSigningHeaders(request) + signingParts := make([]string, len(signingHeaders)) + for i, part := range signingHeaders { + var value string + switch part { + case "(request-target)": + value = getRequestTarget(request) + case "host": + value = request.URL.Host + if len(value) == 0 { + value = request.Host + } + default: + value = request.Header.Get(part) + } + signingParts[i] = fmt.Sprintf("%s: %s", part, value) + } + + signingString := strings.Join(signingParts, "\n") + return signingString + +} + +func getRequestTarget(request *http.Request) string { + lowercaseMethod := strings.ToLower(request.Method) + return fmt.Sprintf("%s %s", lowercaseMethod, request.URL.RequestURI()) +} + +func calculateHashOfBody(request *http.Request) (err error) { + var hash string + if request.ContentLength > 0 { + hash, err = GetBodyHash(request) + if err != nil { + return + } + } else { + hash = hashAndEncode([]byte("")) + } + request.Header.Set("X-Content-Sha256", hash) + return +} + +// drainBody reads all of b to memory and then returns two equivalent +// ReadClosers yielding the same bytes. +// +// It returns an error if the initial slurp of all bytes fails. It does not attempt +// to make the returned ReadClosers have identical error-matching behavior. +func drainBody(b io.ReadCloser) (r1, r2 io.ReadCloser, err error) { + if b == http.NoBody { + // No copying needed. Preserve the magic sentinel meaning of NoBody. + return http.NoBody, http.NoBody, nil + } + var buf bytes.Buffer + if _, err = buf.ReadFrom(b); err != nil { + return nil, b, err + } + if err = b.Close(); err != nil { + return nil, b, err + } + return ioutil.NopCloser(&buf), ioutil.NopCloser(bytes.NewReader(buf.Bytes())), nil +} + +func hashAndEncode(data []byte) string { + hashedContent := sha256.Sum256(data) + hash := base64.StdEncoding.EncodeToString(hashedContent[:]) + return hash +} + +// GetBodyHash creates a base64 string from the hash of body the request +func GetBodyHash(request *http.Request) (hashString string, err error) { + if request.Body == nil { + return "", fmt.Errorf("can not read body of request while calculating body hash, nil body?") + } + + var data []byte + bReader := request.Body + bReader, request.Body, err = drainBody(request.Body) + if err != nil { + return "", fmt.Errorf("can not read body of request while calculating body hash: %s", err.Error()) + } + + data, err = ioutil.ReadAll(bReader) + if err != nil { + return "", fmt.Errorf("can not read body of request while calculating body hash: %s", err.Error()) + } + hashString = hashAndEncode(data) + return +} + +func (signer ociRequestSigner) computeSignature(request *http.Request) (signature string, err error) { + signingString := signer.getSigningString(request) + hasher := sha256.New() + hasher.Write([]byte(signingString)) + hashed := hasher.Sum(nil) + + privateKey, err := signer.KeyProvider.PrivateRSAKey() + if err != nil { + return + } + + var unencodedSig []byte + unencodedSig, e := rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, hashed) + if e != nil { + err = fmt.Errorf("can not compute signature while signing the request %s: ", e.Error()) + return + } + + signature = base64.StdEncoding.EncodeToString(unencodedSig) + return +} + +// Sign signs the http request, by inspecting the necessary headers. Once signed +// the request will have the proper 'Authorization' header set, otherwise +// and error is returned +func (signer ociRequestSigner) Sign(request *http.Request) (err error) { + if signer.ShouldHashBody(request) { + err = calculateHashOfBody(request) + if err != nil { + return + } + } + + var signature string + if signature, err = signer.computeSignature(request); err != nil { + return + } + + signingHeaders := strings.Join(signer.getSigningHeaders(request), " ") + + var keyID string + if keyID, err = signer.KeyProvider.KeyID(); err != nil { + return + } + + authValue := fmt.Sprintf("Signature version=\"%s\",headers=\"%s\",keyId=\"%s\",algorithm=\"rsa-sha256\",signature=\"%s\"", + signerVersion, signingHeaders, keyID, signature) + + request.Header.Set("Authorization", authValue) + + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/http_signer_test.go b/vendor/github.com/oracle/oci-go-sdk/common/http_signer_test.go new file mode 100644 index 0000000000..ddb12af54c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/http_signer_test.go @@ -0,0 +1,287 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "bytes" + "crypto/rsa" + "io/ioutil" + "net/http" + "net/url" + "strconv" + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +var ( + testTenancyOCID = "ocid1.tenancy.oc1..aaaaaaaaba3pv6wkcr4jqae5f15p2b2m2yt2j6rx32uzr4h25vqstifsfdsq" + testUserOCID = "ocid1.user.oc1..aaaaaaaat5nvwcna5j6aqzjcaty5eqbb6qt2jvpkanghtgdaqedqw3rynjq" + testFingerprint = "20:3b:97:13:55:1c:5b:0d:d3:37:d8:50:4e:c5:3a:34" + testComparmentOCID = "ocid1.compartment.oc1..aaaaaaaam3we6vgnherjq5q2idnccdflvjsnog7mlr6rtdb25gilchfeyjxa" + + testURL = "https://iaas.us-phoenix-1.oraclecloud.com/20160918/instances" + + "?availabilityDomain=Pjwf%3A%20PHX-AD-1&" + + "compartmentId=ocid1.compartment.oc1..aaaaaaaam3we6vgnherjq5q2idnccdflvjsnog7mlr6rtdb25gilchfeyjxa" + + "&displayName=TeamXInstances&volumeId=ocid1.volume.oc1.phx.abyhqljrgvttnlx73nmrwfaux7kcvzfs3s66izvxf2h4lgvyndsdsnoiwr5q" + testURL2 = "https://iaas.us-phoenix-1.oraclecloud.com/20160918/volumeAttachments" + testBody = `{ + "compartmentId": "ocid1.compartment.oc1..aaaaaaaam3we6vgnherjq5q2idnccdflvjsnog7mlr6rtdb25gilchfeyjxa", + "instanceId": "ocid1.instance.oc1.phx.abuw4ljrlsfiqw6vzzxb43vyypt4pkodawglp3wqxjqofakrwvou52gb6s5a", + "volumeId": "ocid1.volume.oc1.phx.abyhqljrgvttnlx73nmrwfaux7kcvzfs3s66izvxf2h4lgvyndsdsnoiwr5q" +}` + + testPrivateKey = `-----BEGIN RSA PRIVATE KEY----- +MIICXgIBAAKBgQDCFENGw33yGihy92pDjZQhl0C36rPJj+CvfSC8+q28hxA161QF +NUd13wuCTUcq0Qd2qsBe/2hFyc2DCJJg0h1L78+6Z4UMR7EOcpfdUE9Hf3m/hs+F +UR45uBJeDK1HSFHD8bHKD6kv8FPGfJTotc+2xjJwoYi+1hqp1fIekaxsyQIDAQAB +AoGBAJR8ZkCUvx5kzv+utdl7T5MnordT1TvoXXJGXK7ZZ+UuvMNUCdN2QPc4sBiA +QWvLw1cSKt5DsKZ8UETpYPy8pPYnnDEz2dDYiaew9+xEpubyeW2oH4Zx71wqBtOK +kqwrXa/pzdpiucRRjk6vE6YY7EBBs/g7uanVpGibOVAEsqH1AkEA7DkjVH28WDUg +f1nqvfn2Kj6CT7nIcE3jGJsZZ7zlZmBmHFDONMLUrXR/Zm3pR5m0tCmBqa5RK95u +412jt1dPIwJBANJT3v8pnkth48bQo/fKel6uEYyboRtA5/uHuHkZ6FQF7OUkGogc +mSJluOdc5t6hI1VsLn0QZEjQZMEOWr+wKSMCQQCC4kXJEsHAve77oP6HtG/IiEn7 +kpyUXRNvFsDE0czpJJBvL/aRFUJxuRK91jhjC68sA7NsKMGg5OXb5I5Jj36xAkEA +gIT7aFOYBFwGgQAQkWNKLvySgKbAZRTeLBacpHMuQdl1DfdntvAyqpAZ0lY0RKmW +G6aFKaqQfOXKCyWoUiVknQJAXrlgySFci/2ueKlIE1QqIiLSZ8V8OlpFLRnb1pzI +7U1yQXnTAEFYM560yJlzUpOb1V4cScGd365tiSMvxLOvTA== +-----END RSA PRIVATE KEY-----` + + expectedSigningString = "date: Thu, 05 Jan 2014 21:31:40 GMT\n" + + "(request-target): get /20160918/instances?availabilityDomain=Pjwf%3A%20PH" + + "X-AD-1&compartmentId=ocid1.compartment.oc1..aaaaaaaam3we6vgnherjq5q2i" + + "dnccdflvjsnog7mlr6rtdb25gilchfeyjxa&displayName=TeamXInstances&" + + "volumeId=ocid1.volume.oc1.phx.abyhqljrgvttnlx73nmrwfaux7kcvzfs3s66izvxf2h4lgvyndsdsnoiwr5q\n" + + "host: iaas.us-phoenix-1.oraclecloud.com" + expectedSigningString2 = `date: Thu, 05 Jan 2014 21:31:40 GMT +(request-target): post /20160918/volumeAttachments +host: iaas.us-phoenix-1.oraclecloud.com +content-length: 316 +content-type: application/json +x-content-sha256: V9Z20UJTvkvpJ50flBzKE32+6m2zJjweHpDMX/U4Uy0=` + + expectedSignature = "GBas7grhyrhSKHP6AVIj/h5/Vp8bd/peM79H9Wv8kjoaCivujVXlpbKLjMPe" + + "DUhxkFIWtTtLBj3sUzaFj34XE6YZAHc9r2DmE4pMwOAy/kiITcZxa1oHPOeRheC0jP2dqbTll" + + "8fmTZVwKZOKHYPtrLJIJQHJjNvxFWeHQjMaR7M=" + expectedSignature2 = "Mje8vIDPlwIHmD/cTDwRxE7HaAvBg16JnVcsuqaNRim23fFPgQfLoOOxae6WqKb1uPjYEl0qIdazWaBy/Ml8DRhqlocMwoSXv0fbukP8J5N80LCmzT/FFBvIvTB91XuXI3hYfP9Zt1l7S6ieVadHUfqBedWH0itrtPJBgKmrWso=" +) + +type testKeyProvider struct{} + +func (kp testKeyProvider) PrivateRSAKey() (*rsa.PrivateKey, error) { + pass := "" + key, e := PrivateKeyFromBytes([]byte(testPrivateKey), &pass) + return key, e +} + +func (kp testKeyProvider) KeyID() (string, error) { + keyID := strings.Join([]string{testTenancyOCID, testUserOCID, testFingerprint}, "/") + return keyID, nil +} + +func TestOCIRequestSigner_HTTPRequest(t *testing.T) { + s := ociRequestSigner{ + KeyProvider: testKeyProvider{}, + GenericHeaders: defaultGenericHeaders, + ShouldHashBody: defaultBodyHashPredicate, + BodyHeaders: defaultBodyHeaders, + } + + r, err := http.NewRequest("GET", "http://localhost:7000/api", nil) + assert.NoError(t, err) + + r.Header.Set("Date", "Thu, 05 Jan 2014 21:31:40 GMT") + + err = s.Sign(r) + assert.NoError(t, err) + + signature := s.getSigningString(r) + assert.Equal(t, "date: Thu, 05 Jan 2014 21:31:40 GMT\n(request-target): get /api\nhost: localhost:7000", signature) +} + +func TestOCIRequestSigner_SigningString(t *testing.T) { + s := ociRequestSigner{ + KeyProvider: testKeyProvider{}, + GenericHeaders: defaultGenericHeaders, + ShouldHashBody: defaultBodyHashPredicate, + BodyHeaders: defaultBodyHeaders} + + url, _ := url.Parse(testURL) + r := http.Request{ + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: make(http.Header), + URL: url, + } + r.Header.Set("Date", "Thu, 05 Jan 2014 21:31:40 GMT") + r.Method = http.MethodGet + signature := s.getSigningString(&r) + + assert.Equal(t, expectedSigningString, signature) +} + +func TestOCIRequestSigner_ComputeSignature(t *testing.T) { + s := ociRequestSigner{ + KeyProvider: testKeyProvider{}, + GenericHeaders: defaultGenericHeaders, + ShouldHashBody: defaultBodyHashPredicate, + BodyHeaders: defaultBodyHeaders} + url, _ := url.Parse(testURL) + r := http.Request{ + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: make(http.Header), + URL: url, + } + r.Header.Set("Date", "Thu, 05 Jan 2014 21:31:40 GMT") + r.Method = http.MethodGet + signature, err := s.computeSignature(&r) + + assert.NoError(t, err) + assert.Equal(t, expectedSignature, signature) +} + +func TestOCIRequestSigner_Sign(t *testing.T) { + s := ociRequestSigner{ + KeyProvider: testKeyProvider{}, + GenericHeaders: defaultGenericHeaders, + ShouldHashBody: defaultBodyHashPredicate, + BodyHeaders: defaultBodyHeaders} + url, _ := url.Parse(testURL) + r := http.Request{ + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: make(http.Header), + URL: url, + } + r.Header.Set("Date", "Thu, 05 Jan 2014 21:31:40 GMT") + r.Method = http.MethodGet + err := s.Sign(&r) + + expectedAuthHeader := strings.Replace(`Signature version="1",headers="date (request-target) host",keyId="ocid1.t +enancy.oc1..aaaaaaaaba3pv6wkcr4jqae5f15p2b2m2yt2j6rx32uzr4h25vqstifsfdsq/ocid1.user.oc1..aaaaaaaat5nvwcna5j6aqzjcaty5eqbb6qt2jvpkanghtgdaqedqw3ryn +jq/20:3b:97:13:55:1c:5b:0d:d3:37:d8:50:4e:c5:3a:34",algorithm="rsa-sha256",signature="GBas7grhyrhSKHP6AVIj/h5/Vp8bd/peM79H9Wv8kjoaCivujVXlpbKLjMPe +DUhxkFIWtTtLBj3sUzaFj34XE6YZAHc9r2DmE4pMwOAy/kiITcZxa1oHPOeRheC0jP2dqbTll +8fmTZVwKZOKHYPtrLJIJQHJjNvxFWeHQjMaR7M="`, "\n", "", -1) + + assert.NoError(t, err) + assert.Equal(t, expectedAuthHeader, r.Header.Get("Authorization")) + +} + +func TestOCIRequestSigner_SignString2(t *testing.T) { + s := ociRequestSigner{ + KeyProvider: testKeyProvider{}, + GenericHeaders: defaultGenericHeaders, + ShouldHashBody: defaultBodyHashPredicate, + BodyHeaders: defaultBodyHeaders} + u, _ := url.Parse(testURL2) + r := http.Request{ + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: make(http.Header), + URL: u, + } + bodyBuffer := bytes.NewBufferString(testBody) + r.Body = ioutil.NopCloser(bodyBuffer) + r.ContentLength = int64(bodyBuffer.Len()) + r.Header.Set("Date", "Thu, 05 Jan 2014 21:31:40 GMT") + r.Header.Set("Content-Type", "application/json") + r.Header.Set("Content-Length", strconv.FormatInt(r.ContentLength, 10)) + r.Method = http.MethodPost + calculateHashOfBody(&r) + signingString := s.getSigningString(&r) + + assert.Equal(t, r.ContentLength, int64(316)) + assert.Equal(t, expectedSigningString2, signingString) +} + +func TestOCIRequestSigner_ComputeSignature2(t *testing.T) { + s := ociRequestSigner{ + KeyProvider: testKeyProvider{}, + GenericHeaders: defaultGenericHeaders, + ShouldHashBody: defaultBodyHashPredicate, + BodyHeaders: defaultBodyHeaders} + u, _ := url.Parse(testURL2) + r := http.Request{ + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: make(http.Header), + URL: u, + } + bodyBuffer := bytes.NewBufferString(testBody) + r.Body = ioutil.NopCloser(bodyBuffer) + r.ContentLength = int64(bodyBuffer.Len()) + r.Header.Set("Date", "Thu, 05 Jan 2014 21:31:40 GMT") + r.Header.Set("Content-Type", "application/json") + r.Header.Set("Content-Length", strconv.FormatInt(r.ContentLength, 10)) + r.Method = http.MethodPost + calculateHashOfBody(&r) + signature, err := s.computeSignature(&r) + + assert.NoError(t, err) + assert.Equal(t, r.ContentLength, int64(316)) + assert.Equal(t, expectedSignature2, signature) +} + +func TestOCIRequestSigner_Sign2(t *testing.T) { + s := ociRequestSigner{ + KeyProvider: testKeyProvider{}, + GenericHeaders: defaultGenericHeaders, + ShouldHashBody: defaultBodyHashPredicate, + BodyHeaders: defaultBodyHeaders} + u, _ := url.Parse(testURL2) + r := http.Request{ + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: make(http.Header), + URL: u, + } + bodyBuffer := bytes.NewBufferString(testBody) + r.Body = ioutil.NopCloser(bodyBuffer) + r.ContentLength = int64(bodyBuffer.Len()) + r.Header.Set("Date", "Thu, 05 Jan 2014 21:31:40 GMT") + r.Header.Set("Content-Type", "application/json") + r.Header.Set("Content-Length", strconv.FormatInt(r.ContentLength, 10)) + r.Method = http.MethodPost + err := s.Sign(&r) + + expectedAuthHeader := `Signature version="1",headers="date (request-target) host content-length content-type x-content-sha256",keyId="ocid1.tenancy.oc1..aaaaaaaaba3pv6wkcr4jqae5f15p2b2m2yt2j6rx32uzr4h25vqstifsfdsq/ocid1.user.oc1..aaaaaaaat5nvwcna5j6aqzjcaty5eqbb6qt2jvpkanghtgdaqedqw3rynjq/20:3b:97:13:55:1c:5b:0d:d3:37:d8:50:4e:c5:3a:34",algorithm="rsa-sha256",signature="Mje8vIDPlwIHmD/cTDwRxE7HaAvBg16JnVcsuqaNRim23fFPgQfLoOOxae6WqKb1uPjYEl0qIdazWaBy/Ml8DRhqlocMwoSXv0fbukP8J5N80LCmzT/FFBvIvTB91XuXI3hYfP9Zt1l7S6ieVadHUfqBedWH0itrtPJBgKmrWso="` + assert.NoError(t, err) + assert.Equal(t, r.ContentLength, int64(316)) + assert.Equal(t, expectedAuthHeader, r.Header.Get("Authorization")) +} + +func TestOCIRequestSigner_SignEmptyBody(t *testing.T) { + s := ociRequestSigner{KeyProvider: testKeyProvider{}, + ShouldHashBody: defaultBodyHashPredicate, + } + u, _ := url.Parse(testURL2) + r := http.Request{ + Proto: "HTTP/1.1", + ProtoMajor: 1, + ProtoMinor: 1, + Header: make(http.Header), + URL: u, + } + bodyBuffer := bytes.NewBufferString("") + r.Body = ioutil.NopCloser(bodyBuffer) + r.ContentLength = int64(bodyBuffer.Len()) + r.Header.Set("Date", "Thu, 05 Jan 2014 21:31:40 GMT") + r.Header.Set("Content-Type", "application/json") + r.Header.Set("Content-Length", strconv.FormatInt(r.ContentLength, 10)) + r.Method = http.MethodPost + err := s.Sign(&r) + + assert.NoError(t, err) + assert.Equal(t, r.ContentLength, int64(0)) + assert.NotEmpty(t, r.Header.Get("Authorization")) + assert.NotEmpty(t, r.Header.Get("x-content-sha256")) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/http_test.go b/vendor/github.com/oracle/oci-go-sdk/common/http_test.go new file mode 100644 index 0000000000..66f89ea84f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/http_test.go @@ -0,0 +1,880 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "os" + "reflect" + "strconv" + "strings" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//Test data structures, avoid import cycle +type TestupdateUserDetails struct { + Description string `mandatory:"false" json:"description,omitempty"` + Name *string `mandatory:"false" json:"name"` + SomeNumbers []int `mandatory:"false" json:"numbers"` +} + +type listCompartmentsRequest struct { + CompartmentID string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + Page string `mandatory:"false" contributesTo:"query" name:"page"` + Limit int32 `mandatory:"false" contributesTo:"query" name:"limit"` +} + +type updateUserRequest struct { + UserID string `mandatory:"true" contributesTo:"path" name:"userId"` + TestupdateUserDetails `contributesTo:"body"` + IfMatch string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +type TestcreateAPIKeyDetails struct { + Key string `mandatory:"true" json:"key"` +} + +type TestcreateAPIKeyDetailsPtr struct { + Key *string `mandatory:"true" json:"key"` + TheTime *SDKTime `mandatory:"true" json:"theTime"` +} + +type uploadAPIKeyRequest struct { + UserID string `mandatory:"true" contributesTo:"path" name:"userId"` + TestcreateAPIKeyDetails `contributesTo:"body"` + OpcRetryToken string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +type uploadAPIKeyRequestPtr struct { + UserID *string `mandatory:"true" contributesTo:"path" name:"userId"` + TestcreateAPIKeyDetailsPtr `contributesTo:"body"` + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +func TestHttpMarshallerInvalidStruct(t *testing.T) { + request := http.Request{} + err := HTTPRequestMarshaller("asdf", &request) + assert.Error(t, err, nil) +} + +func TestHttpRequestMarshallerQuery(t *testing.T) { + s := listCompartmentsRequest{CompartmentID: "ocid1", Page: "p", Limit: 23} + request := MakeDefaultHTTPRequest(http.MethodPost, "/") + HTTPRequestMarshaller(s, &request) + query := request.URL.Query() + assert.True(t, query.Get("compartmentId") == "ocid1") + assert.True(t, query.Get("page") == "p") + assert.True(t, query.Get("limit") == "23") +} + +func TestMakeDefault(t *testing.T) { + r := MakeDefaultHTTPRequest(http.MethodPost, "/one/two") + assert.NotEmpty(t, r.Header.Get("Date")) + assert.NotEmpty(t, r.Header.Get("Opc-Client-Info")) +} + +func TestHttpMarshallerSimpleHeader(t *testing.T) { + s := updateUserRequest{UserID: "id1", IfMatch: "n=as", TestupdateUserDetails: TestupdateUserDetails{Description: "name of"}} + request := MakeDefaultHTTPRequest(http.MethodPost, "/random") + HTTPRequestMarshaller(s, &request) + header := request.Header + assert.True(t, header.Get("if-match") == "n=as") +} + +func TestHttpMarshallerSimpleStruct(t *testing.T) { + s := uploadAPIKeyRequest{UserID: "111", OpcRetryToken: "token", TestcreateAPIKeyDetails: TestcreateAPIKeyDetails{Key: "thekey"}} + request := MakeDefaultHTTPRequest(http.MethodPost, "/random") + HTTPRequestMarshaller(s, &request) + assert.True(t, strings.Contains(request.URL.Path, "111")) +} + +func TestHttpMarshallerSimpleBody(t *testing.T) { + desc := "theDescription" + s := updateUserRequest{UserID: "id1", IfMatch: "n=as", TestupdateUserDetails: TestupdateUserDetails{ + Description: desc, SomeNumbers: []int{}}} + request := MakeDefaultHTTPRequest(http.MethodPost, "/random") + HTTPRequestMarshaller(s, &request) + body, _ := ioutil.ReadAll(request.Body) + var content map[string]string + json.Unmarshal(body, &content) + assert.Contains(t, content, "description") + assert.Contains(t, content, "numbers") + assert.NotContains(t, content, "name") + assert.Equal(t, "", content["numbers"]) + + if val, ok := content["description"]; !ok || val != desc { + assert.Fail(t, "Should contain: "+desc) + } + +} + +func TestHttpMarshalerAll(t *testing.T) { + desc := "theDescription" + s := struct { + ID string `contributesTo:"path"` + Name string `contributesTo:"query" name:"name"` + When *SDKTime `contributesTo:"query" name:"when"` + Income float32 `contributesTo:"query" name:"income"` + Male bool `contributesTo:"header" name:"male"` + Details TestupdateUserDetails `contributesTo:"body"` + }{ + "101", "tapir", now(), 3.23, true, TestupdateUserDetails{Description: desc}, + } + request := MakeDefaultHTTPRequest(http.MethodPost, "/") + e := HTTPRequestMarshaller(s, &request) + assert.NoError(t, e) + var content map[string]string + body, _ := ioutil.ReadAll(request.Body) + json.Unmarshal(body, &content) + when := s.When.Format(time.RFC3339) + assert.True(t, request.URL.Path == "/101") + assert.True(t, request.URL.Query().Get("name") == s.Name) + assert.True(t, request.URL.Query().Get("income") == strconv.FormatFloat(float64(s.Income), 'f', 6, 32)) + assert.True(t, request.URL.Query().Get("when") == when) + assert.Contains(t, content, "description") + assert.Equal(t, request.Header.Get("Content-Type"), "application/json") + if val, ok := content["description"]; !ok || val != desc { + assert.Fail(t, "Should contain: "+desc) + } +} + +func TestHttpMarshalerPointers(t *testing.T) { + + n := new(string) + *n = "theName" + s := struct { + Name *string `contributesTo:"query" name:"name"` + }{ + n, + } + request := MakeDefaultHTTPRequest(http.MethodPost, "/random") + HTTPRequestMarshaller(s, &request) + assert.NotNil(t, request) + assert.True(t, request.URL.Query().Get("name") == *s.Name) +} + +func TestHttpMarshalerPointersErrorHeader(t *testing.T) { + + n := new(string) + *n = "theName" + s := struct { + Name *string `mandatory:"true" contributesTo:"header" name:"name"` + }{ + nil, + } + request := MakeDefaultHTTPRequest(http.MethodPost, "/random") + e := HTTPRequestMarshaller(s, &request) + assert.Error(t, e) +} + +func TestHttpMarshalerPointersErrorPath(t *testing.T) { + + n := new(string) + *n = "theName" + s := struct { + Name *string `mandatory:"true" contributesTo:"path" name:"name"` + }{ + nil, + } + request := MakeDefaultHTTPRequest(http.MethodPost, "/random") + e := HTTPRequestMarshaller(s, &request) + assert.Error(t, e) +} + +func TestHttpMarshallerSimpleStructPointers(t *testing.T) { + now := SDKTime{time.Now()} + s := uploadAPIKeyRequestPtr{ + UserID: String("111"), + OpcRetryToken: nil, + TestcreateAPIKeyDetailsPtr: TestcreateAPIKeyDetailsPtr{ + Key: String("thekey"), + TheTime: &now, + }} + request := MakeDefaultHTTPRequest(http.MethodPost, "/random") + HTTPRequestMarshaller(s, &request) + all, _ := ioutil.ReadAll(request.Body) + assert.True(t, len(all) > 2) + assert.Equal(t, "", request.Header.Get("opc-retry-token")) + assert.True(t, strings.Contains(request.URL.Path, "111")) + assert.True(t, strings.Contains(string(all), "thekey")) + assert.Contains(t, string(all), now.Format(time.RFC3339)) +} + +func TestHttpMarshallerSimpleStructPointersFilled(t *testing.T) { + s := uploadAPIKeyRequestPtr{ + UserID: String("111"), + OpcRetryToken: String("token"), + TestcreateAPIKeyDetailsPtr: TestcreateAPIKeyDetailsPtr{Key: String("thekey")}} + request := MakeDefaultHTTPRequest(http.MethodPost, "/random") + HTTPRequestMarshaller(s, &request) + assert.Equal(t, "token", request.Header.Get("opc-retry-token")) + assert.True(t, strings.Contains(request.URL.Path, "111")) + +} + +func TestHttpMarshalerUntaggedFields(t *testing.T) { + s := struct { + Name string `contributesTo:"query" name:"name"` + AList []string + AMap map[string]int + TestupdateUserDetails + }{ + "theName", []string{"a", "b"}, map[string]int{"a": 1, "b": 2}, + TestupdateUserDetails{Description: "n"}, + } + request := &http.Request{} + e := HTTPRequestMarshaller(s, request) + assert.NoError(t, e) + assert.NotNil(t, request) + assert.True(t, request.URL.Query().Get("name") == s.Name) +} +func TestHttpMarshalerPathTemplate(t *testing.T) { + urlTemplate := "/name/{userId}/aaa" + s := uploadAPIKeyRequest{UserID: "111", OpcRetryToken: "token", TestcreateAPIKeyDetails: TestcreateAPIKeyDetails{Key: "thekey"}} + request := MakeDefaultHTTPRequest(http.MethodPost, urlTemplate) + e := HTTPRequestMarshaller(s, &request) + assert.NoError(t, e) + assert.Equal(t, "/name/111/aaa", request.URL.Path) +} + +func TestHttpMarshalerFunnyTags(t *testing.T) { + s := struct { + Name string `contributesTo:"quer" name:"name"` + AList []string + AMap map[string]int + TestupdateUserDetails + }{ + "theName", []string{"a", "b"}, map[string]int{"a": 1, "b": 2}, + TestupdateUserDetails{Description: "n"}, + } + request := &http.Request{} + e := HTTPRequestMarshaller(s, request) + assert.Error(t, e) +} + +func TestHttpMarshalerUnsupportedTypes(t *testing.T) { + s1 := struct { + Name string `contributesTo:"query" name:"name"` + AMap map[string]int `contributesTo:"query" name:"theMap"` + }{ + "theName", map[string]int{"a": 1, "b": 2}, + } + s2 := struct { + Name string `contributesTo:"query" name:"name"` + AList []string `contributesTo:"query" name:"theList"` + }{ + "theName", []string{"a", "b"}, + } + s3 := struct { + Name string `contributesTo:"query" name:"name"` + TestupdateUserDetails `contributesTo:"query" name:"str"` + }{ + "theName", TestupdateUserDetails{Description: "a"}, + } + n := new(string) + col := make([]int, 10) + *n = "theName" + s4 := struct { + Name *string `contributesTo:"query" name:"name"` + Coll *[]int `contributesTo:"query" name:"coll"` + }{ + n, &col, + } + + lst := []interface{}{s1, s2, s3, s4} + for _, l := range lst { + request := &http.Request{} + e := HTTPRequestMarshaller(l, request) + Debugln(e) + assert.Error(t, e) + } +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//Response Unmarshaling +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// ListRegionsResponse wrapper for the ListRegions operation +type listRegionsResponse struct { + + // The []Region instance + Items []int `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestID string `presentIn:"header" name:"opcrequestid"` +} + +type listUsersResponse struct { + Items []int `presentIn:"body"` + OpcRequestID string `presentIn:"header" name:"opcrequestid"` + OpcNextPage int `presentIn:"header" name:"opcnextpage"` + SomeUint uint `presentIn:"header" name:"someuint"` + SomeBool bool `presentIn:"header" name:"somebool"` + SomeTime SDKTime `presentIn:"header" name:"sometime"` + SomeFloat float64 `presentIn:"header" name:"somefloat"` +} + +func TestUnmarshalResponse_StringHeader(t *testing.T) { + header := http.Header{} + opcID := "111" + header.Set("OpcrequestId", opcID) + r := http.Response{Header: header} + s := listRegionsResponse{} + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.Equal(t, s.OpcRequestID, opcID) + +} + +func TestUnmarshalResponse_MixHeader(t *testing.T) { + header := http.Header{} + opcID := "111" + nextPage := int(333) + someuint := uint(12) + somebool := true + sometime := now() + somefloat := 2.556 + + header.Set("OpcrequestId", opcID) + header.Set("opcnextpage", strconv.FormatInt(int64(nextPage), 10)) + header.Set("someuint", strconv.FormatUint(uint64(someuint), 10)) + header.Set("somebool", strconv.FormatBool(somebool)) + header.Set("sometime", formatTime(*sometime)) + header.Set("somefloat", strconv.FormatFloat(somefloat, 'f', 3, 64)) + + r := http.Response{Header: header} + s := listUsersResponse{} + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.Equal(t, s.OpcRequestID, opcID) + assert.Equal(t, nextPage, s.OpcNextPage) + assert.Equal(t, someuint, s.SomeUint) + assert.Equal(t, somebool, s.SomeBool) + assert.Equal(t, sometime.Format(time.RFC3339), s.SomeTime.Format(time.RFC3339)) + +} + +type rgn struct { + Key string `mandatory:"false" json:"key,omitempty"` + Name string `mandatory:"false" json:"name,omitempty"` +} + +func TestUnmarshalResponse_SimpleBody(t *testing.T) { + sampleResponse := `{"key" : "RegionFRA","name" : "eu-frankfurt-1"}` + header := http.Header{} + opcID := "111" + header.Set("OpcrequestId", opcID) + s := struct { + Rg rgn `presentIn:"body"` + }{} + r := http.Response{Header: header} + bodyBuffer := bytes.NewBufferString(sampleResponse) + r.Body = ioutil.NopCloser(bodyBuffer) + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.Equal(t, "eu-frankfurt-1", s.Rg.Name) +} + +func TestUnmarshalResponse_SimpleBodyList(t *testing.T) { + sampleResponse := `[{"key" : "RegionFRA","name" : "eu-frankfurt-1"},{"key" : "RegionIAD","name" : "us-ashburn-1"}]` + header := http.Header{} + opcID := "111" + header.Set("OpcrequestId", opcID) + s := struct { + Items []rgn `presentIn:"body"` + }{} + r := http.Response{Header: header} + bodyBuffer := bytes.NewBufferString(sampleResponse) + r.Body = ioutil.NopCloser(bodyBuffer) + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.NotEmpty(t, s.Items) + assert.Equal(t, "eu-frankfurt-1", s.Items[0].Name) + assert.Equal(t, "RegionIAD", s.Items[1].Key) +} + +func TestUnmarshalResponse_SimpleBodyPtr(t *testing.T) { + sampleResponse := `{"key" : "RegionFRA","name" : "eu-frankfurt-1"}` + header := http.Header{} + opcID := "111" + header.Set("OpcrequestId", opcID) + s := struct { + Rg *rgn `presentIn:"body"` + }{} + r := http.Response{Header: header} + bodyBuffer := bytes.NewBufferString(sampleResponse) + r.Body = ioutil.NopCloser(bodyBuffer) + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.Equal(t, "eu-frankfurt-1", s.Rg.Name) +} + +type testRnUnexported struct { + Key string `mandatory:"false" json:"key,omitempty"` + Name string `mandatory:"false" json:"name,omitempty"` +} + +type TestRn struct { + Key string `mandatory:"false" json:"key,omitempty"` + Name string `mandatory:"false" json:"name,omitempty"` +} + +type listRgRes struct { + testRnUnexported `presentIn:"body"` + OpcRequestID string `presentIn:"header" name:"opcrequestid"` +} + +type listRgResEx struct { + TestRn `presentIn:"body"` + OpcRequestID string `presentIn:"header" name:"opcrequestid"` +} + +type listRgResPtr struct { + OpcRequestID *string `presentIn:"header" name:"opcrequestid"` + NumericHeader *int `presentIn:"header" name:"numeric"` + SomeTime *SDKTime `presentIn:"header" name:"theTime"` + SomeBool *bool `presentIn:"header" name:"aBool"` + SomeUint *uint `presentIn:"header" name:"aUint"` + SomeFloat *float32 `presentIn:"header" name:"aFloat"` + TestcreateAPIKeyDetailsPtr `presentIn:"body"` +} + +func TestUnmarshalResponse_BodyAndHeaderUnex(t *testing.T) { + sampleResponse := `{"key" : "RegionFRA","name" : "eu-frankfurt-1"}` + header := http.Header{} + opcID := "111" + header.Set("OpcrequestId", opcID) + s := listRgRes{} + r := http.Response{Header: header} + bodyBuffer := bytes.NewBufferString(sampleResponse) + r.Body = ioutil.NopCloser(bodyBuffer) + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.Equal(t, opcID, s.OpcRequestID) + assert.Equal(t, "", s.Name) + assert.Equal(t, "", s.Key) +} + +func TestUnmarshalResponse_BodyAndHeader(t *testing.T) { + sampleResponse := `{"key" : "RegionFRA","name" : "eu-frankfurt-1"}` + header := http.Header{} + opcID := "111" + header.Set("OpcrequestId", opcID) + s := listRgResEx{} + r := http.Response{Header: header} + bodyBuffer := bytes.NewBufferString(sampleResponse) + r.Body = ioutil.NopCloser(bodyBuffer) + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.Equal(t, opcID, s.OpcRequestID) + assert.Equal(t, "eu-frankfurt-1", s.Name) + assert.Equal(t, "RegionFRA", s.Key) +} + +func TestUnmarshalResponse_PlainTextBody(t *testing.T) { + sampleResponse := `some data not in json + +isn\u0027t +some more data +and..$#04""234:: " 世界, 你好好好, é, + B=µH *` + header := http.Header{} + opcID := "111" + header.Set("OpcrequestId", opcID) + s := struct { + Data *string `presentIn:"body" encoding:"plain-text"` + }{} + r := http.Response{Header: header} + bodyBuffer := bytes.NewBufferString(sampleResponse) + r.Body = ioutil.NopCloser(bodyBuffer) + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.Equal(t, sampleResponse, *(s.Data)) + assert.NotContains(t, sampleResponse, "isn't") +} + +func TestUnmarshalResponse_BodyAndHeaderPtr(t *testing.T) { + header := http.Header{} + opcID := "111" + numericHeader := "1414" + someFloat := float32(2.332342) + someUint := uint(33) + theTime := SDKTime{time.Now()} + theTimeStr := theTime.Format(sdkTimeFormat) + sampleResponse := fmt.Sprintf(`{"key" : "RegionFRA","theTime" : "%s"}`, theTimeStr) + header.Set("OpcrequestId", opcID) + header.Set("numeric", numericHeader) + header.Set("theTime", theTimeStr) + header.Set("aBool", "true") + header.Set("aUint", "33") + header.Set("aFloat", "2.332342") + s := listRgResPtr{} + r := http.Response{Header: header} + bodyBuffer := bytes.NewBufferString(sampleResponse) + r.Body = ioutil.NopCloser(bodyBuffer) + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.Equal(t, opcID, *s.OpcRequestID) + delta, _ := time.ParseDuration("1s") + assert.WithinDuration(t, theTime.Time, s.SomeTime.Time, delta) + assert.Equal(t, true, *s.SomeBool) + assert.Equal(t, someFloat, *s.SomeFloat) + assert.Equal(t, someUint, *s.SomeUint) + assert.WithinDuration(t, theTime.Time, s.TheTime.Time, delta) + assert.Equal(t, "RegionFRA", *s.Key) +} + +type reqWithBinaryFiled struct { + Content io.Reader `mandatory:"true" contributesTo:"body" encoding:"binary"` +} + +func TestMarshalBinaryRequest(t *testing.T) { + data := "some data in a file" + buffer := bytes.NewBufferString(data) + r := reqWithBinaryFiled{Content: ioutil.NopCloser(buffer)} + httpRequest, err := MakeDefaultHTTPRequestWithTaggedStruct("PUT", "/obj", r) + assert.NoError(t, err) + all, err := ioutil.ReadAll(httpRequest.Body) + assert.NoError(t, err) + assert.Equal(t, data, string(all)) +} + +type structWithBinaryField struct { + Content io.Reader `presentIn:"body" encoding:"binary"` +} + +func TestUnmarshalResponse(t *testing.T) { + data := "some data in a file" + filename := writeTempFile(data) + defer removeFileFn(filename) + file, _ := os.Open(filename) + header := http.Header{} + r := http.Response{Header: header} + r.Body = ioutil.NopCloser(file) + s := structWithBinaryField{} + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + all, e := ioutil.ReadAll(s.Content) + assert.NoError(t, e) + assert.Equal(t, data, string(all)) +} + +type structWithHeaderCollections struct { + Meta map[string]string `contributesTo:"header-collection" prefix:"meta-prefix-"` +} + +func TestMarshalWithHeaderCollections(t *testing.T) { + vals := make(map[string]string) + vals["key1"] = "val1" + vals["key2"] = "val2" + s := structWithHeaderCollections{Meta: vals} + + request, err := MakeDefaultHTTPRequestWithTaggedStruct("GET", "/", s) + assert.NoError(t, err) + assert.Equal(t, s.Meta["key1"], request.Header.Get("meta-prefix-key1")) + assert.Equal(t, s.Meta["key2"], request.Header.Get("Meta-prefix-key2")) +} + +func TestMarshalWithHeaderCollections_BadCollectionType(t *testing.T) { + vals := make(map[string]int) + vals["key1"] = 1 + s := struct { + Meta map[string]int `contributesTo:"header-collection" prefix:"meta-prefix-"` + }{Meta: vals} + + _, err := MakeDefaultHTTPRequestWithTaggedStruct("GET", "/", s) + assert.Error(t, err) +} + +type responseWithHC struct { + Meta map[string]string `presentIn:"header-collection" prefix:"meta-prefix-"` +} + +func TestUnMarshalWithHeaderCollections(t *testing.T) { + header := http.Header{} + s := responseWithHC{} + header.Set("meta-prefix-key1", "val1") + header.Set("meta-prefix-key2", "val2") + r := http.Response{Header: header} + err := UnmarshalResponse(&r, &s) + assert.NoError(t, err) + assert.Equal(t, s.Meta["key1"], r.Header.Get("Meta-Prefix-Key1")) + assert.Equal(t, s.Meta["key2"], r.Header.Get("Meta-Prefix-Key2")) +} + +type responseWithEmptyQP struct { + Meta string `contributesTo:"query" omitEmpty:"true" name:"meta"` + QParam string `contributesTo:"query" omitEmpty:"false" name:"qp"` + QParam2 string `contributesTo:"query" name:"qp2"` +} + +func TestEmptyQueryParam(t *testing.T) { + s := responseWithEmptyQP{} + r, err := MakeDefaultHTTPRequestWithTaggedStruct("GET", "/", s) + assert.NoError(t, err) + assert.Contains(t, r.URL.RawQuery, "qp2") + assert.Contains(t, r.URL.RawQuery, "qp") + assert.NotContains(t, r.URL.RawQuery, "meta") +} + +func TestOmitFieldsInJson_SimpleStruct(t *testing.T) { + type Nested struct { + N *string `mandatory:"false" json:"n"` + NN *string `mandatory:"false" json:"nn"` + NNN string `json:"nnn"` + } + val := "" + s := Nested{NN: &val} + sVal := reflect.ValueOf(s) + jsonIn, _ := json.Marshal(s) + m := make(map[string]interface{}) + json.Unmarshal(jsonIn, &m) + mapRet, err := omitNilFieldsInJSON(m, sVal) + assert.NoError(t, err) + jsonRet, err := json.Marshal(mapRet) + assert.NoError(t, err) + assert.Equal(t, `{"nn":"","nnn":""}`, string(jsonRet)) +} + +func TestOmitFieldsInJson_SimpleStructWithSlice(t *testing.T) { + type Nested struct { + N *string `mandatory:"false" json:"n"` + NN *string `mandatory:"false" json:"nn"` + NNN string `json:"nnn"` + Numbers []int `mandatory:"false" json:"numbers"` + EmptyNumbers []int `mandatory:"false" json:"enumbers"` + NilNumbers []int `mandatory:"false" json:"nilnumbers"` + } + val := "" + numbers := []int{1, 3} + s := Nested{NN: &val, Numbers: numbers, EmptyNumbers: []int{}} + sVal := reflect.ValueOf(s) + jsonIn, _ := json.Marshal(s) + m := make(map[string]interface{}) + json.Unmarshal(jsonIn, &m) + mapRet, err := omitNilFieldsInJSON(m, sVal) + assert.NoError(t, err) + jsonRet, err := json.Marshal(mapRet) + assert.NotContains(t, "nilnumbers", mapRet) + assert.NoError(t, err) + assert.Equal(t, `{"enumbers":[],"nn":"","nnn":"","numbers":[1,3]}`, string(jsonRet)) +} + +func TestOmitFieldsInJson_SimpleStructWithStruct(t *testing.T) { + type InSstruct struct { + AString *string `mandatory:"false" json:"a"` + ANilString *string `mandatory:"false" json:"anil"` + EmptyNumbers []int `mandatory:"false" json:"aempty"` + } + + type Nested struct { + N *string `mandatory:"false" json:"n"` + Numbers []int `mandatory:"false" json:"numbers"` + ZComplex InSstruct `mandatory:"false" json:"complex"` + } + val := "" + numbers := []int{1, 3} + s := Nested{N: &val, Numbers: numbers, ZComplex: InSstruct{AString: &val, EmptyNumbers: []int{}}} + sVal := reflect.ValueOf(s) + jsonIn, _ := json.Marshal(s) + m := make(map[string]interface{}) + json.Unmarshal(jsonIn, &m) + mapRet, err := omitNilFieldsInJSON(m, sVal) + assert.NoError(t, err) + jsonRet, err := json.Marshal(mapRet) + assert.NotContains(t, "nilnumbers", mapRet) + assert.NoError(t, err) + assert.Equal(t, `{"complex":{"a":"","aempty":[]},"n":"","numbers":[1,3]}`, string(jsonRet)) +} + +func TestOmitFieldsInJson_SimpleStructWithStructPtr(t *testing.T) { + type InSstruct struct { + AString *string `mandatory:"false" json:"a"` + ANilString *string `mandatory:"false" json:"anil"` + EmptyNumbers []int `mandatory:"false" json:"aempty"` + } + + type Nested struct { + N *string `mandatory:"false" json:"n"` + Numbers []int `mandatory:"false" json:"numbers"` + ZComplex *InSstruct `mandatory:"false" json:"complex"` + } + val := "" + numbers := []int{1, 3} + s := Nested{N: &val, Numbers: numbers, ZComplex: &InSstruct{AString: &val, EmptyNumbers: []int{}}} + sVal := reflect.ValueOf(s) + jsonIn, _ := json.Marshal(s) + m := make(map[string]interface{}) + json.Unmarshal(jsonIn, &m) + mapRet, err := omitNilFieldsInJSON(m, sVal) + assert.NoError(t, err) + jsonRet, err := json.Marshal(mapRet) + assert.NotContains(t, "nilnumbers", mapRet) + assert.NoError(t, err) + assert.Equal(t, `{"complex":{"a":"","aempty":[]},"n":"","numbers":[1,3]}`, string(jsonRet)) +} + +func TestOmitFieldsInJson_SimpleStructWithSliceStruct(t *testing.T) { + type InSstruct struct { + AString *string `mandatory:"false" json:"a"` + ANilString *string `mandatory:"false" json:"anil"` + EmptyNumbers []int `mandatory:"false" json:"aempty"` + } + + type Nested struct { + //N *string `mandatory:"false" json:"n"` + //Numbers []int `mandatory:"false" json:"numbers"` + ZComplex []InSstruct `mandatory:"false" json:"complex"` + } + val := "" + //numbers := []int{1, 3} + //s := Nested{N:&val, Numbers: numbers, ZComplex:InSstruct{AString:&val, EmptyNumbers:[]int{}}} + s := Nested{ZComplex: []InSstruct{{AString: &val, EmptyNumbers: []int{}}}} + sVal := reflect.ValueOf(s) + jsonIn, _ := json.Marshal(s) + m := make(map[string]interface{}) + json.Unmarshal(jsonIn, &m) + mapRet, err := omitNilFieldsInJSON(m, sVal) + assert.NoError(t, err) + jsonRet, err := json.Marshal(mapRet) + assert.NotContains(t, "nilnumbers", mapRet) + assert.NoError(t, err) + assert.Equal(t, `{"complex":[{"a":"","aempty":[]}]}`, string(jsonRet)) +} + +func TestOmitEmptyEnumInJson_SimpleStructWithEnum(t *testing.T) { + type TestEnum string + + const ( + TestEnumActive TestEnum = "ACTIVE" + TestEnumUnknown TestEnum = "UNKNOWN" + ) + type TestStruct struct { + MandatoryEnum TestEnum `mandatory:"true" json:"mandatoryenum"` + OptionalEnum TestEnum `mandatory:"false" json:"optionalenum,omitempty"` + TestString *string `mandatory:"false" json:"teststring"` + } + + type TestStruct2 struct { + MandatoryEnum TestEnum `mandatory:"true" json:"mandatoryenum,omitempty"` + OptionalEnum TestEnum `mandatory:"false" json:"optionalenum"` + TestString *string `mandatory:"false" json:"teststring"` + } + + var enumTests = []struct { + in interface{} // input + out string // expected result + }{ + { + TestStruct{MandatoryEnum: TestEnumActive, TestString: String("teststring")}, + `{"mandatoryenum":"ACTIVE","teststring":"teststring"}`, + }, + { + TestStruct2{MandatoryEnum: TestEnumActive, TestString: String("teststring")}, + `{"mandatoryenum":"ACTIVE","optionalenum":"","teststring":"teststring"}`, + }, + } + + for _, tt := range enumTests { + b, err := json.Marshal(tt.in) + assert.NoError(t, err) + assert.Equal(t, tt.out, string(b)) + } +} + +func TestOmitFieldsInJson_SimpleStructWithMapStruct(t *testing.T) { + type InSstruct struct { + AString *string `mandatory:"false" json:"a"` + ANilString *string `mandatory:"false" json:"anil"` + EmptyNumbers []int `mandatory:"false" json:"aempty"` + } + + type Nested struct { + //N *string `mandatory:"false" json:"n"` + //Numbers []int `mandatory:"false" json:"numbers"` + ZComplex map[string]InSstruct `mandatory:"false" json:"complex"` + } + val := "" + val2 := "two" + //numbers := []int{1, 3} + //s := Nested{N:&val, Numbers: numbers, ZComplex:InSstruct{AString:&val, EmptyNumbers:[]int{}}} + data := make(map[string]InSstruct) + data["one"] = InSstruct{AString: &val, EmptyNumbers: []int{}} + data["two"] = InSstruct{AString: &val2, EmptyNumbers: []int{1}} + data["ten"] = InSstruct{AString: &val2} + + s := Nested{ZComplex: data} + sVal := reflect.ValueOf(s) + jsonIn, _ := json.Marshal(s) + m := make(map[string]interface{}) + json.Unmarshal(jsonIn, &m) + mapRet, err := omitNilFieldsInJSON(m, sVal) + assert.NoError(t, err) + jsonRet, err := json.Marshal(mapRet) + assert.NotContains(t, "nilnumbers", mapRet) + assert.NoError(t, err) + assert.Equal(t, `{"complex":{"one":{"a":"","aempty":[]},"ten":{"a":"two"},"two":{"a":"two","aempty":[1]}}}`, string(jsonRet)) +} + +func TestOmitFieldsInJson_removeFields(t *testing.T) { + type InSstruct struct { + AString *string `mandatory:"false" json:"a"` + ANilString *string `mandatory:"false" json:"anil"` + EmptyNumbers []int `mandatory:"false" json:"aempty"` + } + type Nested struct { + N *string `mandatory:"false" json:"n"` + //Numbers []int `mandatory:"false" json:"numbers"` + ZComplex map[string]InSstruct `mandatory:"false" json:"complex"` + } + val := "" + val2 := "two" + //numbers := []int{1, 3} + //s := Nested{N:&val, Numbers: numbers, ZComplex:InSstruct{AString:&val, EmptyNumbers:[]int{}}} + data := make(map[string]InSstruct) + data["one"] = InSstruct{AString: &val, EmptyNumbers: []int{}} + data["two"] = InSstruct{AString: &val2, EmptyNumbers: []int{1}} + data["ten"] = InSstruct{AString: &val2} + + s := Nested{ZComplex: data} + jsonIn, _ := json.Marshal(s) + sVal := reflect.ValueOf(s) + jsonRet, err := removeNilFieldsInJSONWithTaggedStruct(jsonIn, sVal) + assert.NoError(t, err) + assert.Equal(t, `{"complex":{"one":{"a":"","aempty":[]},"ten":{"a":"two"},"two":{"a":"two","aempty":[1]}}}`, string(jsonRet)) +} + +func TestOmitFieldsInJson_SimpleStructWithTime(t *testing.T) { + type Nested struct { + N *string `mandatory:"false" json:"n"` + TheTime *SDKTime `mandatory:"true" json:"theTime"` + NilTime *SDKTime `mandatory:"false" json:"nilTime"` + } + val := "" + now := SDKTime{time.Now()} + s := Nested{N: &val, TheTime: &now} + sVal := reflect.ValueOf(s) + jsonIn, _ := json.Marshal(s) + m := make(map[string]interface{}) + json.Unmarshal(jsonIn, &m) + theTime := m["theTime"] + mapRet, err := omitNilFieldsInJSON(m, sVal) + assert.NoError(t, err) + assert.NotContains(t, mapRet, "nilTime") + assert.Contains(t, mapRet, "n") + assert.Contains(t, mapRet, "theTime") + assert.Equal(t, theTime, mapRet.(map[string]interface{})["theTime"]) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/log.go b/vendor/github.com/oracle/oci-go-sdk/common/log.go new file mode 100644 index 0000000000..328485fdd7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/log.go @@ -0,0 +1,67 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +package common + +import ( + "fmt" + "io" + "io/ioutil" + "log" + "os" + "sync" +) + +// Simple logging proxy to distinguish control for logging messages +// Debug logging is turned on/off by the presence of the environment variable "OCI_GO_SDK_DEBUG" +var debugLog = log.New(os.Stderr, "DEBUG ", log.Ldate|log.Ltime|log.Lshortfile) +var mainLog = log.New(os.Stderr, "", log.Ldate|log.Ltime|log.Lshortfile) +var isDebugLogEnabled bool +var checkDebug sync.Once + +func getOutputForEnv() (writer io.Writer) { + checkDebug.Do(func() { + isDebugLogEnabled = *new(bool) + _, isDebugLogEnabled = os.LookupEnv("OCI_GO_SDK_DEBUG") + }) + + writer = ioutil.Discard + if isDebugLogEnabled { + writer = os.Stderr + } + return +} + +// Debugf logs v with the provided format if debug mode is set +func Debugf(format string, v ...interface{}) { + debugLog.SetOutput(getOutputForEnv()) + debugLog.Output(3, fmt.Sprintf(format, v...)) +} + +// Debug logs v if debug mode is set +func Debug(v ...interface{}) { + debugLog.SetOutput(getOutputForEnv()) + debugLog.Output(3, fmt.Sprint(v...)) +} + +// Debugln logs v appending a new line if debug mode is set +func Debugln(v ...interface{}) { + debugLog.SetOutput(getOutputForEnv()) + debugLog.Output(3, fmt.Sprintln(v...)) +} + +// IfDebug executes closure if debug is enabled +func IfDebug(fn func()) { + if isDebugLogEnabled { + fn() + } +} + +// Logln logs v appending a new line at the end +func Logln(v ...interface{}) { + mainLog.Output(3, fmt.Sprintln(v...)) +} + +// Logf logs v with the provided format +func Logf(format string, v ...interface{}) { + mainLog.Output(3, fmt.Sprintf(format, v...)) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/common/version.go b/vendor/github.com/oracle/oci-go-sdk/common/version.go new file mode 100644 index 0000000000..be610d1704 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/common/version.go @@ -0,0 +1,36 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated by go generate; DO NOT EDIT + +package common + +import ( + "bytes" + "fmt" + "sync" +) + +const ( + major = "1" + minor = "0" + patch = "0" + tag = "" +) + +var once sync.Once +var version string + +// Version returns semantic version of the sdk +func Version() string { + once.Do(func() { + ver := fmt.Sprintf("%s.%s.%s", major, minor, patch) + verBuilder := bytes.NewBufferString(ver) + if tag != "" && tag != "-" { + _, err := verBuilder.WriteString(tag) + if err == nil { + verBuilder = bytes.NewBufferString(ver) + } + } + version = verBuilder.String() + }) + return version +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/attach_boot_volume_details.go b/vendor/github.com/oracle/oci-go-sdk/core/attach_boot_volume_details.go new file mode 100644 index 0000000000..7dc403a4c0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/attach_boot_volume_details.go @@ -0,0 +1,30 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// AttachBootVolumeDetails The representation of AttachBootVolumeDetails +type AttachBootVolumeDetails struct { + + // The OCID of the boot volume. + BootVolumeId *string `mandatory:"true" json:"bootVolumeId"` + + // The OCID of the instance. + InstanceId *string `mandatory:"true" json:"instanceId"` + + // A user-friendly name. Does not have to be unique, and it cannot be changed. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m AttachBootVolumeDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/attach_boot_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/attach_boot_volume_request_response.go new file mode 100644 index 0000000000..f52a019308 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/attach_boot_volume_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// AttachBootVolumeRequest wrapper for the AttachBootVolume operation +type AttachBootVolumeRequest struct { + + // Attach boot volume request + AttachBootVolumeDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request AttachBootVolumeRequest) String() string { + return common.PointerString(request) +} + +// AttachBootVolumeResponse wrapper for the AttachBootVolume operation +type AttachBootVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The BootVolumeAttachment instance + BootVolumeAttachment `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response AttachBootVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/attach_i_scsi_volume_details.go b/vendor/github.com/oracle/oci-go-sdk/core/attach_i_scsi_volume_details.go new file mode 100644 index 0000000000..827108d2ff --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/attach_i_scsi_volume_details.go @@ -0,0 +1,63 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// AttachIScsiVolumeDetails The representation of AttachIScsiVolumeDetails +type AttachIScsiVolumeDetails struct { + + // The OCID of the instance. + InstanceId *string `mandatory:"true" json:"instanceId"` + + // The OCID of the volume. + VolumeId *string `mandatory:"true" json:"volumeId"` + + // A user-friendly name. Does not have to be unique, and it cannot be changed. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // Whether to use CHAP authentication for the volume attachment. Defaults to false. + UseChap *bool `mandatory:"false" json:"useChap"` +} + +//GetDisplayName returns DisplayName +func (m AttachIScsiVolumeDetails) GetDisplayName() *string { + return m.DisplayName +} + +//GetInstanceId returns InstanceId +func (m AttachIScsiVolumeDetails) GetInstanceId() *string { + return m.InstanceId +} + +//GetVolumeId returns VolumeId +func (m AttachIScsiVolumeDetails) GetVolumeId() *string { + return m.VolumeId +} + +func (m AttachIScsiVolumeDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m AttachIScsiVolumeDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeAttachIScsiVolumeDetails AttachIScsiVolumeDetails + s := struct { + DiscriminatorParam string `json:"type"` + MarshalTypeAttachIScsiVolumeDetails + }{ + "iscsi", + (MarshalTypeAttachIScsiVolumeDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/attach_vnic_details.go b/vendor/github.com/oracle/oci-go-sdk/core/attach_vnic_details.go new file mode 100644 index 0000000000..a6e978940a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/attach_vnic_details.go @@ -0,0 +1,37 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// AttachVnicDetails The representation of AttachVnicDetails +type AttachVnicDetails struct { + + // Details for creating a new VNIC. + CreateVnicDetails *CreateVnicDetails `mandatory:"true" json:"createVnicDetails"` + + // The OCID of the instance. + InstanceId *string `mandatory:"true" json:"instanceId"` + + // A user-friendly name for the attachment. Does not have to be unique, and it cannot be changed. + DisplayName *string `mandatory:"false" json:"displayName"` + + // Which physical network interface card (NIC) the VNIC will use. Defaults to 0. + // Certain bare metal instance shapes have two active physical NICs (0 and 1). If + // you add a secondary VNIC to one of these instances, you can specify which NIC + // the VNIC will use. For more information, see + // Virtual Network Interface Cards (VNICs) (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVNICs.htm). + NicIndex *int `mandatory:"false" json:"nicIndex"` +} + +func (m AttachVnicDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/attach_vnic_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/attach_vnic_request_response.go new file mode 100644 index 0000000000..3f04c241a9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/attach_vnic_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// AttachVnicRequest wrapper for the AttachVnic operation +type AttachVnicRequest struct { + + // Attach VNIC details. + AttachVnicDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request AttachVnicRequest) String() string { + return common.PointerString(request) +} + +// AttachVnicResponse wrapper for the AttachVnic operation +type AttachVnicResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VnicAttachment instance + VnicAttachment `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response AttachVnicResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/attach_volume_details.go b/vendor/github.com/oracle/oci-go-sdk/core/attach_volume_details.go new file mode 100644 index 0000000000..414fc9c3ab --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/attach_volume_details.go @@ -0,0 +1,86 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// AttachVolumeDetails The representation of AttachVolumeDetails +type AttachVolumeDetails interface { + + // The OCID of the instance. + GetInstanceId() *string + + // The OCID of the volume. + GetVolumeId() *string + + // A user-friendly name. Does not have to be unique, and it cannot be changed. Avoid entering confidential information. + GetDisplayName() *string +} + +type attachvolumedetails struct { + JsonData []byte + InstanceId *string `mandatory:"true" json:"instanceId"` + VolumeId *string `mandatory:"true" json:"volumeId"` + DisplayName *string `mandatory:"false" json:"displayName"` + Type string `json:"type"` +} + +// UnmarshalJSON unmarshals json +func (m *attachvolumedetails) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerattachvolumedetails attachvolumedetails + s := struct { + Model Unmarshalerattachvolumedetails + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.InstanceId = s.Model.InstanceId + m.VolumeId = s.Model.VolumeId + m.DisplayName = s.Model.DisplayName + m.Type = s.Model.Type + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *attachvolumedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.Type { + case "iscsi": + mm := AttachIScsiVolumeDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +//GetInstanceId returns InstanceId +func (m attachvolumedetails) GetInstanceId() *string { + return m.InstanceId +} + +//GetVolumeId returns VolumeId +func (m attachvolumedetails) GetVolumeId() *string { + return m.VolumeId +} + +//GetDisplayName returns DisplayName +func (m attachvolumedetails) GetDisplayName() *string { + return m.DisplayName +} + +func (m attachvolumedetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/attach_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/attach_volume_request_response.go new file mode 100644 index 0000000000..d2f7076f86 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/attach_volume_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// AttachVolumeRequest wrapper for the AttachVolume operation +type AttachVolumeRequest struct { + + // Attach volume request + AttachVolumeDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request AttachVolumeRequest) String() string { + return common.PointerString(request) +} + +// AttachVolumeResponse wrapper for the AttachVolume operation +type AttachVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VolumeAttachment instance + VolumeAttachment `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response AttachVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/boot_volume.go b/vendor/github.com/oracle/oci-go-sdk/core/boot_volume.go new file mode 100644 index 0000000000..1f57aca45b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/boot_volume.go @@ -0,0 +1,86 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BootVolume A detachable boot volume device that contains the image used to boot an Compute instance. For more information, see +// Overview of Boot Volumes (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/bootvolumes.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type BootVolume struct { + + // The Availability Domain of the boot volume. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment that contains the boot volume. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The boot volume's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The current state of a boot volume. + LifecycleState BootVolumeLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The size of the volume in MBs. The value must be a multiple of 1024. + // This field is deprecated. Please use sizeInGBs. + SizeInMBs *int `mandatory:"true" json:"sizeInMBs"` + + // The date and time the boot volume was created. Format defined by RFC3339. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The image OCID used to create the boot volume. + ImageId *string `mandatory:"false" json:"imageId"` + + // The size of the boot volume in GBs. + SizeInGBs *int `mandatory:"false" json:"sizeInGBs"` +} + +func (m BootVolume) String() string { + return common.PointerString(m) +} + +// BootVolumeLifecycleStateEnum Enum with underlying type: string +type BootVolumeLifecycleStateEnum string + +// Set of constants representing the allowable values for BootVolumeLifecycleState +const ( + BootVolumeLifecycleStateProvisioning BootVolumeLifecycleStateEnum = "PROVISIONING" + BootVolumeLifecycleStateRestoring BootVolumeLifecycleStateEnum = "RESTORING" + BootVolumeLifecycleStateAvailable BootVolumeLifecycleStateEnum = "AVAILABLE" + BootVolumeLifecycleStateTerminating BootVolumeLifecycleStateEnum = "TERMINATING" + BootVolumeLifecycleStateTerminated BootVolumeLifecycleStateEnum = "TERMINATED" + BootVolumeLifecycleStateFaulty BootVolumeLifecycleStateEnum = "FAULTY" +) + +var mappingBootVolumeLifecycleState = map[string]BootVolumeLifecycleStateEnum{ + "PROVISIONING": BootVolumeLifecycleStateProvisioning, + "RESTORING": BootVolumeLifecycleStateRestoring, + "AVAILABLE": BootVolumeLifecycleStateAvailable, + "TERMINATING": BootVolumeLifecycleStateTerminating, + "TERMINATED": BootVolumeLifecycleStateTerminated, + "FAULTY": BootVolumeLifecycleStateFaulty, +} + +// GetBootVolumeLifecycleStateEnumValues Enumerates the set of values for BootVolumeLifecycleState +func GetBootVolumeLifecycleStateEnumValues() []BootVolumeLifecycleStateEnum { + values := make([]BootVolumeLifecycleStateEnum, 0) + for _, v := range mappingBootVolumeLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/boot_volume_attachment.go b/vendor/github.com/oracle/oci-go-sdk/core/boot_volume_attachment.go new file mode 100644 index 0000000000..2c24059fc3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/boot_volume_attachment.go @@ -0,0 +1,76 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BootVolumeAttachment Represents an attachment between a boot volume and an instance. +type BootVolumeAttachment struct { + + // The Availability Domain of an instance. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the boot volume. + BootVolumeId *string `mandatory:"true" json:"bootVolumeId"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the boot volume attachment. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the instance the boot volume is attached to. + InstanceId *string `mandatory:"true" json:"instanceId"` + + // The current state of the boot volume attachment. + LifecycleState BootVolumeAttachmentLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The date and time the boot volume was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // A user-friendly name. Does not have to be unique, and it cannot be changed. + // Avoid entering confidential information. + // Example: `My boot volume` + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m BootVolumeAttachment) String() string { + return common.PointerString(m) +} + +// BootVolumeAttachmentLifecycleStateEnum Enum with underlying type: string +type BootVolumeAttachmentLifecycleStateEnum string + +// Set of constants representing the allowable values for BootVolumeAttachmentLifecycleState +const ( + BootVolumeAttachmentLifecycleStateAttaching BootVolumeAttachmentLifecycleStateEnum = "ATTACHING" + BootVolumeAttachmentLifecycleStateAttached BootVolumeAttachmentLifecycleStateEnum = "ATTACHED" + BootVolumeAttachmentLifecycleStateDetaching BootVolumeAttachmentLifecycleStateEnum = "DETACHING" + BootVolumeAttachmentLifecycleStateDetached BootVolumeAttachmentLifecycleStateEnum = "DETACHED" +) + +var mappingBootVolumeAttachmentLifecycleState = map[string]BootVolumeAttachmentLifecycleStateEnum{ + "ATTACHING": BootVolumeAttachmentLifecycleStateAttaching, + "ATTACHED": BootVolumeAttachmentLifecycleStateAttached, + "DETACHING": BootVolumeAttachmentLifecycleStateDetaching, + "DETACHED": BootVolumeAttachmentLifecycleStateDetached, +} + +// GetBootVolumeAttachmentLifecycleStateEnumValues Enumerates the set of values for BootVolumeAttachmentLifecycleState +func GetBootVolumeAttachmentLifecycleStateEnumValues() []BootVolumeAttachmentLifecycleStateEnum { + values := make([]BootVolumeAttachmentLifecycleStateEnum, 0) + for _, v := range mappingBootVolumeAttachmentLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/bulk_add_virtual_circuit_public_prefixes_details.go b/vendor/github.com/oracle/oci-go-sdk/core/bulk_add_virtual_circuit_public_prefixes_details.go new file mode 100644 index 0000000000..bf8afbbf20 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/bulk_add_virtual_circuit_public_prefixes_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BulkAddVirtualCircuitPublicPrefixesDetails The representation of BulkAddVirtualCircuitPublicPrefixesDetails +type BulkAddVirtualCircuitPublicPrefixesDetails struct { + + // The public IP prefixes (CIDRs) to add to the public virtual circuit. + PublicPrefixes []CreateVirtualCircuitPublicPrefixDetails `mandatory:"true" json:"publicPrefixes"` +} + +func (m BulkAddVirtualCircuitPublicPrefixesDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/bulk_add_virtual_circuit_public_prefixes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/bulk_add_virtual_circuit_public_prefixes_request_response.go new file mode 100644 index 0000000000..749adc891b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/bulk_add_virtual_circuit_public_prefixes_request_response.go @@ -0,0 +1,34 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// BulkAddVirtualCircuitPublicPrefixesRequest wrapper for the BulkAddVirtualCircuitPublicPrefixes operation +type BulkAddVirtualCircuitPublicPrefixesRequest struct { + + // The OCID of the virtual circuit. + VirtualCircuitId *string `mandatory:"true" contributesTo:"path" name:"virtualCircuitId"` + + // Request with publix prefixes to be added to the virtual circuit + BulkAddVirtualCircuitPublicPrefixesDetails `contributesTo:"body"` +} + +func (request BulkAddVirtualCircuitPublicPrefixesRequest) String() string { + return common.PointerString(request) +} + +// BulkAddVirtualCircuitPublicPrefixesResponse wrapper for the BulkAddVirtualCircuitPublicPrefixes operation +type BulkAddVirtualCircuitPublicPrefixesResponse struct { + + // The underlying http response + RawResponse *http.Response +} + +func (response BulkAddVirtualCircuitPublicPrefixesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/bulk_delete_virtual_circuit_public_prefixes_details.go b/vendor/github.com/oracle/oci-go-sdk/core/bulk_delete_virtual_circuit_public_prefixes_details.go new file mode 100644 index 0000000000..031eea71b9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/bulk_delete_virtual_circuit_public_prefixes_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BulkDeleteVirtualCircuitPublicPrefixesDetails The representation of BulkDeleteVirtualCircuitPublicPrefixesDetails +type BulkDeleteVirtualCircuitPublicPrefixesDetails struct { + + // The public IP prefixes (CIDRs) to remove from the public virtual circuit. + PublicPrefixes []DeleteVirtualCircuitPublicPrefixDetails `mandatory:"true" json:"publicPrefixes"` +} + +func (m BulkDeleteVirtualCircuitPublicPrefixesDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/bulk_delete_virtual_circuit_public_prefixes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/bulk_delete_virtual_circuit_public_prefixes_request_response.go new file mode 100644 index 0000000000..a57afa64e9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/bulk_delete_virtual_circuit_public_prefixes_request_response.go @@ -0,0 +1,34 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// BulkDeleteVirtualCircuitPublicPrefixesRequest wrapper for the BulkDeleteVirtualCircuitPublicPrefixes operation +type BulkDeleteVirtualCircuitPublicPrefixesRequest struct { + + // The OCID of the virtual circuit. + VirtualCircuitId *string `mandatory:"true" contributesTo:"path" name:"virtualCircuitId"` + + // Request with publix prefixes to be deleted from the virtual circuit + BulkDeleteVirtualCircuitPublicPrefixesDetails `contributesTo:"body"` +} + +func (request BulkDeleteVirtualCircuitPublicPrefixesRequest) String() string { + return common.PointerString(request) +} + +// BulkDeleteVirtualCircuitPublicPrefixesResponse wrapper for the BulkDeleteVirtualCircuitPublicPrefixes operation +type BulkDeleteVirtualCircuitPublicPrefixesResponse struct { + + // The underlying http response + RawResponse *http.Response +} + +func (response BulkDeleteVirtualCircuitPublicPrefixesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/capture_console_history_details.go b/vendor/github.com/oracle/oci-go-sdk/core/capture_console_history_details.go new file mode 100644 index 0000000000..9fb153ec63 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/capture_console_history_details.go @@ -0,0 +1,27 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CaptureConsoleHistoryDetails The representation of CaptureConsoleHistoryDetails +type CaptureConsoleHistoryDetails struct { + + // The OCID of the instance to get the console history from. + InstanceId *string `mandatory:"true" json:"instanceId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CaptureConsoleHistoryDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/capture_console_history_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/capture_console_history_request_response.go new file mode 100644 index 0000000000..8e2919b703 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/capture_console_history_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CaptureConsoleHistoryRequest wrapper for the CaptureConsoleHistory operation +type CaptureConsoleHistoryRequest struct { + + // Console history details + CaptureConsoleHistoryDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CaptureConsoleHistoryRequest) String() string { + return common.PointerString(request) +} + +// CaptureConsoleHistoryResponse wrapper for the CaptureConsoleHistory operation +type CaptureConsoleHistoryResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The ConsoleHistory instance + ConsoleHistory `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CaptureConsoleHistoryResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/connect_local_peering_gateways_details.go b/vendor/github.com/oracle/oci-go-sdk/core/connect_local_peering_gateways_details.go new file mode 100644 index 0000000000..6a2d06c2ad --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/connect_local_peering_gateways_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// ConnectLocalPeeringGatewaysDetails Information about the other local peering gateway (LPG). +type ConnectLocalPeeringGatewaysDetails struct { + + // The OCID of the LPG you want to peer with. + PeerId *string `mandatory:"true" json:"peerId"` +} + +func (m ConnectLocalPeeringGatewaysDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/connect_local_peering_gateways_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/connect_local_peering_gateways_request_response.go new file mode 100644 index 0000000000..084abbe5d1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/connect_local_peering_gateways_request_response.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ConnectLocalPeeringGatewaysRequest wrapper for the ConnectLocalPeeringGateways operation +type ConnectLocalPeeringGatewaysRequest struct { + + // The OCID of the local peering gateway. + LocalPeeringGatewayId *string `mandatory:"true" contributesTo:"path" name:"localPeeringGatewayId"` + + // Details regarding the local peering gateway to connect. + ConnectLocalPeeringGatewaysDetails `contributesTo:"body"` +} + +func (request ConnectLocalPeeringGatewaysRequest) String() string { + return common.PointerString(request) +} + +// ConnectLocalPeeringGatewaysResponse wrapper for the ConnectLocalPeeringGateways operation +type ConnectLocalPeeringGatewaysResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ConnectLocalPeeringGatewaysResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/console_history.go b/vendor/github.com/oracle/oci-go-sdk/core/console_history.go new file mode 100644 index 0000000000..27b9d760a1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/console_history.go @@ -0,0 +1,75 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// ConsoleHistory An instance's serial console data. It includes configuration messages that occur when the +// instance boots, such as kernel and BIOS messages, and is useful for checking the status of +// the instance or diagnosing problems. The console data is minimally formatted ASCII text. +type ConsoleHistory struct { + + // The Availability Domain of an instance. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the console history metadata object. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the instance this console history was fetched from. + InstanceId *string `mandatory:"true" json:"instanceId"` + + // The current state of the console history. + LifecycleState ConsoleHistoryLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The date and time the history was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + // Example: `My console history metadata` + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m ConsoleHistory) String() string { + return common.PointerString(m) +} + +// ConsoleHistoryLifecycleStateEnum Enum with underlying type: string +type ConsoleHistoryLifecycleStateEnum string + +// Set of constants representing the allowable values for ConsoleHistoryLifecycleState +const ( + ConsoleHistoryLifecycleStateRequested ConsoleHistoryLifecycleStateEnum = "REQUESTED" + ConsoleHistoryLifecycleStateGettingHistory ConsoleHistoryLifecycleStateEnum = "GETTING-HISTORY" + ConsoleHistoryLifecycleStateSucceeded ConsoleHistoryLifecycleStateEnum = "SUCCEEDED" + ConsoleHistoryLifecycleStateFailed ConsoleHistoryLifecycleStateEnum = "FAILED" +) + +var mappingConsoleHistoryLifecycleState = map[string]ConsoleHistoryLifecycleStateEnum{ + "REQUESTED": ConsoleHistoryLifecycleStateRequested, + "GETTING-HISTORY": ConsoleHistoryLifecycleStateGettingHistory, + "SUCCEEDED": ConsoleHistoryLifecycleStateSucceeded, + "FAILED": ConsoleHistoryLifecycleStateFailed, +} + +// GetConsoleHistoryLifecycleStateEnumValues Enumerates the set of values for ConsoleHistoryLifecycleState +func GetConsoleHistoryLifecycleStateEnumValues() []ConsoleHistoryLifecycleStateEnum { + values := make([]ConsoleHistoryLifecycleStateEnum, 0) + for _, v := range mappingConsoleHistoryLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/core_blockstorage_client.go b/vendor/github.com/oracle/oci-go-sdk/core/core_blockstorage_client.go new file mode 100644 index 0000000000..4b49fcaff8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/core_blockstorage_client.go @@ -0,0 +1,334 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +//BlockstorageClient a client for Blockstorage +type BlockstorageClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewBlockstorageClientWithConfigurationProvider Creates a new default Blockstorage client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewBlockstorageClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client BlockstorageClient, err error) { + baseClient, err := common.NewClientWithConfig(configProvider) + if err != nil { + return + } + + client = BlockstorageClient{BaseClient: baseClient} + client.BasePath = "20160918" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *BlockstorageClient) SetRegion(region string) { + client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "iaas", region) +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *BlockstorageClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.config = &configProvider + client.SetRegion(region) + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *BlockstorageClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// CreateVolume Creates a new volume in the specified compartment. Volumes can be created in sizes ranging from +// 50 GB (51200 MB) to 16 TB (16777216 MB), in 1 GB (1024 MB) increments. By default, volumes are 1 TB (1048576 MB). +// For general information about block volumes, see +// Overview of Block Volume Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/overview.htm). +// A volume and instance can be in separate compartments but must be in the same Availability Domain. +// For information about access control and compartments, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). For information about +// Availability Domains, see Regions and Availability Domains (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). +// To get a list of Availability Domains, use the `ListAvailabilityDomains` operation +// in the Identity and Access Management Service API. +// You may optionally specify a *display name* for the volume, which is simply a friendly name or +// description. It does not have to be unique, and you can change it. Avoid entering confidential information. +func (client BlockstorageClient) CreateVolume(ctx context.Context, request CreateVolumeRequest) (response CreateVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/volumes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateVolumeBackup Creates a new backup of the specified volume. For general information about volume backups, +// see Overview of Block Volume Service Backups (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/blockvolumebackups.htm) +// When the request is received, the backup object is in a REQUEST_RECEIVED state. +// When the data is imaged, it goes into a CREATING state. +// After the backup is fully uploaded to the cloud, it goes into an AVAILABLE state. +func (client BlockstorageClient) CreateVolumeBackup(ctx context.Context, request CreateVolumeBackupRequest) (response CreateVolumeBackupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/volumeBackups", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteBootVolume Deletes the specified boot volume. The volume cannot have an active connection to an instance. +// To disconnect the boot volume from a connected instance, see +// Disconnecting From a Boot Volume (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/deletingbootvolume.htm). +// **Warning:** All data on the boot volume will be permanently lost when the boot volume is deleted. +func (client BlockstorageClient) DeleteBootVolume(ctx context.Context, request DeleteBootVolumeRequest) (response DeleteBootVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/bootVolumes/{bootVolumeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteVolume Deletes the specified volume. The volume cannot have an active connection to an instance. +// To disconnect the volume from a connected instance, see +// Disconnecting From a Volume (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/disconnectingfromavolume.htm). +// **Warning:** All data on the volume will be permanently lost when the volume is deleted. +func (client BlockstorageClient) DeleteVolume(ctx context.Context, request DeleteVolumeRequest) (response DeleteVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/volumes/{volumeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteVolumeBackup Deletes a volume backup. +func (client BlockstorageClient) DeleteVolumeBackup(ctx context.Context, request DeleteVolumeBackupRequest) (response DeleteVolumeBackupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/volumeBackups/{volumeBackupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetBootVolume Gets information for the specified boot volume. +func (client BlockstorageClient) GetBootVolume(ctx context.Context, request GetBootVolumeRequest) (response GetBootVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/bootVolumes/{bootVolumeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetVolume Gets information for the specified volume. +func (client BlockstorageClient) GetVolume(ctx context.Context, request GetVolumeRequest) (response GetVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/volumes/{volumeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetVolumeBackup Gets information for the specified volume backup. +func (client BlockstorageClient) GetVolumeBackup(ctx context.Context, request GetVolumeBackupRequest) (response GetVolumeBackupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/volumeBackups/{volumeBackupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListBootVolumes Lists the boot volumes in the specified compartment and Availability Domain. +func (client BlockstorageClient) ListBootVolumes(ctx context.Context, request ListBootVolumesRequest) (response ListBootVolumesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/bootVolumes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListVolumeBackups Lists the volume backups in the specified compartment. You can filter the results by volume. +func (client BlockstorageClient) ListVolumeBackups(ctx context.Context, request ListVolumeBackupsRequest) (response ListVolumeBackupsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/volumeBackups", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListVolumes Lists the volumes in the specified compartment and Availability Domain. +func (client BlockstorageClient) ListVolumes(ctx context.Context, request ListVolumesRequest) (response ListVolumesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/volumes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateBootVolume Updates the specified boot volume's display name. +func (client BlockstorageClient) UpdateBootVolume(ctx context.Context, request UpdateBootVolumeRequest) (response UpdateBootVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/bootVolumes/{bootVolumeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateVolume Updates the specified volume's display name. +// Avoid entering confidential information. +func (client BlockstorageClient) UpdateVolume(ctx context.Context, request UpdateVolumeRequest) (response UpdateVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/volumes/{volumeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateVolumeBackup Updates the display name for the specified volume backup. +// Avoid entering confidential information. +func (client BlockstorageClient) UpdateVolumeBackup(ctx context.Context, request UpdateVolumeBackupRequest) (response UpdateVolumeBackupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/volumeBackups/{volumeBackupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/core_compute_client.go b/vendor/github.com/oracle/oci-go-sdk/core/core_compute_client.go new file mode 100644 index 0000000000..34b17d7b9e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/core_compute_client.go @@ -0,0 +1,833 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +//ComputeClient a client for Compute +type ComputeClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewComputeClientWithConfigurationProvider Creates a new default Compute client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewComputeClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client ComputeClient, err error) { + baseClient, err := common.NewClientWithConfig(configProvider) + if err != nil { + return + } + + client = ComputeClient{BaseClient: baseClient} + client.BasePath = "20160918" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *ComputeClient) SetRegion(region string) { + client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "iaas", region) +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *ComputeClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.config = &configProvider + client.SetRegion(region) + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *ComputeClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// AttachBootVolume Attaches the specified boot volume to the specified instance. +func (client ComputeClient) AttachBootVolume(ctx context.Context, request AttachBootVolumeRequest) (response AttachBootVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/bootVolumeAttachments/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// AttachVnic Creates a secondary VNIC and attaches it to the specified instance. +// For more information about secondary VNICs, see +// Virtual Network Interface Cards (VNICs) (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVNICs.htm). +func (client ComputeClient) AttachVnic(ctx context.Context, request AttachVnicRequest) (response AttachVnicResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/vnicAttachments/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// AttachVolume Attaches the specified storage volume to the specified instance. +func (client ComputeClient) AttachVolume(ctx context.Context, request AttachVolumeRequest) (response AttachVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/volumeAttachments/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &volumeattachment{}) + return +} + +// CaptureConsoleHistory Captures the most recent serial console data (up to a megabyte) for the +// specified instance. +// The `CaptureConsoleHistory` operation works with the other console history operations +// as described below. +// 1. Use `CaptureConsoleHistory` to request the capture of up to a megabyte of the +// most recent console history. This call returns a `ConsoleHistory` +// object. The object will have a state of REQUESTED. +// 2. Wait for the capture operation to succeed by polling `GetConsoleHistory` with +// the identifier of the console history metadata. The state of the +// `ConsoleHistory` object will go from REQUESTED to GETTING-HISTORY and +// then SUCCEEDED (or FAILED). +// 3. Use `GetConsoleHistoryContent` to get the actual console history data (not the +// metadata). +// 4. Optionally, use `DeleteConsoleHistory` to delete the console history metadata +// and the console history data. +func (client ComputeClient) CaptureConsoleHistory(ctx context.Context, request CaptureConsoleHistoryRequest) (response CaptureConsoleHistoryResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/instanceConsoleHistories/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateImage Creates a boot disk image for the specified instance or imports an exported image from the Oracle Cloud Infrastructure Object Storage service. +// When creating a new image, you must provide the OCID of the instance you want to use as the basis for the image, and +// the OCID of the compartment containing that instance. For more information about images, +// see Managing Custom Images (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm). +// When importing an exported image from Object Storage, you specify the source information +// in ImageSourceDetails. +// When importing an image based on the namespace, bucket name, and object name, +// use ImageSourceViaObjectStorageTupleDetails. +// When importing an image based on the Object Storage URL, use +// ImageSourceViaObjectStorageUriDetails. +// See Object Storage URLs (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/imageimportexport.htm#URLs) and pre-authenticated requests (https://docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/managingaccess.htm#pre-auth) +// for constructing URLs for image import/export. +// For more information about importing exported images, see +// Image Import/Export (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/imageimportexport.htm). +// You may optionally specify a *display name* for the image, which is simply a friendly name or description. +// It does not have to be unique, and you can change it. See UpdateImage. +// Avoid entering confidential information. +func (client ComputeClient) CreateImage(ctx context.Context, request CreateImageRequest) (response CreateImageResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/images/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateInstanceConsoleConnection Creates a new console connection to the specified instance. +// Once the console connection has been created and is available, +// you connect to the console using SSH. +// For more information about console access, see Accessing the Console (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/serialconsole.htm). +func (client ComputeClient) CreateInstanceConsoleConnection(ctx context.Context, request CreateInstanceConsoleConnectionRequest) (response CreateInstanceConsoleConnectionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/instanceConsoleConnections", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteConsoleHistory Deletes the specified console history metadata and the console history data. +func (client ComputeClient) DeleteConsoleHistory(ctx context.Context, request DeleteConsoleHistoryRequest) (response DeleteConsoleHistoryResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/instanceConsoleHistories/{instanceConsoleHistoryId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteImage Deletes an image. +func (client ComputeClient) DeleteImage(ctx context.Context, request DeleteImageRequest) (response DeleteImageResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/images/{imageId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteInstanceConsoleConnection Deletes the specified instance console connection. +func (client ComputeClient) DeleteInstanceConsoleConnection(ctx context.Context, request DeleteInstanceConsoleConnectionRequest) (response DeleteInstanceConsoleConnectionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/instanceConsoleConnections/{instanceConsoleConnectionId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DetachBootVolume Detaches a boot volume from an instance. You must specify the OCID of the boot volume attachment. +// This is an asynchronous operation. The attachment's `lifecycleState` will change to DETACHING temporarily +// until the attachment is completely removed. +func (client ComputeClient) DetachBootVolume(ctx context.Context, request DetachBootVolumeRequest) (response DetachBootVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/bootVolumeAttachments/{bootVolumeAttachmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DetachVnic Detaches and deletes the specified secondary VNIC. +// This operation cannot be used on the instance's primary VNIC. +// When you terminate an instance, all attached VNICs (primary +// and secondary) are automatically detached and deleted. +// **Important:** If the VNIC has a +// PrivateIp that is the +// target of a route rule (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm#privateip), +// deleting the VNIC causes that route rule to blackhole and the traffic +// will be dropped. +func (client ComputeClient) DetachVnic(ctx context.Context, request DetachVnicRequest) (response DetachVnicResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/vnicAttachments/{vnicAttachmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DetachVolume Detaches a storage volume from an instance. You must specify the OCID of the volume attachment. +// This is an asynchronous operation. The attachment's `lifecycleState` will change to DETACHING temporarily +// until the attachment is completely removed. +func (client ComputeClient) DetachVolume(ctx context.Context, request DetachVolumeRequest) (response DetachVolumeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/volumeAttachments/{volumeAttachmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ExportImage Exports the specified image to the Oracle Cloud Infrastructure Object Storage service. You can use the Object Storage URL, +// or the namespace, bucket name, and object name when specifying the location to export to. +// For more information about exporting images, see Image Import/Export (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/imageimportexport.htm). +// To perform an image export, you need write access to the Object Storage bucket for the image, +// see Let Users Write Objects to Object Storage Buckets (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/commonpolicies.htm#Let4). +// See Object Storage URLs (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/imageimportexport.htm#URLs) and pre-authenticated requests (https://docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/managingaccess.htm#pre-auth) +// for constructing URLs for image import/export. +func (client ComputeClient) ExportImage(ctx context.Context, request ExportImageRequest) (response ExportImageResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/images/{imageId}/actions/export", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetBootVolumeAttachment Gets information about the specified boot volume attachment. +func (client ComputeClient) GetBootVolumeAttachment(ctx context.Context, request GetBootVolumeAttachmentRequest) (response GetBootVolumeAttachmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/bootVolumeAttachments/{bootVolumeAttachmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetConsoleHistory Shows the metadata for the specified console history. +// See CaptureConsoleHistory +// for details about using the console history operations. +func (client ComputeClient) GetConsoleHistory(ctx context.Context, request GetConsoleHistoryRequest) (response GetConsoleHistoryResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/instanceConsoleHistories/{instanceConsoleHistoryId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetConsoleHistoryContent Gets the actual console history data (not the metadata). +// See CaptureConsoleHistory +// for details about using the console history operations. +func (client ComputeClient) GetConsoleHistoryContent(ctx context.Context, request GetConsoleHistoryContentRequest) (response GetConsoleHistoryContentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/instanceConsoleHistories/{instanceConsoleHistoryId}/data", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetImage Gets the specified image. +func (client ComputeClient) GetImage(ctx context.Context, request GetImageRequest) (response GetImageResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/images/{imageId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetInstance Gets information about the specified instance. +func (client ComputeClient) GetInstance(ctx context.Context, request GetInstanceRequest) (response GetInstanceResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/instances/{instanceId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetInstanceConsoleConnection Gets the specified instance console connection's information. +func (client ComputeClient) GetInstanceConsoleConnection(ctx context.Context, request GetInstanceConsoleConnectionRequest) (response GetInstanceConsoleConnectionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/instanceConsoleConnections/{instanceConsoleConnectionId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetVnicAttachment Gets the information for the specified VNIC attachment. +func (client ComputeClient) GetVnicAttachment(ctx context.Context, request GetVnicAttachmentRequest) (response GetVnicAttachmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/vnicAttachments/{vnicAttachmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetVolumeAttachment Gets information about the specified volume attachment. +func (client ComputeClient) GetVolumeAttachment(ctx context.Context, request GetVolumeAttachmentRequest) (response GetVolumeAttachmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/volumeAttachments/{volumeAttachmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &volumeattachment{}) + return +} + +// GetWindowsInstanceInitialCredentials Gets the generated credentials for the instance. Only works for Windows instances. The returned credentials +// are only valid for the initial login. +func (client ComputeClient) GetWindowsInstanceInitialCredentials(ctx context.Context, request GetWindowsInstanceInitialCredentialsRequest) (response GetWindowsInstanceInitialCredentialsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/instances/{instanceId}/initialCredentials", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// InstanceAction Performs one of the power actions (start, stop, softreset, or reset) +// on the specified instance. +// **start** - power on +// **stop** - power off +// **softreset** - ACPI shutdown and power on +// **reset** - power off and power on +// Note that the **stop** state has no effect on the resources you consume. +// Billing continues for instances that you stop, and related resources continue +// to apply against any relevant quotas. You must terminate an instance +// (TerminateInstance) +// to remove its resources from billing and quotas. +func (client ComputeClient) InstanceAction(ctx context.Context, request InstanceActionRequest) (response InstanceActionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/instances/{instanceId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// LaunchInstance Creates a new instance in the specified compartment and the specified Availability Domain. +// For general information about instances, see +// Overview of the Compute Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Concepts/computeoverview.htm). +// For information about access control and compartments, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// For information about Availability Domains, see +// Regions and Availability Domains (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). +// To get a list of Availability Domains, use the `ListAvailabilityDomains` operation +// in the Identity and Access Management Service API. +// All Oracle Cloud Infrastructure resources, including instances, get an Oracle-assigned, +// unique ID called an Oracle Cloud Identifier (OCID). +// When you create a resource, you can find its OCID in the response. You can +// also retrieve a resource's OCID by using a List API operation +// on that resource type, or by viewing the resource in the Console. +// When you launch an instance, it is automatically attached to a virtual +// network interface card (VNIC), called the *primary VNIC*. The VNIC +// has a private IP address from the subnet's CIDR. You can either assign a +// private IP address of your choice or let Oracle automatically assign one. +// You can choose whether the instance has a public IP address. To retrieve the +// addresses, use the ListVnicAttachments +// operation to get the VNIC ID for the instance, and then call +// GetVnic with the VNIC ID. +// You can later add secondary VNICs to an instance. For more information, see +// Virtual Network Interface Cards (VNICs) (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVNICs.htm). +func (client ComputeClient) LaunchInstance(ctx context.Context, request LaunchInstanceRequest) (response LaunchInstanceResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/instances/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListBootVolumeAttachments Lists the boot volume attachments in the specified compartment. You can filter the +// list by specifying an instance OCID, boot volume OCID, or both. +func (client ComputeClient) ListBootVolumeAttachments(ctx context.Context, request ListBootVolumeAttachmentsRequest) (response ListBootVolumeAttachmentsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/bootVolumeAttachments/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListConsoleHistories Lists the console history metadata for the specified compartment or instance. +func (client ComputeClient) ListConsoleHistories(ctx context.Context, request ListConsoleHistoriesRequest) (response ListConsoleHistoriesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/instanceConsoleHistories/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListImages Lists the available images in the specified compartment. +// If you specify a value for the `sortBy` parameter, Oracle-provided images appear first in the list, followed by custom images. +// For more +// information about images, see +// Managing Custom Images (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm). +func (client ComputeClient) ListImages(ctx context.Context, request ListImagesRequest) (response ListImagesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/images/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListInstanceConsoleConnections Lists the console connections for the specified compartment or instance. +// For more information about console access, see Accessing the Instance Console (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/serialconsole.htm). +func (client ComputeClient) ListInstanceConsoleConnections(ctx context.Context, request ListInstanceConsoleConnectionsRequest) (response ListInstanceConsoleConnectionsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/instanceConsoleConnections", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListInstances Lists the instances in the specified compartment and the specified Availability Domain. +// You can filter the results by specifying an instance name (the list will include all the identically-named +// instances in the compartment). +func (client ComputeClient) ListInstances(ctx context.Context, request ListInstancesRequest) (response ListInstancesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/instances/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListShapes Lists the shapes that can be used to launch an instance within the specified compartment. You can +// filter the list by compatibility with a specific image. +func (client ComputeClient) ListShapes(ctx context.Context, request ListShapesRequest) (response ListShapesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/shapes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListVnicAttachments Lists the VNIC attachments in the specified compartment. A VNIC attachment +// resides in the same compartment as the attached instance. The list can be +// filtered by instance, VNIC, or Availability Domain. +func (client ComputeClient) ListVnicAttachments(ctx context.Context, request ListVnicAttachmentsRequest) (response ListVnicAttachmentsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/vnicAttachments/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +//listvolumeattachment allows to unmarshal list of polymorphic VolumeAttachment +type listvolumeattachment []volumeattachment + +//UnmarshalPolymorphicJSON unmarshals polymorphic json list of items +func (m *listvolumeattachment) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + res := make([]VolumeAttachment, len(*m)) + for i, v := range *m { + nn, err := v.UnmarshalPolymorphicJSON(v.JsonData) + if err != nil { + return nil, err + } + res[i] = nn.(VolumeAttachment) + } + return res, nil +} + +// ListVolumeAttachments Lists the volume attachments in the specified compartment. You can filter the +// list by specifying an instance OCID, volume OCID, or both. +// Currently, the only supported volume attachment type is IScsiVolumeAttachment. +func (client ComputeClient) ListVolumeAttachments(ctx context.Context, request ListVolumeAttachmentsRequest) (response ListVolumeAttachmentsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/volumeAttachments/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &listvolumeattachment{}) + return +} + +// TerminateInstance Terminates the specified instance. Any attached VNICs and volumes are automatically detached +// when the instance terminates. +// To preserve the boot volume associated with the instance, specify `true` for `PreserveBootVolumeQueryParam`. +// To delete the boot volume when the instance is deleted, specify `false` or do not specify a value for `PreserveBootVolumeQueryParam`. +// This is an asynchronous operation. The instance's `lifecycleState` will change to TERMINATING temporarily +// until the instance is completely removed. +func (client ComputeClient) TerminateInstance(ctx context.Context, request TerminateInstanceRequest) (response TerminateInstanceResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/instances/{instanceId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateConsoleHistory Updates the specified console history metadata. +func (client ComputeClient) UpdateConsoleHistory(ctx context.Context, request UpdateConsoleHistoryRequest) (response UpdateConsoleHistoryResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/instanceConsoleHistories/{instanceConsoleHistoryId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateImage Updates the display name of the image. Avoid entering confidential information. +func (client ComputeClient) UpdateImage(ctx context.Context, request UpdateImageRequest) (response UpdateImageResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/images/{imageId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateInstance Updates the display name of the specified instance. Avoid entering confidential information. +// The OCID of the instance remains the same. +func (client ComputeClient) UpdateInstance(ctx context.Context, request UpdateInstanceRequest) (response UpdateInstanceResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/instances/{instanceId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/core_virtualnetwork_client.go b/vendor/github.com/oracle/oci-go-sdk/core/core_virtualnetwork_client.go new file mode 100644 index 0000000000..2888effffc --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/core_virtualnetwork_client.go @@ -0,0 +1,2009 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +//VirtualNetworkClient a client for VirtualNetwork +type VirtualNetworkClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewVirtualNetworkClientWithConfigurationProvider Creates a new default VirtualNetwork client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewVirtualNetworkClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client VirtualNetworkClient, err error) { + baseClient, err := common.NewClientWithConfig(configProvider) + if err != nil { + return + } + + client = VirtualNetworkClient{BaseClient: baseClient} + client.BasePath = "20160918" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *VirtualNetworkClient) SetRegion(region string) { + client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "iaas", region) +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *VirtualNetworkClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.config = &configProvider + client.SetRegion(region) + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *VirtualNetworkClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// BulkAddVirtualCircuitPublicPrefixes Adds one or more customer public IP prefixes to the specified public virtual circuit. +// Use this operation (and not UpdateVirtualCircuit) +// to add prefixes to the virtual circuit. Oracle must verify the customer's ownership +// of each prefix before traffic for that prefix will flow across the virtual circuit. +func (client VirtualNetworkClient) BulkAddVirtualCircuitPublicPrefixes(ctx context.Context, request BulkAddVirtualCircuitPublicPrefixesRequest) (err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/virtualCircuits/{virtualCircuitId}/actions/bulkAddPublicPrefixes", request) + if err != nil { + return + } + + _, err = client.Call(ctx, &httpRequest) + return +} + +// BulkDeleteVirtualCircuitPublicPrefixes Removes one or more customer public IP prefixes from the specified public virtual circuit. +// Use this operation (and not UpdateVirtualCircuit) +// to remove prefixes from the virtual circuit. When the virtual circuit's state switches +// back to PROVISIONED, Oracle stops advertising the specified prefixes across the connection. +func (client VirtualNetworkClient) BulkDeleteVirtualCircuitPublicPrefixes(ctx context.Context, request BulkDeleteVirtualCircuitPublicPrefixesRequest) (err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/virtualCircuits/{virtualCircuitId}/actions/bulkDeletePublicPrefixes", request) + if err != nil { + return + } + + _, err = client.Call(ctx, &httpRequest) + return +} + +// ConnectLocalPeeringGateways Connects this local peering gateway (LPG) to another one in the same region. +// This operation must be called by the VCN administrator who is designated as +// the *requestor* in the peering relationship. The *acceptor* must implement +// an Identity and Access Management (IAM) policy that gives the requestor permission +// to connect to LPGs in the acceptor's compartment. Without that permission, this +// operation will fail. For more information, see +// VCN Peering (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm). +func (client VirtualNetworkClient) ConnectLocalPeeringGateways(ctx context.Context, request ConnectLocalPeeringGatewaysRequest) (response ConnectLocalPeeringGatewaysResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/localPeeringGateways/{localPeeringGatewayId}/actions/connect", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateCpe Creates a new virtual Customer-Premises Equipment (CPE) object in the specified compartment. For +// more information, see IPSec VPNs (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPsec.htm). +// For the purposes of access control, you must provide the OCID of the compartment where you want +// the CPE to reside. Notice that the CPE doesn't have to be in the same compartment as the IPSec +// connection or other Networking Service components. If you're not sure which compartment to +// use, put the CPE in the same compartment as the DRG. For more information about +// compartments and access control, see Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// For information about OCIDs, see Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You must provide the public IP address of your on-premises router. See +// Configuring Your On-Premises Router for an IPSec VPN (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/configuringCPE.htm). +// You may optionally specify a *display name* for the CPE, otherwise a default is provided. It does not have to +// be unique, and you can change it. Avoid entering confidential information. +func (client VirtualNetworkClient) CreateCpe(ctx context.Context, request CreateCpeRequest) (response CreateCpeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/cpes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateCrossConnect Creates a new cross-connect. Oracle recommends you create each cross-connect in a +// CrossConnectGroup so you can use link aggregation +// with the connection. +// After creating the `CrossConnect` object, you need to go the FastConnect location +// and request to have the physical cable installed. For more information, see +// FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +// For the purposes of access control, you must provide the OCID of the +// compartment where you want the cross-connect to reside. If you're +// not sure which compartment to use, put the cross-connect in the +// same compartment with your VCN. For more information about +// compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the cross-connect. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +func (client VirtualNetworkClient) CreateCrossConnect(ctx context.Context, request CreateCrossConnectRequest) (response CreateCrossConnectResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/crossConnects", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateCrossConnectGroup Creates a new cross-connect group to use with Oracle Cloud Infrastructure +// FastConnect. For more information, see +// FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +// For the purposes of access control, you must provide the OCID of the +// compartment where you want the cross-connect group to reside. If you're +// not sure which compartment to use, put the cross-connect group in the +// same compartment with your VCN. For more information about +// compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the cross-connect group. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +func (client VirtualNetworkClient) CreateCrossConnectGroup(ctx context.Context, request CreateCrossConnectGroupRequest) (response CreateCrossConnectGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/crossConnectGroups", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateDhcpOptions Creates a new set of DHCP options for the specified VCN. For more information, see +// DhcpOptions. +// For the purposes of access control, you must provide the OCID of the compartment where you want the set of +// DHCP options to reside. Notice that the set of options doesn't have to be in the same compartment as the VCN, +// subnets, or other Networking Service components. If you're not sure which compartment to use, put the set +// of DHCP options in the same compartment as the VCN. For more information about compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the set of DHCP options, otherwise a default is provided. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +func (client VirtualNetworkClient) CreateDhcpOptions(ctx context.Context, request CreateDhcpOptionsRequest) (response CreateDhcpOptionsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/dhcps", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateDrg Creates a new Dynamic Routing Gateway (DRG) in the specified compartment. For more information, +// see Dynamic Routing Gateways (DRGs) (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingDRGs.htm). +// For the purposes of access control, you must provide the OCID of the compartment where you want +// the DRG to reside. Notice that the DRG doesn't have to be in the same compartment as the VCN, +// the DRG attachment, or other Networking Service components. If you're not sure which compartment +// to use, put the DRG in the same compartment as the VCN. For more information about compartments +// and access control, see Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// For information about OCIDs, see Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the DRG, otherwise a default is provided. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +func (client VirtualNetworkClient) CreateDrg(ctx context.Context, request CreateDrgRequest) (response CreateDrgResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/drgs", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateDrgAttachment Attaches the specified DRG to the specified VCN. A VCN can be attached to only one DRG at a time, +// and vice versa. The response includes a `DrgAttachment` object with its own OCID. For more +// information about DRGs, see +// Dynamic Routing Gateways (DRGs) (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingDRGs.htm). +// You may optionally specify a *display name* for the attachment, otherwise a default is provided. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +// For the purposes of access control, the DRG attachment is automatically placed into the same compartment +// as the VCN. For more information about compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +func (client VirtualNetworkClient) CreateDrgAttachment(ctx context.Context, request CreateDrgAttachmentRequest) (response CreateDrgAttachmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/drgAttachments", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateIPSecConnection Creates a new IPSec connection between the specified DRG and CPE. For more information, see +// IPSec VPNs (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPsec.htm). +// In the request, you must include at least one static route to the CPE object (you're allowed a maximum +// of 10). For example: 10.0.8.0/16. +// For the purposes of access control, you must provide the OCID of the compartment where you want the +// IPSec connection to reside. Notice that the IPSec connection doesn't have to be in the same compartment +// as the DRG, CPE, or other Networking Service components. If you're not sure which compartment to +// use, put the IPSec connection in the same compartment as the DRG. For more information about +// compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// For information about OCIDs, see Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the IPSec connection, otherwise a default is provided. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +// After creating the IPSec connection, you need to configure your on-premises router +// with tunnel-specific information returned by +// GetIPSecConnectionDeviceConfig. +// For each tunnel, that operation gives you the IP address of Oracle's VPN headend and the shared secret +// (that is, the pre-shared key). For more information, see +// Configuring Your On-Premises Router for an IPSec VPN (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/configuringCPE.htm). +// To get the status of the tunnels (whether they're up or down), use +// GetIPSecConnectionDeviceStatus. +func (client VirtualNetworkClient) CreateIPSecConnection(ctx context.Context, request CreateIPSecConnectionRequest) (response CreateIPSecConnectionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/ipsecConnections", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateInternetGateway Creates a new Internet Gateway for the specified VCN. For more information, see +// Connectivity to the Internet (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIGs.htm). +// For the purposes of access control, you must provide the OCID of the compartment where you want the Internet +// Gateway to reside. Notice that the Internet Gateway doesn't have to be in the same compartment as the VCN or +// other Networking Service components. If you're not sure which compartment to use, put the Internet +// Gateway in the same compartment with the VCN. For more information about compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the Internet Gateway, otherwise a default is provided. It +// does not have to be unique, and you can change it. Avoid entering confidential information. +// For traffic to flow between a subnet and an Internet Gateway, you must create a route rule accordingly in +// the subnet's route table (for example, 0.0.0.0/0 > Internet Gateway). See +// UpdateRouteTable. +// You must specify whether the Internet Gateway is enabled when you create it. If it's disabled, that means no +// traffic will flow to/from the internet even if there's a route rule that enables that traffic. You can later +// use UpdateInternetGateway to easily disable/enable +// the gateway without changing the route rule. +func (client VirtualNetworkClient) CreateInternetGateway(ctx context.Context, request CreateInternetGatewayRequest) (response CreateInternetGatewayResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/internetGateways", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateLocalPeeringGateway Creates a new local peering gateway (LPG) for the specified VCN. +func (client VirtualNetworkClient) CreateLocalPeeringGateway(ctx context.Context, request CreateLocalPeeringGatewayRequest) (response CreateLocalPeeringGatewayResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/localPeeringGateways", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreatePrivateIp Creates a secondary private IP for the specified VNIC. +// For more information about secondary private IPs, see +// IP Addresses (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPaddresses.htm). +func (client VirtualNetworkClient) CreatePrivateIp(ctx context.Context, request CreatePrivateIpRequest) (response CreatePrivateIpResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/privateIps", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateRouteTable Creates a new route table for the specified VCN. In the request you must also include at least one route +// rule for the new route table. For information on the number of rules you can have in a route table, see +// Service Limits (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/servicelimits.htm). For general information about route +// tables in your VCN and the types of targets you can use in route rules, +// see Route Tables (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm). +// For the purposes of access control, you must provide the OCID of the compartment where you want the route +// table to reside. Notice that the route table doesn't have to be in the same compartment as the VCN, subnets, +// or other Networking Service components. If you're not sure which compartment to use, put the route +// table in the same compartment as the VCN. For more information about compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the route table, otherwise a default is provided. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +func (client VirtualNetworkClient) CreateRouteTable(ctx context.Context, request CreateRouteTableRequest) (response CreateRouteTableResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/routeTables", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateSecurityList Creates a new security list for the specified VCN. For more information +// about security lists, see Security Lists (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/securitylists.htm). +// For information on the number of rules you can have in a security list, see +// Service Limits (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/servicelimits.htm). +// For the purposes of access control, you must provide the OCID of the compartment where you want the security +// list to reside. Notice that the security list doesn't have to be in the same compartment as the VCN, subnets, +// or other Networking Service components. If you're not sure which compartment to use, put the security +// list in the same compartment as the VCN. For more information about compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the security list, otherwise a default is provided. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +func (client VirtualNetworkClient) CreateSecurityList(ctx context.Context, request CreateSecurityListRequest) (response CreateSecurityListResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/securityLists", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateSubnet Creates a new subnet in the specified VCN. You can't change the size of the subnet after creation, +// so it's important to think about the size of subnets you need before creating them. +// For more information, see VCNs and Subnets (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVCNs.htm). +// For information on the number of subnets you can have in a VCN, see +// Service Limits (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/servicelimits.htm). +// For the purposes of access control, you must provide the OCID of the compartment where you want the subnet +// to reside. Notice that the subnet doesn't have to be in the same compartment as the VCN, route tables, or +// other Networking Service components. If you're not sure which compartment to use, put the subnet in +// the same compartment as the VCN. For more information about compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). For information about OCIDs, +// see Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally associate a route table with the subnet. If you don't, the subnet will use the +// VCN's default route table. For more information about route tables, see +// Route Tables (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm). +// You may optionally associate a security list with the subnet. If you don't, the subnet will use the +// VCN's default security list. For more information about security lists, see +// Security Lists (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/securitylists.htm). +// You may optionally associate a set of DHCP options with the subnet. If you don't, the subnet will use the +// VCN's default set. For more information about DHCP options, see +// DHCP Options (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingDHCP.htm). +// You may optionally specify a *display name* for the subnet, otherwise a default is provided. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +// You can also add a DNS label for the subnet, which is required if you want the Internet and +// VCN Resolver to resolve hostnames for instances in the subnet. For more information, see +// DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). +func (client VirtualNetworkClient) CreateSubnet(ctx context.Context, request CreateSubnetRequest) (response CreateSubnetResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/subnets", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateVcn Creates a new Virtual Cloud Network (VCN). For more information, see +// VCNs and Subnets (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVCNs.htm). +// For the VCN you must specify a single, contiguous IPv4 CIDR block. Oracle recommends using one of the +// private IP address ranges specified in RFC 1918 (https://tools.ietf.org/html/rfc1918) (10.0.0.0/8, +// 172.16/12, and 192.168/16). Example: 172.16.0.0/16. The CIDR block can range from /16 to /30, and it +// must not overlap with your on-premises network. You can't change the size of the VCN after creation. +// For the purposes of access control, you must provide the OCID of the compartment where you want the VCN to +// reside. Consult an Oracle Cloud Infrastructure administrator in your organization if you're not sure which +// compartment to use. Notice that the VCN doesn't have to be in the same compartment as the subnets or other +// Networking Service components. For more information about compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the VCN, otherwise a default is provided. It does not have to +// be unique, and you can change it. Avoid entering confidential information. +// You can also add a DNS label for the VCN, which is required if you want the instances to use the +// Interent and VCN Resolver option for DNS in the VCN. For more information, see +// DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). +// The VCN automatically comes with a default route table, default security list, and default set of DHCP options. +// The OCID for each is returned in the response. You can't delete these default objects, but you can change their +// contents (that is, change the route rules, security list rules, and so on). +// The VCN and subnets you create are not accessible until you attach an Internet Gateway or set up an IPSec VPN +// or FastConnect. For more information, see +// Overview of the Networking Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm). +func (client VirtualNetworkClient) CreateVcn(ctx context.Context, request CreateVcnRequest) (response CreateVcnResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/vcns", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateVirtualCircuit Creates a new virtual circuit to use with Oracle Cloud +// Infrastructure FastConnect. For more information, see +// FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +// For the purposes of access control, you must provide the OCID of the +// compartment where you want the virtual circuit to reside. If you're +// not sure which compartment to use, put the virtual circuit in the +// same compartment with the DRG it's using. For more information about +// compartments and access control, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You may optionally specify a *display name* for the virtual circuit. +// It does not have to be unique, and you can change it. Avoid entering confidential information. +// **Important:** When creating a virtual circuit, you specify a DRG for +// the traffic to flow through. Make sure you attach the DRG to your +// VCN and confirm the VCN's routing sends traffic to the DRG. Otherwise +// traffic will not flow. For more information, see +// Route Tables (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm). +func (client VirtualNetworkClient) CreateVirtualCircuit(ctx context.Context, request CreateVirtualCircuitRequest) (response CreateVirtualCircuitResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/virtualCircuits", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteCpe Deletes the specified CPE object. The CPE must not be connected to a DRG. This is an asynchronous +// operation. The CPE's `lifecycleState` will change to TERMINATING temporarily until the CPE is completely +// removed. +func (client VirtualNetworkClient) DeleteCpe(ctx context.Context, request DeleteCpeRequest) (response DeleteCpeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/cpes/{cpeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteCrossConnect Deletes the specified cross-connect. It must not be mapped to a +// VirtualCircuit. +func (client VirtualNetworkClient) DeleteCrossConnect(ctx context.Context, request DeleteCrossConnectRequest) (response DeleteCrossConnectResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/crossConnects/{crossConnectId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteCrossConnectGroup Deletes the specified cross-connect group. It must not contain any +// cross-connects, and it cannot be mapped to a +// VirtualCircuit. +func (client VirtualNetworkClient) DeleteCrossConnectGroup(ctx context.Context, request DeleteCrossConnectGroupRequest) (response DeleteCrossConnectGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/crossConnectGroups/{crossConnectGroupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteDhcpOptions Deletes the specified set of DHCP options, but only if it's not associated with a subnet. You can't delete a +// VCN's default set of DHCP options. +// This is an asynchronous operation. The state of the set of options will switch to TERMINATING temporarily +// until the set is completely removed. +func (client VirtualNetworkClient) DeleteDhcpOptions(ctx context.Context, request DeleteDhcpOptionsRequest) (response DeleteDhcpOptionsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/dhcps/{dhcpId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteDrg Deletes the specified DRG. The DRG must not be attached to a VCN or be connected to your on-premise +// network. Also, there must not be a route table that lists the DRG as a target. This is an asynchronous +// operation. The DRG's `lifecycleState` will change to TERMINATING temporarily until the DRG is completely +// removed. +func (client VirtualNetworkClient) DeleteDrg(ctx context.Context, request DeleteDrgRequest) (response DeleteDrgResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/drgs/{drgId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteDrgAttachment Detaches a DRG from a VCN by deleting the corresponding `DrgAttachment`. This is an asynchronous +// operation. The attachment's `lifecycleState` will change to DETACHING temporarily until the attachment +// is completely removed. +func (client VirtualNetworkClient) DeleteDrgAttachment(ctx context.Context, request DeleteDrgAttachmentRequest) (response DeleteDrgAttachmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/drgAttachments/{drgAttachmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteIPSecConnection Deletes the specified IPSec connection. If your goal is to disable the IPSec VPN between your VCN and +// on-premises network, it's easiest to simply detach the DRG but keep all the IPSec VPN components intact. +// If you were to delete all the components and then later need to create an IPSec VPN again, you would +// need to configure your on-premises router again with the new information returned from +// CreateIPSecConnection. +// This is an asynchronous operation. The connection's `lifecycleState` will change to TERMINATING temporarily +// until the connection is completely removed. +func (client VirtualNetworkClient) DeleteIPSecConnection(ctx context.Context, request DeleteIPSecConnectionRequest) (response DeleteIPSecConnectionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/ipsecConnections/{ipscId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteInternetGateway Deletes the specified Internet Gateway. The Internet Gateway does not have to be disabled, but +// there must not be a route table that lists it as a target. +// This is an asynchronous operation. The gateway's `lifecycleState` will change to TERMINATING temporarily +// until the gateway is completely removed. +func (client VirtualNetworkClient) DeleteInternetGateway(ctx context.Context, request DeleteInternetGatewayRequest) (response DeleteInternetGatewayResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/internetGateways/{igId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteLocalPeeringGateway Deletes the specified local peering gateway (LPG). +// This is an asynchronous operation; the local peering gateway's `lifecycleState` changes to TERMINATING temporarily +// until the local peering gateway is completely removed. +func (client VirtualNetworkClient) DeleteLocalPeeringGateway(ctx context.Context, request DeleteLocalPeeringGatewayRequest) (response DeleteLocalPeeringGatewayResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/localPeeringGateways/{localPeeringGatewayId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeletePrivateIp Unassigns and deletes the specified private IP. You must +// specify the object's OCID. The private IP address is returned to +// the subnet's pool of available addresses. +// This operation cannot be used with primary private IPs, which are +// automatically unassigned and deleted when the VNIC is terminated. +// **Important:** If a secondary private IP is the +// target of a route rule (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm#privateip), +// unassigning it from the VNIC causes that route rule to blackhole and the traffic +// will be dropped. +func (client VirtualNetworkClient) DeletePrivateIp(ctx context.Context, request DeletePrivateIpRequest) (response DeletePrivateIpResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/privateIps/{privateIpId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteRouteTable Deletes the specified route table, but only if it's not associated with a subnet. You can't delete a +// VCN's default route table. +// This is an asynchronous operation. The route table's `lifecycleState` will change to TERMINATING temporarily +// until the route table is completely removed. +func (client VirtualNetworkClient) DeleteRouteTable(ctx context.Context, request DeleteRouteTableRequest) (response DeleteRouteTableResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/routeTables/{rtId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteSecurityList Deletes the specified security list, but only if it's not associated with a subnet. You can't delete +// a VCN's default security list. +// This is an asynchronous operation. The security list's `lifecycleState` will change to TERMINATING temporarily +// until the security list is completely removed. +func (client VirtualNetworkClient) DeleteSecurityList(ctx context.Context, request DeleteSecurityListRequest) (response DeleteSecurityListResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/securityLists/{securityListId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteSubnet Deletes the specified subnet, but only if there are no instances in the subnet. This is an asynchronous +// operation. The subnet's `lifecycleState` will change to TERMINATING temporarily. If there are any +// instances in the subnet, the state will instead change back to AVAILABLE. +func (client VirtualNetworkClient) DeleteSubnet(ctx context.Context, request DeleteSubnetRequest) (response DeleteSubnetResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/subnets/{subnetId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteVcn Deletes the specified VCN. The VCN must be empty and have no attached gateways. This is an asynchronous +// operation. The VCN's `lifecycleState` will change to TERMINATING temporarily until the VCN is completely +// removed. +func (client VirtualNetworkClient) DeleteVcn(ctx context.Context, request DeleteVcnRequest) (response DeleteVcnResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/vcns/{vcnId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteVirtualCircuit Deletes the specified virtual circuit. +// **Important:** If you're using FastConnect via a provider, +// make sure to also terminate the connection with +// the provider, or else the provider may continue to bill you. +func (client VirtualNetworkClient) DeleteVirtualCircuit(ctx context.Context, request DeleteVirtualCircuitRequest) (response DeleteVirtualCircuitResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/virtualCircuits/{virtualCircuitId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetCpe Gets the specified CPE's information. +func (client VirtualNetworkClient) GetCpe(ctx context.Context, request GetCpeRequest) (response GetCpeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/cpes/{cpeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetCrossConnect Gets the specified cross-connect's information. +func (client VirtualNetworkClient) GetCrossConnect(ctx context.Context, request GetCrossConnectRequest) (response GetCrossConnectResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/crossConnects/{crossConnectId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetCrossConnectGroup Gets the specified cross-connect group's information. +func (client VirtualNetworkClient) GetCrossConnectGroup(ctx context.Context, request GetCrossConnectGroupRequest) (response GetCrossConnectGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/crossConnectGroups/{crossConnectGroupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetCrossConnectLetterOfAuthority Gets the Letter of Authority for the specified cross-connect. +func (client VirtualNetworkClient) GetCrossConnectLetterOfAuthority(ctx context.Context, request GetCrossConnectLetterOfAuthorityRequest) (response GetCrossConnectLetterOfAuthorityResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/crossConnects/{crossConnectId}/letterOfAuthority", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetCrossConnectStatus Gets the status of the specified cross-connect. +func (client VirtualNetworkClient) GetCrossConnectStatus(ctx context.Context, request GetCrossConnectStatusRequest) (response GetCrossConnectStatusResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/crossConnects/{crossConnectId}/status", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDhcpOptions Gets the specified set of DHCP options. +func (client VirtualNetworkClient) GetDhcpOptions(ctx context.Context, request GetDhcpOptionsRequest) (response GetDhcpOptionsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dhcps/{dhcpId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDrg Gets the specified DRG's information. +func (client VirtualNetworkClient) GetDrg(ctx context.Context, request GetDrgRequest) (response GetDrgResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/drgs/{drgId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDrgAttachment Gets the information for the specified `DrgAttachment`. +func (client VirtualNetworkClient) GetDrgAttachment(ctx context.Context, request GetDrgAttachmentRequest) (response GetDrgAttachmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/drgAttachments/{drgAttachmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetFastConnectProviderService Gets the specified provider service. +// For more information, see FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +func (client VirtualNetworkClient) GetFastConnectProviderService(ctx context.Context, request GetFastConnectProviderServiceRequest) (response GetFastConnectProviderServiceResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/fastConnectProviderServices/{providerServiceId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetIPSecConnection Gets the specified IPSec connection's basic information, including the static routes for the +// on-premises router. If you want the status of the connection (whether it's up or down), use +// GetIPSecConnectionDeviceStatus. +func (client VirtualNetworkClient) GetIPSecConnection(ctx context.Context, request GetIPSecConnectionRequest) (response GetIPSecConnectionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/ipsecConnections/{ipscId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetIPSecConnectionDeviceConfig Gets the configuration information for the specified IPSec connection. For each tunnel, the +// response includes the IP address of Oracle's VPN headend and the shared secret. +func (client VirtualNetworkClient) GetIPSecConnectionDeviceConfig(ctx context.Context, request GetIPSecConnectionDeviceConfigRequest) (response GetIPSecConnectionDeviceConfigResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/ipsecConnections/{ipscId}/deviceConfig", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetIPSecConnectionDeviceStatus Gets the status of the specified IPSec connection (whether it's up or down). +func (client VirtualNetworkClient) GetIPSecConnectionDeviceStatus(ctx context.Context, request GetIPSecConnectionDeviceStatusRequest) (response GetIPSecConnectionDeviceStatusResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/ipsecConnections/{ipscId}/deviceStatus", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetInternetGateway Gets the specified Internet Gateway's information. +func (client VirtualNetworkClient) GetInternetGateway(ctx context.Context, request GetInternetGatewayRequest) (response GetInternetGatewayResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/internetGateways/{igId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetLocalPeeringGateway Gets the specified local peering gateway's information. +func (client VirtualNetworkClient) GetLocalPeeringGateway(ctx context.Context, request GetLocalPeeringGatewayRequest) (response GetLocalPeeringGatewayResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/localPeeringGateways/{localPeeringGatewayId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetPrivateIp Gets the specified private IP. You must specify the object's OCID. +// Alternatively, you can get the object by using +// ListPrivateIps +// with the private IP address (for example, 10.0.3.3) and subnet OCID. +func (client VirtualNetworkClient) GetPrivateIp(ctx context.Context, request GetPrivateIpRequest) (response GetPrivateIpResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/privateIps/{privateIpId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetRouteTable Gets the specified route table's information. +func (client VirtualNetworkClient) GetRouteTable(ctx context.Context, request GetRouteTableRequest) (response GetRouteTableResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/routeTables/{rtId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetSecurityList Gets the specified security list's information. +func (client VirtualNetworkClient) GetSecurityList(ctx context.Context, request GetSecurityListRequest) (response GetSecurityListResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/securityLists/{securityListId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetSubnet Gets the specified subnet's information. +func (client VirtualNetworkClient) GetSubnet(ctx context.Context, request GetSubnetRequest) (response GetSubnetResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/subnets/{subnetId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetVcn Gets the specified VCN's information. +func (client VirtualNetworkClient) GetVcn(ctx context.Context, request GetVcnRequest) (response GetVcnResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/vcns/{vcnId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetVirtualCircuit Gets the specified virtual circuit's information. +func (client VirtualNetworkClient) GetVirtualCircuit(ctx context.Context, request GetVirtualCircuitRequest) (response GetVirtualCircuitResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/virtualCircuits/{virtualCircuitId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetVnic Gets the information for the specified virtual network interface card (VNIC). +// You can get the VNIC OCID from the +// ListVnicAttachments +// operation. +func (client VirtualNetworkClient) GetVnic(ctx context.Context, request GetVnicRequest) (response GetVnicResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/vnics/{vnicId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListCpes Lists the Customer-Premises Equipment objects (CPEs) in the specified compartment. +func (client VirtualNetworkClient) ListCpes(ctx context.Context, request ListCpesRequest) (response ListCpesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/cpes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListCrossConnectGroups Lists the cross-connect groups in the specified compartment. +func (client VirtualNetworkClient) ListCrossConnectGroups(ctx context.Context, request ListCrossConnectGroupsRequest) (response ListCrossConnectGroupsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/crossConnectGroups", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListCrossConnectLocations Lists the available FastConnect locations for cross-connect installation. You need +// this information so you can specify your desired location when you create a cross-connect. +func (client VirtualNetworkClient) ListCrossConnectLocations(ctx context.Context, request ListCrossConnectLocationsRequest) (response ListCrossConnectLocationsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/crossConnectLocations", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListCrossConnects Lists the cross-connects in the specified compartment. You can filter the list +// by specifying the OCID of a cross-connect group. +func (client VirtualNetworkClient) ListCrossConnects(ctx context.Context, request ListCrossConnectsRequest) (response ListCrossConnectsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/crossConnects", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListCrossconnectPortSpeedShapes Lists the available port speeds for cross-connects. You need this information +// so you can specify your desired port speed (that is, shape) when you create a +// cross-connect. +func (client VirtualNetworkClient) ListCrossconnectPortSpeedShapes(ctx context.Context, request ListCrossconnectPortSpeedShapesRequest) (response ListCrossconnectPortSpeedShapesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/crossConnectPortSpeedShapes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDhcpOptions Lists the sets of DHCP options in the specified VCN and specified compartment. +// The response includes the default set of options that automatically comes with each VCN, +// plus any other sets you've created. +func (client VirtualNetworkClient) ListDhcpOptions(ctx context.Context, request ListDhcpOptionsRequest) (response ListDhcpOptionsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dhcps", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDrgAttachments Lists the `DrgAttachment` objects for the specified compartment. You can filter the +// results by VCN or DRG. +func (client VirtualNetworkClient) ListDrgAttachments(ctx context.Context, request ListDrgAttachmentsRequest) (response ListDrgAttachmentsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/drgAttachments", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDrgs Lists the DRGs in the specified compartment. +func (client VirtualNetworkClient) ListDrgs(ctx context.Context, request ListDrgsRequest) (response ListDrgsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/drgs", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListFastConnectProviderServices Lists the service offerings from supported providers. You need this +// information so you can specify your desired provider and service +// offering when you create a virtual circuit. +// For the compartment ID, provide the OCID of your tenancy (the root compartment). +// For more information, see FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +func (client VirtualNetworkClient) ListFastConnectProviderServices(ctx context.Context, request ListFastConnectProviderServicesRequest) (response ListFastConnectProviderServicesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/fastConnectProviderServices", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListFastConnectProviderVirtualCircuitBandwidthShapes Gets the list of available virtual circuit bandwidth levels for a provider. +// You need this information so you can specify your desired bandwidth level (shape) when you create a virtual circuit. +// For more information about virtual circuits, see FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +func (client VirtualNetworkClient) ListFastConnectProviderVirtualCircuitBandwidthShapes(ctx context.Context, request ListFastConnectProviderVirtualCircuitBandwidthShapesRequest) (response ListFastConnectProviderVirtualCircuitBandwidthShapesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/fastConnectProviderServices/{providerServiceId}/virtualCircuitBandwidthShapes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListIPSecConnections Lists the IPSec connections for the specified compartment. You can filter the +// results by DRG or CPE. +func (client VirtualNetworkClient) ListIPSecConnections(ctx context.Context, request ListIPSecConnectionsRequest) (response ListIPSecConnectionsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/ipsecConnections", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListInternetGateways Lists the Internet Gateways in the specified VCN and the specified compartment. +func (client VirtualNetworkClient) ListInternetGateways(ctx context.Context, request ListInternetGatewaysRequest) (response ListInternetGatewaysResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/internetGateways", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListLocalPeeringGateways Lists the local peering gateways (LPGs) for the specified VCN and compartment +// (the LPG's compartment). +func (client VirtualNetworkClient) ListLocalPeeringGateways(ctx context.Context, request ListLocalPeeringGatewaysRequest) (response ListLocalPeeringGatewaysResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/localPeeringGateways", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListPrivateIps Lists the PrivateIp objects based +// on one of these filters: +// - Subnet OCID. +// - VNIC OCID. +// - Both private IP address and subnet OCID: This lets +// you get a `privateIP` object based on its private IP +// address (for example, 10.0.3.3) and not its OCID. For comparison, +// GetPrivateIp +// requires the OCID. +// If you're listing all the private IPs associated with a given subnet +// or VNIC, the response includes both primary and secondary private IPs. +func (client VirtualNetworkClient) ListPrivateIps(ctx context.Context, request ListPrivateIpsRequest) (response ListPrivateIpsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/privateIps", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListRouteTables Lists the route tables in the specified VCN and specified compartment. The response +// includes the default route table that automatically comes with each VCN, plus any route tables +// you've created. +func (client VirtualNetworkClient) ListRouteTables(ctx context.Context, request ListRouteTablesRequest) (response ListRouteTablesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/routeTables", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListSecurityLists Lists the security lists in the specified VCN and compartment. +func (client VirtualNetworkClient) ListSecurityLists(ctx context.Context, request ListSecurityListsRequest) (response ListSecurityListsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/securityLists", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListSubnets Lists the subnets in the specified VCN and the specified compartment. +func (client VirtualNetworkClient) ListSubnets(ctx context.Context, request ListSubnetsRequest) (response ListSubnetsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/subnets", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListVcns Lists the Virtual Cloud Networks (VCNs) in the specified compartment. +func (client VirtualNetworkClient) ListVcns(ctx context.Context, request ListVcnsRequest) (response ListVcnsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/vcns", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListVirtualCircuitBandwidthShapes The deprecated operation lists available bandwidth levels for virtual circuits. For the compartment ID, provide the OCID of your tenancy (the root compartment). +func (client VirtualNetworkClient) ListVirtualCircuitBandwidthShapes(ctx context.Context, request ListVirtualCircuitBandwidthShapesRequest) (response ListVirtualCircuitBandwidthShapesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/virtualCircuitBandwidthShapes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListVirtualCircuitPublicPrefixes Lists the public IP prefixes and their details for the specified +// public virtual circuit. +func (client VirtualNetworkClient) ListVirtualCircuitPublicPrefixes(ctx context.Context, request ListVirtualCircuitPublicPrefixesRequest) (response ListVirtualCircuitPublicPrefixesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/virtualCircuits/{virtualCircuitId}/publicPrefixes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListVirtualCircuits Lists the virtual circuits in the specified compartment. +func (client VirtualNetworkClient) ListVirtualCircuits(ctx context.Context, request ListVirtualCircuitsRequest) (response ListVirtualCircuitsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/virtualCircuits", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateCpe Updates the specified CPE's display name. +// Avoid entering confidential information. +func (client VirtualNetworkClient) UpdateCpe(ctx context.Context, request UpdateCpeRequest) (response UpdateCpeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/cpes/{cpeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateCrossConnect Updates the specified cross-connect. +func (client VirtualNetworkClient) UpdateCrossConnect(ctx context.Context, request UpdateCrossConnectRequest) (response UpdateCrossConnectResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/crossConnects/{crossConnectId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateCrossConnectGroup Updates the specified cross-connect group's display name. +// Avoid entering confidential information. +func (client VirtualNetworkClient) UpdateCrossConnectGroup(ctx context.Context, request UpdateCrossConnectGroupRequest) (response UpdateCrossConnectGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/crossConnectGroups/{crossConnectGroupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateDhcpOptions Updates the specified set of DHCP options. You can update the display name or the options +// themselves. Avoid entering confidential information. +// Note that the `options` object you provide replaces the entire existing set of options. +func (client VirtualNetworkClient) UpdateDhcpOptions(ctx context.Context, request UpdateDhcpOptionsRequest) (response UpdateDhcpOptionsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/dhcps/{dhcpId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateDrg Updates the specified DRG's display name. Avoid entering confidential information. +func (client VirtualNetworkClient) UpdateDrg(ctx context.Context, request UpdateDrgRequest) (response UpdateDrgResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/drgs/{drgId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateDrgAttachment Updates the display name for the specified `DrgAttachment`. +// Avoid entering confidential information. +func (client VirtualNetworkClient) UpdateDrgAttachment(ctx context.Context, request UpdateDrgAttachmentRequest) (response UpdateDrgAttachmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/drgAttachments/{drgAttachmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateIPSecConnection Updates the display name for the specified IPSec connection. +// Avoid entering confidential information. +func (client VirtualNetworkClient) UpdateIPSecConnection(ctx context.Context, request UpdateIPSecConnectionRequest) (response UpdateIPSecConnectionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/ipsecConnections/{ipscId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateInternetGateway Updates the specified Internet Gateway. You can disable/enable it, or change its display name. +// Avoid entering confidential information. +// If the gateway is disabled, that means no traffic will flow to/from the internet even if there's +// a route rule that enables that traffic. +func (client VirtualNetworkClient) UpdateInternetGateway(ctx context.Context, request UpdateInternetGatewayRequest) (response UpdateInternetGatewayResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/internetGateways/{igId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateLocalPeeringGateway Updates the specified local peering gateway (LPG). +func (client VirtualNetworkClient) UpdateLocalPeeringGateway(ctx context.Context, request UpdateLocalPeeringGatewayRequest) (response UpdateLocalPeeringGatewayResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/localPeeringGateways/{localPeeringGatewayId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdatePrivateIp Updates the specified private IP. You must specify the object's OCID. +// Use this operation if you want to: +// - Move a secondary private IP to a different VNIC in the same subnet. +// - Change the display name for a secondary private IP. +// - Change the hostname for a secondary private IP. +// This operation cannot be used with primary private IPs. +// To update the hostname for the primary IP on a VNIC, use +// UpdateVnic. +func (client VirtualNetworkClient) UpdatePrivateIp(ctx context.Context, request UpdatePrivateIpRequest) (response UpdatePrivateIpResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/privateIps/{privateIpId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateRouteTable Updates the specified route table's display name or route rules. +// Avoid entering confidential information. +// Note that the `routeRules` object you provide replaces the entire existing set of rules. +func (client VirtualNetworkClient) UpdateRouteTable(ctx context.Context, request UpdateRouteTableRequest) (response UpdateRouteTableResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/routeTables/{rtId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateSecurityList Updates the specified security list's display name or rules. +// Avoid entering confidential information. +// Note that the `egressSecurityRules` or `ingressSecurityRules` objects you provide replace the entire +// existing objects. +func (client VirtualNetworkClient) UpdateSecurityList(ctx context.Context, request UpdateSecurityListRequest) (response UpdateSecurityListResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/securityLists/{securityListId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateSubnet Updates the specified subnet's display name. Avoid entering confidential information. +func (client VirtualNetworkClient) UpdateSubnet(ctx context.Context, request UpdateSubnetRequest) (response UpdateSubnetResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/subnets/{subnetId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateVcn Updates the specified VCN's display name. +// Avoid entering confidential information. +func (client VirtualNetworkClient) UpdateVcn(ctx context.Context, request UpdateVcnRequest) (response UpdateVcnResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/vcns/{vcnId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateVirtualCircuit Updates the specified virtual circuit. This can be called by +// either the customer who owns the virtual circuit, or the +// provider (when provisioning or de-provisioning the virtual +// circuit from their end). The documentation for +// UpdateVirtualCircuitDetails +// indicates who can update each property of the virtual circuit. +// **Important:** If the virtual circuit is working and in the +// PROVISIONED state, updating any of the network-related properties +// (such as the DRG being used, the BGP ASN, and so on) will cause the virtual +// circuit's state to switch to PROVISIONING and the related BGP +// session to go down. After Oracle re-provisions the virtual circuit, +// its state will return to PROVISIONED. Make sure you confirm that +// the associated BGP session is back up. For more information +// about the various states and how to test connectivity, see +// FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +// To change the list of public IP prefixes for a public virtual circuit, +// use BulkAddVirtualCircuitPublicPrefixes +// and +// BulkDeleteVirtualCircuitPublicPrefixes. +// Updating the list of prefixes does NOT cause the BGP session to go down. However, +// Oracle must verify the customer's ownership of each added prefix before +// traffic for that prefix will flow across the virtual circuit. +func (client VirtualNetworkClient) UpdateVirtualCircuit(ctx context.Context, request UpdateVirtualCircuitRequest) (response UpdateVirtualCircuitResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/virtualCircuits/{virtualCircuitId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateVnic Updates the specified VNIC. +func (client VirtualNetworkClient) UpdateVnic(ctx context.Context, request UpdateVnicRequest) (response UpdateVnicResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/vnics/{vnicId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/cpe.go b/vendor/github.com/oracle/oci-go-sdk/core/cpe.go new file mode 100644 index 0000000000..9759c8cbff --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/cpe.go @@ -0,0 +1,45 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Cpe An object you create when setting up an IPSec VPN between your on-premises network +// and VCN. The `Cpe` is a virtual representation of your Customer-Premises Equipment, +// which is the actual router on-premises at your site at your end of the IPSec VPN connection. +// For more information, +// see Overview of the Networking Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Cpe struct { + + // The OCID of the compartment containing the CPE. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The CPE's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The public IP address of the on-premises router. + IpAddress *string `mandatory:"true" json:"ipAddress"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The date and time the CPE was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m Cpe) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_cpe_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_cpe_details.go new file mode 100644 index 0000000000..0dff34734b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_cpe_details.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateCpeDetails The representation of CreateCpeDetails +type CreateCpeDetails struct { + + // The OCID of the compartment to contain the CPE. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The public IP address of the on-premises router. + // Example: `143.19.23.16` + IpAddress *string `mandatory:"true" json:"ipAddress"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateCpeDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_cpe_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_cpe_request_response.go new file mode 100644 index 0000000000..c4a5314a82 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_cpe_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateCpeRequest wrapper for the CreateCpe operation +type CreateCpeRequest struct { + + // Details for creating a CPE. + CreateCpeDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateCpeRequest) String() string { + return common.PointerString(request) +} + +// CreateCpeResponse wrapper for the CreateCpe operation +type CreateCpeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Cpe instance + Cpe `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateCpeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_details.go new file mode 100644 index 0000000000..6a17ea194e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_details.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateCrossConnectDetails The representation of CreateCrossConnectDetails +type CreateCrossConnectDetails struct { + + // The OCID of the compartment to contain the cross-connect. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name of the FastConnect location where this cross-connect will be installed. + // To get a list of the available locations, see + // ListCrossConnectLocations. + // Example: `CyrusOne, Chandler, AZ` + LocationName *string `mandatory:"true" json:"locationName"` + + // The port speed for this cross-connect. To get a list of the available port speeds, see + // ListCrossconnectPortSpeedShapes. + // Example: `10 Gbps` + PortSpeedShapeName *string `mandatory:"true" json:"portSpeedShapeName"` + + // The OCID of the cross-connect group to put this cross-connect in. + CrossConnectGroupId *string `mandatory:"false" json:"crossConnectGroupId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // If you already have an existing cross-connect or cross-connect group at this FastConnect + // location, and you want this new cross-connect to be on a different router (for the + // purposes of redundancy), provide the OCID of that existing cross-connect or + // cross-connect group. + FarCrossConnectOrCrossConnectGroupId *string `mandatory:"false" json:"farCrossConnectOrCrossConnectGroupId"` + + // If you already have an existing cross-connect or cross-connect group at this FastConnect + // location, and you want this new cross-connect to be on the same router, provide the + // OCID of that existing cross-connect or cross-connect group. + NearCrossConnectOrCrossConnectGroupId *string `mandatory:"false" json:"nearCrossConnectOrCrossConnectGroupId"` +} + +func (m CreateCrossConnectDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_group_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_group_details.go new file mode 100644 index 0000000000..c1232cfcad --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_group_details.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateCrossConnectGroupDetails The representation of CreateCrossConnectGroupDetails +type CreateCrossConnectGroupDetails struct { + + // The OCID of the compartment to contain the cross-connect group. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateCrossConnectGroupDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_group_request_response.go new file mode 100644 index 0000000000..33cdec7e9f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_group_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateCrossConnectGroupRequest wrapper for the CreateCrossConnectGroup operation +type CreateCrossConnectGroupRequest struct { + + // Details to create a CrossConnectGroup + CreateCrossConnectGroupDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateCrossConnectGroupRequest) String() string { + return common.PointerString(request) +} + +// CreateCrossConnectGroupResponse wrapper for the CreateCrossConnectGroup operation +type CreateCrossConnectGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CrossConnectGroup instance + CrossConnectGroup `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateCrossConnectGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_request_response.go new file mode 100644 index 0000000000..b9bf4a46e7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_cross_connect_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateCrossConnectRequest wrapper for the CreateCrossConnect operation +type CreateCrossConnectRequest struct { + + // Details to create a CrossConnect + CreateCrossConnectDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateCrossConnectRequest) String() string { + return common.PointerString(request) +} + +// CreateCrossConnectResponse wrapper for the CreateCrossConnect operation +type CreateCrossConnectResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CrossConnect instance + CrossConnect `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateCrossConnectResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_dhcp_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_dhcp_details.go new file mode 100644 index 0000000000..a29660b37e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_dhcp_details.go @@ -0,0 +1,61 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDhcpDetails The representation of CreateDhcpDetails +type CreateDhcpDetails struct { + + // The OCID of the compartment to contain the set of DHCP options. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A set of DHCP options. + Options []DhcpOption `mandatory:"true" json:"options"` + + // The OCID of the VCN the set of DHCP options belongs to. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateDhcpDetails) String() string { + return common.PointerString(m) +} + +// UnmarshalJSON unmarshals from json +func (m *CreateDhcpDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + DisplayName *string `json:"displayName"` + CompartmentId *string `json:"compartmentId"` + Options []dhcpoption `json:"options"` + VcnId *string `json:"vcnId"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + m.DisplayName = model.DisplayName + m.CompartmentId = model.CompartmentId + m.Options = make([]DhcpOption, len(model.Options)) + for i, n := range model.Options { + nn, err := n.UnmarshalPolymorphicJSON(n.JsonData) + if err != nil { + return err + } + m.Options[i] = nn + } + m.VcnId = model.VcnId + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_dhcp_options_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_dhcp_options_request_response.go new file mode 100644 index 0000000000..6fed1770d1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_dhcp_options_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateDhcpOptionsRequest wrapper for the CreateDhcpOptions operation +type CreateDhcpOptionsRequest struct { + + // Request object for creating a new set of DHCP options. + CreateDhcpDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateDhcpOptionsRequest) String() string { + return common.PointerString(request) +} + +// CreateDhcpOptionsResponse wrapper for the CreateDhcpOptions operation +type CreateDhcpOptionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DhcpOptions instance + DhcpOptions `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateDhcpOptionsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_drg_attachment_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_drg_attachment_details.go new file mode 100644 index 0000000000..d76431fc9e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_drg_attachment_details.go @@ -0,0 +1,30 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDrgAttachmentDetails The representation of CreateDrgAttachmentDetails +type CreateDrgAttachmentDetails struct { + + // The OCID of the DRG. + DrgId *string `mandatory:"true" json:"drgId"` + + // The OCID of the VCN. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateDrgAttachmentDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_drg_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_drg_attachment_request_response.go new file mode 100644 index 0000000000..4e50c9bd69 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_drg_attachment_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateDrgAttachmentRequest wrapper for the CreateDrgAttachment operation +type CreateDrgAttachmentRequest struct { + + // Details for creating a `DrgAttachment`. + CreateDrgAttachmentDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateDrgAttachmentRequest) String() string { + return common.PointerString(request) +} + +// CreateDrgAttachmentResponse wrapper for the CreateDrgAttachment operation +type CreateDrgAttachmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DrgAttachment instance + DrgAttachment `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateDrgAttachmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_drg_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_drg_details.go new file mode 100644 index 0000000000..a4a7d6f65a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_drg_details.go @@ -0,0 +1,27 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDrgDetails The representation of CreateDrgDetails +type CreateDrgDetails struct { + + // The OCID of the compartment to contain the DRG. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateDrgDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_drg_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_drg_request_response.go new file mode 100644 index 0000000000..a1fa6bae07 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_drg_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateDrgRequest wrapper for the CreateDrg operation +type CreateDrgRequest struct { + + // Details for creating a DRG. + CreateDrgDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateDrgRequest) String() string { + return common.PointerString(request) +} + +// CreateDrgResponse wrapper for the CreateDrg operation +type CreateDrgResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Drg instance + Drg `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateDrgResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_i_p_sec_connection_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_i_p_sec_connection_request_response.go new file mode 100644 index 0000000000..877bcc9c89 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_i_p_sec_connection_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateIPSecConnectionRequest wrapper for the CreateIPSecConnection operation +type CreateIPSecConnectionRequest struct { + + // Details for creating an `IPSecConnection`. + CreateIpSecConnectionDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateIPSecConnectionRequest) String() string { + return common.PointerString(request) +} + +// CreateIPSecConnectionResponse wrapper for the CreateIPSecConnection operation +type CreateIPSecConnectionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IpSecConnection instance + IpSecConnection `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateIPSecConnectionResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_image_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_image_details.go new file mode 100644 index 0000000000..6a482ea012 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_image_details.go @@ -0,0 +1,61 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateImageDetails Either instanceId or imageSourceDetails must be provided in addition to other required parameters. +type CreateImageDetails struct { + + // The OCID of the compartment containing the instance you want to use as the basis for the image. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name for the image. It does not have to be unique, and it's changeable. + // Avoid entering confidential information. + // You cannot use an Oracle-provided image name as a custom image name. + // Example: `My Oracle Linux image` + DisplayName *string `mandatory:"false" json:"displayName"` + + // Details for creating an image through import + ImageSourceDetails ImageSourceDetails `mandatory:"false" json:"imageSourceDetails"` + + // The OCID of the instance you want to use as the basis for the image. + InstanceId *string `mandatory:"false" json:"instanceId"` +} + +func (m CreateImageDetails) String() string { + return common.PointerString(m) +} + +// UnmarshalJSON unmarshals from json +func (m *CreateImageDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + DisplayName *string `json:"displayName"` + ImageSourceDetails imagesourcedetails `json:"imageSourceDetails"` + InstanceId *string `json:"instanceId"` + CompartmentId *string `json:"compartmentId"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + m.DisplayName = model.DisplayName + nn, e := model.ImageSourceDetails.UnmarshalPolymorphicJSON(model.ImageSourceDetails.JsonData) + if e != nil { + return + } + m.ImageSourceDetails = nn + m.InstanceId = model.InstanceId + m.CompartmentId = model.CompartmentId + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_image_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_image_request_response.go new file mode 100644 index 0000000000..0481d69240 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_image_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateImageRequest wrapper for the CreateImage operation +type CreateImageRequest struct { + + // Image creation details + CreateImageDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateImageRequest) String() string { + return common.PointerString(request) +} + +// CreateImageResponse wrapper for the CreateImage operation +type CreateImageResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Image instance + Image `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateImageResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_instance_console_connection_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_instance_console_connection_details.go new file mode 100644 index 0000000000..3d3225bf7c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_instance_console_connection_details.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateInstanceConsoleConnectionDetails The details for creating a instance console connection. +// The instance console connection is created in the same compartment as the instance. +type CreateInstanceConsoleConnectionDetails struct { + + // The OCID of the instance to create the console connection to. + InstanceId *string `mandatory:"true" json:"instanceId"` + + // The SSH public key used to authenticate the console connection. + PublicKey *string `mandatory:"true" json:"publicKey"` +} + +func (m CreateInstanceConsoleConnectionDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_instance_console_connection_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_instance_console_connection_request_response.go new file mode 100644 index 0000000000..456bd9b78c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_instance_console_connection_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateInstanceConsoleConnectionRequest wrapper for the CreateInstanceConsoleConnection operation +type CreateInstanceConsoleConnectionRequest struct { + + // Request object for creating an InstanceConsoleConnection + CreateInstanceConsoleConnectionDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateInstanceConsoleConnectionRequest) String() string { + return common.PointerString(request) +} + +// CreateInstanceConsoleConnectionResponse wrapper for the CreateInstanceConsoleConnection operation +type CreateInstanceConsoleConnectionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The InstanceConsoleConnection instance + InstanceConsoleConnection `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateInstanceConsoleConnectionResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_internet_gateway_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_internet_gateway_details.go new file mode 100644 index 0000000000..df49670c67 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_internet_gateway_details.go @@ -0,0 +1,33 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateInternetGatewayDetails The representation of CreateInternetGatewayDetails +type CreateInternetGatewayDetails struct { + + // The OCID of the compartment to contain the Internet Gateway. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Whether the gateway is enabled upon creation. + IsEnabled *bool `mandatory:"true" json:"isEnabled"` + + // The OCID of the VCN the Internet Gateway is attached to. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateInternetGatewayDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_internet_gateway_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_internet_gateway_request_response.go new file mode 100644 index 0000000000..7677474861 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_internet_gateway_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateInternetGatewayRequest wrapper for the CreateInternetGateway operation +type CreateInternetGatewayRequest struct { + + // Details for creating a new Internet Gateway. + CreateInternetGatewayDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateInternetGatewayRequest) String() string { + return common.PointerString(request) +} + +// CreateInternetGatewayResponse wrapper for the CreateInternetGateway operation +type CreateInternetGatewayResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The InternetGateway instance + InternetGateway `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateInternetGatewayResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_ip_sec_connection_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_ip_sec_connection_details.go new file mode 100644 index 0000000000..31cf23fa82 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_ip_sec_connection_details.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateIpSecConnectionDetails The representation of CreateIpSecConnectionDetails +type CreateIpSecConnectionDetails struct { + + // The OCID of the compartment to contain the IPSec connection. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the CPE. + CpeId *string `mandatory:"true" json:"cpeId"` + + // The OCID of the DRG. + DrgId *string `mandatory:"true" json:"drgId"` + + // Static routes to the CPE. At least one route must be included. The CIDR must not be a + // multicast address or class E address. + // Example: `10.0.1.0/24` + StaticRoutes []string `mandatory:"true" json:"staticRoutes"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateIpSecConnectionDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_local_peering_gateway_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_local_peering_gateway_details.go new file mode 100644 index 0000000000..6e0b454396 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_local_peering_gateway_details.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateLocalPeeringGatewayDetails The representation of CreateLocalPeeringGatewayDetails +type CreateLocalPeeringGatewayDetails struct { + + // The OCID of the compartment containing the local peering gateway (LPG). + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the VCN the LPG belongs to. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid + // entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateLocalPeeringGatewayDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_local_peering_gateway_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_local_peering_gateway_request_response.go new file mode 100644 index 0000000000..4f72bdb5cd --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_local_peering_gateway_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateLocalPeeringGatewayRequest wrapper for the CreateLocalPeeringGateway operation +type CreateLocalPeeringGatewayRequest struct { + + // Details for creating a new local peering gateway. + CreateLocalPeeringGatewayDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateLocalPeeringGatewayRequest) String() string { + return common.PointerString(request) +} + +// CreateLocalPeeringGatewayResponse wrapper for the CreateLocalPeeringGateway operation +type CreateLocalPeeringGatewayResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The LocalPeeringGateway instance + LocalPeeringGateway `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateLocalPeeringGatewayResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_private_ip_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_private_ip_details.go new file mode 100644 index 0000000000..b9da8cc514 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_private_ip_details.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreatePrivateIpDetails The representation of CreatePrivateIpDetails +type CreatePrivateIpDetails struct { + + // The OCID of the VNIC to assign the private IP to. The VNIC and private IP + // must be in the same subnet. + VnicId *string `mandatory:"true" json:"vnicId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid + // entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The hostname for the private IP. Used for DNS. The value + // is the hostname portion of the private IP's fully qualified domain name (FQDN) + // (for example, `bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Must be unique across all VNICs in the subnet and comply with + // RFC 952 (https://tools.ietf.org/html/rfc952) and + // RFC 1123 (https://tools.ietf.org/html/rfc1123). + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `bminstance-1` + HostnameLabel *string `mandatory:"false" json:"hostnameLabel"` + + // A private IP address of your choice. Must be an available IP address within + // the subnet's CIDR. If you don't specify a value, Oracle automatically + // assigns a private IP address from the subnet. + // Example: `10.0.3.3` + IpAddress *string `mandatory:"false" json:"ipAddress"` +} + +func (m CreatePrivateIpDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_private_ip_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_private_ip_request_response.go new file mode 100644 index 0000000000..941d3a3ed6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_private_ip_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreatePrivateIpRequest wrapper for the CreatePrivateIp operation +type CreatePrivateIpRequest struct { + + // Create private IP details. + CreatePrivateIpDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreatePrivateIpRequest) String() string { + return common.PointerString(request) +} + +// CreatePrivateIpResponse wrapper for the CreatePrivateIp operation +type CreatePrivateIpResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The PrivateIp instance + PrivateIp `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreatePrivateIpResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_route_table_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_route_table_details.go new file mode 100644 index 0000000000..8f3005acd8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_route_table_details.go @@ -0,0 +1,33 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateRouteTableDetails The representation of CreateRouteTableDetails +type CreateRouteTableDetails struct { + + // The OCID of the compartment to contain the route table. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The collection of rules used for routing destination IPs to network devices. + RouteRules []RouteRule `mandatory:"true" json:"routeRules"` + + // The OCID of the VCN the route table belongs to. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateRouteTableDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_route_table_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_route_table_request_response.go new file mode 100644 index 0000000000..7e70b4de8e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_route_table_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateRouteTableRequest wrapper for the CreateRouteTable operation +type CreateRouteTableRequest struct { + + // Details for creating a new route table. + CreateRouteTableDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateRouteTableRequest) String() string { + return common.PointerString(request) +} + +// CreateRouteTableResponse wrapper for the CreateRouteTable operation +type CreateRouteTableResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The RouteTable instance + RouteTable `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateRouteTableResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_security_list_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_security_list_details.go new file mode 100644 index 0000000000..06d4c4ec98 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_security_list_details.go @@ -0,0 +1,36 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateSecurityListDetails The representation of CreateSecurityListDetails +type CreateSecurityListDetails struct { + + // The OCID of the compartment to contain the security list. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Rules for allowing egress IP packets. + EgressSecurityRules []EgressSecurityRule `mandatory:"true" json:"egressSecurityRules"` + + // Rules for allowing ingress IP packets. + IngressSecurityRules []IngressSecurityRule `mandatory:"true" json:"ingressSecurityRules"` + + // The OCID of the VCN the security list belongs to. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateSecurityListDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_security_list_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_security_list_request_response.go new file mode 100644 index 0000000000..e652c644bd --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_security_list_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateSecurityListRequest wrapper for the CreateSecurityList operation +type CreateSecurityListRequest struct { + + // Details regarding the security list to create. + CreateSecurityListDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateSecurityListRequest) String() string { + return common.PointerString(request) +} + +// CreateSecurityListResponse wrapper for the CreateSecurityList operation +type CreateSecurityListResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The SecurityList instance + SecurityList `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateSecurityListResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_subnet_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_subnet_details.go new file mode 100644 index 0000000000..bc50b2add1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_subnet_details.go @@ -0,0 +1,76 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateSubnetDetails The representation of CreateSubnetDetails +type CreateSubnetDetails struct { + + // The Availability Domain to contain the subnet. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The CIDR IP address range of the subnet. + // Example: `172.16.1.0/24` + CidrBlock *string `mandatory:"true" json:"cidrBlock"` + + // The OCID of the compartment to contain the subnet. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the VCN to contain the subnet. + VcnId *string `mandatory:"true" json:"vcnId"` + + // The OCID of the set of DHCP options the subnet will use. If you don't + // provide a value, the subnet will use the VCN's default set of DHCP options. + DhcpOptionsId *string `mandatory:"false" json:"dhcpOptionsId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // A DNS label for the subnet, used in conjunction with the VNIC's hostname and + // VCN's DNS label to form a fully qualified domain name (FQDN) for each VNIC + // within this subnet (for example, `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Must be an alphanumeric string that begins with a letter and is unique within the VCN. + // The value cannot be changed. + // This value must be set if you want to use the Internet and VCN Resolver to resolve the + // hostnames of instances in the subnet. It can only be set if the VCN itself + // was created with a DNS label. + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `subnet123` + DnsLabel *string `mandatory:"false" json:"dnsLabel"` + + // Whether VNICs within this subnet can have public IP addresses. + // Defaults to false, which means VNICs created in this subnet will + // automatically be assigned public IP addresses unless specified + // otherwise during instance launch or VNIC creation (with the + // `assignPublicIp` flag in CreateVnicDetails). + // If `prohibitPublicIpOnVnic` is set to true, VNICs created in this + // subnet cannot have public IP addresses (that is, it's a private + // subnet). + // Example: `true` + ProhibitPublicIpOnVnic *bool `mandatory:"false" json:"prohibitPublicIpOnVnic"` + + // The OCID of the route table the subnet will use. If you don't provide a value, + // the subnet will use the VCN's default route table. + RouteTableId *string `mandatory:"false" json:"routeTableId"` + + // OCIDs for the security lists to associate with the subnet. If you don't + // provide a value, the VCN's default security list will be associated with + // the subnet. Remember that security lists are associated at the subnet + // level, but the rules are applied to the individual VNICs in the subnet. + SecurityListIds []string `mandatory:"false" json:"securityListIds"` +} + +func (m CreateSubnetDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_subnet_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_subnet_request_response.go new file mode 100644 index 0000000000..8d5818ec7f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_subnet_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateSubnetRequest wrapper for the CreateSubnet operation +type CreateSubnetRequest struct { + + // Details for creating a subnet. + CreateSubnetDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateSubnetRequest) String() string { + return common.PointerString(request) +} + +// CreateSubnetResponse wrapper for the CreateSubnet operation +type CreateSubnetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Subnet instance + Subnet `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateSubnetResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_vcn_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_vcn_details.go new file mode 100644 index 0000000000..70eb2c2408 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_vcn_details.go @@ -0,0 +1,45 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateVcnDetails The representation of CreateVcnDetails +type CreateVcnDetails struct { + + // The CIDR IP address block of the VCN. + // Example: `172.16.0.0/16` + CidrBlock *string `mandatory:"true" json:"cidrBlock"` + + // The OCID of the compartment to contain the VCN. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // A DNS label for the VCN, used in conjunction with the VNIC's hostname and + // subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC + // within this subnet (for example, `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Not required to be unique, but it's a best practice to set unique DNS labels + // for VCNs in your tenancy. Must be an alphanumeric string that begins with a letter. + // The value cannot be changed. + // You must set this value if you want instances to be able to use hostnames to + // resolve other instances in the VCN. Otherwise the Internet and VCN Resolver + // will not work. + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `vcn1` + DnsLabel *string `mandatory:"false" json:"dnsLabel"` +} + +func (m CreateVcnDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_vcn_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_vcn_request_response.go new file mode 100644 index 0000000000..99cd907af7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_vcn_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateVcnRequest wrapper for the CreateVcn operation +type CreateVcnRequest struct { + + // Details for creating a new VCN. + CreateVcnDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateVcnRequest) String() string { + return common.PointerString(request) +} + +// CreateVcnResponse wrapper for the CreateVcn operation +type CreateVcnResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Vcn instance + Vcn `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateVcnResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_virtual_circuit_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_virtual_circuit_details.go new file mode 100644 index 0000000000..f663f9854e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_virtual_circuit_details.go @@ -0,0 +1,98 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateVirtualCircuitDetails The representation of CreateVirtualCircuitDetails +type CreateVirtualCircuitDetails struct { + + // The OCID of the compartment to contain the virtual circuit. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The type of IP addresses used in this virtual circuit. PRIVATE + // means RFC 1918 (https://tools.ietf.org/html/rfc1918) addresses + // (10.0.0.0/8, 172.16/12, and 192.168/16). Only PRIVATE is supported. + Type CreateVirtualCircuitDetailsTypeEnum `mandatory:"true" json:"type"` + + // The provisioned data rate of the connection. To get a list of the + // available bandwidth levels (that is, shapes), see + // ListFastConnectProviderVirtualCircuitBandwidthShapes. + // Example: `10 Gbps` + BandwidthShapeName *string `mandatory:"false" json:"bandwidthShapeName"` + + // Create a `CrossConnectMapping` for each cross-connect or cross-connect + // group this virtual circuit will run on. + CrossConnectMappings []CrossConnectMapping `mandatory:"false" json:"crossConnectMappings"` + + // Your BGP ASN (either public or private). Provide this value only if + // there's a BGP session that goes from your edge router to Oracle. + // Otherwise, leave this empty or null. + CustomerBgpAsn *int `mandatory:"false" json:"customerBgpAsn"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // For private virtual circuits only. The OCID of the Drg + // that this virtual circuit uses. + GatewayId *string `mandatory:"false" json:"gatewayId"` + + // Deprecated. Instead use `providerServiceId`. + // To get a list of the provider names, see + // ListFastConnectProviderServices. + ProviderName *string `mandatory:"false" json:"providerName"` + + // The OCID of the service offered by the provider (if you're connecting + // via a provider). To get a list of the available service offerings, see + // ListFastConnectProviderServices. + ProviderServiceId *string `mandatory:"false" json:"providerServiceId"` + + // Deprecated. Instead use `providerServiceId`. + // To get a list of the provider names, see + // ListFastConnectProviderServices. + ProviderServiceName *string `mandatory:"false" json:"providerServiceName"` + + // For a public virtual circuit. The public IP prefixes (CIDRs) the customer wants to + // advertise across the connection. + PublicPrefixes []CreateVirtualCircuitPublicPrefixDetails `mandatory:"false" json:"publicPrefixes"` + + // The Oracle Cloud Infrastructure region where this virtual + // circuit is located. + // Example: `phx` + Region *string `mandatory:"false" json:"region"` +} + +func (m CreateVirtualCircuitDetails) String() string { + return common.PointerString(m) +} + +// CreateVirtualCircuitDetailsTypeEnum Enum with underlying type: string +type CreateVirtualCircuitDetailsTypeEnum string + +// Set of constants representing the allowable values for CreateVirtualCircuitDetailsType +const ( + CreateVirtualCircuitDetailsTypePublic CreateVirtualCircuitDetailsTypeEnum = "PUBLIC" + CreateVirtualCircuitDetailsTypePrivate CreateVirtualCircuitDetailsTypeEnum = "PRIVATE" +) + +var mappingCreateVirtualCircuitDetailsType = map[string]CreateVirtualCircuitDetailsTypeEnum{ + "PUBLIC": CreateVirtualCircuitDetailsTypePublic, + "PRIVATE": CreateVirtualCircuitDetailsTypePrivate, +} + +// GetCreateVirtualCircuitDetailsTypeEnumValues Enumerates the set of values for CreateVirtualCircuitDetailsType +func GetCreateVirtualCircuitDetailsTypeEnumValues() []CreateVirtualCircuitDetailsTypeEnum { + values := make([]CreateVirtualCircuitDetailsTypeEnum, 0) + for _, v := range mappingCreateVirtualCircuitDetailsType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_virtual_circuit_public_prefix_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_virtual_circuit_public_prefix_details.go new file mode 100644 index 0000000000..10e13c8f5f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_virtual_circuit_public_prefix_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateVirtualCircuitPublicPrefixDetails The representation of CreateVirtualCircuitPublicPrefixDetails +type CreateVirtualCircuitPublicPrefixDetails struct { + + // An individual public IP prefix (CIDR) to add to the public virtual circuit. + // Must be /24 or less specific. + CidrBlock *string `mandatory:"true" json:"cidrBlock"` +} + +func (m CreateVirtualCircuitPublicPrefixDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_virtual_circuit_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_virtual_circuit_request_response.go new file mode 100644 index 0000000000..629fc3e8a9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_virtual_circuit_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateVirtualCircuitRequest wrapper for the CreateVirtualCircuit operation +type CreateVirtualCircuitRequest struct { + + // Details to create a VirtualCircuit. + CreateVirtualCircuitDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateVirtualCircuitRequest) String() string { + return common.PointerString(request) +} + +// CreateVirtualCircuitResponse wrapper for the CreateVirtualCircuit operation +type CreateVirtualCircuitResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VirtualCircuit instance + VirtualCircuit `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateVirtualCircuitResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_vnic_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_vnic_details.go new file mode 100644 index 0000000000..c92cd1a5c5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_vnic_details.go @@ -0,0 +1,85 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateVnicDetails Contains properties for a VNIC. You use this object when creating the +// primary VNIC during instance launch or when creating a secondary VNIC. +// For more information about VNICs, see +// Virtual Network Interface Cards (VNICs) (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVNICs.htm). +type CreateVnicDetails struct { + + // The OCID of the subnet to create the VNIC in. When launching an instance, + // use this `subnetId` instead of the deprecated `subnetId` in + // LaunchInstanceDetails. + // At least one of them is required; if you provide both, the values must match. + SubnetId *string `mandatory:"true" json:"subnetId"` + + // Whether the VNIC should be assigned a public IP address. Defaults to whether + // the subnet is public or private. If not set and the VNIC is being created + // in a private subnet (that is, where `prohibitPublicIpOnVnic` = true in the + // Subnet), then no public IP address is assigned. + // If not set and the subnet is public (`prohibitPublicIpOnVnic` = false), then + // a public IP address is assigned. If set to true and + // `prohibitPublicIpOnVnic` = true, an error is returned. + // **Note:** This public IP address is associated with the primary private IP + // on the VNIC. Secondary private IPs cannot have public IP + // addresses associated with them. For more information, see + // IP Addresses (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPaddresses.htm). + // Example: `false` + AssignPublicIp *bool `mandatory:"false" json:"assignPublicIp"` + + // A user-friendly name for the VNIC. Does not have to be unique. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname + // portion of the primary private IP's fully qualified domain name (FQDN) + // (for example, `bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Must be unique across all VNICs in the subnet and comply with + // RFC 952 (https://tools.ietf.org/html/rfc952) and + // RFC 1123 (https://tools.ietf.org/html/rfc1123). + // The value appears in the Vnic object and also the + // PrivateIp object returned by + // ListPrivateIps and + // GetPrivateIp. + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // When launching an instance, use this `hostnameLabel` instead + // of the deprecated `hostnameLabel` in + // LaunchInstanceDetails. + // If you provide both, the values must match. + // Example: `bminstance-1` + HostnameLabel *string `mandatory:"false" json:"hostnameLabel"` + + // A private IP address of your choice to assign to the VNIC. Must be an + // available IP address within the subnet's CIDR. If you don't specify a + // value, Oracle automatically assigns a private IP address from the subnet. + // This is the VNIC's *primary* private IP address. The value appears in + // the Vnic object and also the + // PrivateIp object returned by + // ListPrivateIps and + // GetPrivateIp. + // Example: `10.0.3.3` + PrivateIp *string `mandatory:"false" json:"privateIp"` + + // Whether the source/destination check is disabled on the VNIC. + // Defaults to `false`, which means the check is performed. For information + // about why you would skip the source/destination check, see + // Using a Private IP as a Route Target (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm#privateip). + // Example: `true` + SkipSourceDestCheck *bool `mandatory:"false" json:"skipSourceDestCheck"` +} + +func (m CreateVnicDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_volume_backup_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_volume_backup_details.go new file mode 100644 index 0000000000..8a1907cb08 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_volume_backup_details.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateVolumeBackupDetails The representation of CreateVolumeBackupDetails +type CreateVolumeBackupDetails struct { + + // The OCID of the volume that needs to be backed up. + VolumeId *string `mandatory:"true" json:"volumeId"` + + // A user-friendly name for the volume backup. Does not have to be unique and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateVolumeBackupDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_volume_backup_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_volume_backup_request_response.go new file mode 100644 index 0000000000..44e47b7353 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_volume_backup_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateVolumeBackupRequest wrapper for the CreateVolumeBackup operation +type CreateVolumeBackupRequest struct { + + // Request to create a new backup of given volume. + CreateVolumeBackupDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateVolumeBackupRequest) String() string { + return common.PointerString(request) +} + +// CreateVolumeBackupResponse wrapper for the CreateVolumeBackup operation +type CreateVolumeBackupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VolumeBackup instance + VolumeBackup `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateVolumeBackupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_volume_details.go b/vendor/github.com/oracle/oci-go-sdk/core/create_volume_details.go new file mode 100644 index 0000000000..492c815fb0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_volume_details.go @@ -0,0 +1,80 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateVolumeDetails The representation of CreateVolumeDetails +type CreateVolumeDetails struct { + + // The Availability Domain of the volume. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment that contains the volume. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The size of the volume in GBs. + SizeInGBs *int `mandatory:"false" json:"sizeInGBs"` + + // The size of the volume in MBs. The value must be a multiple of 1024. + // This field is deprecated. Use sizeInGBs instead. + SizeInMBs *int `mandatory:"false" json:"sizeInMBs"` + + // Specifies the volume source details for a new Block volume. The volume source is either another Block volume in the same Availability Domain or a Block volume backup. + // This is an optional field. If not specified or set to null, the new Block volume will be empty. + // When specified, the new Block volume will contain data from the source volume or backup. + SourceDetails VolumeSourceDetails `mandatory:"false" json:"sourceDetails"` + + // The OCID of the volume backup from which the data should be restored on the newly created volume. + // This field is deprecated. Use the sourceDetails field instead to specify the + // backup for the volume. + VolumeBackupId *string `mandatory:"false" json:"volumeBackupId"` +} + +func (m CreateVolumeDetails) String() string { + return common.PointerString(m) +} + +// UnmarshalJSON unmarshals from json +func (m *CreateVolumeDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + DisplayName *string `json:"displayName"` + SizeInGBs *int `json:"sizeInGBs"` + SizeInMBs *int `json:"sizeInMBs"` + SourceDetails volumesourcedetails `json:"sourceDetails"` + VolumeBackupId *string `json:"volumeBackupId"` + AvailabilityDomain *string `json:"availabilityDomain"` + CompartmentId *string `json:"compartmentId"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + m.DisplayName = model.DisplayName + m.SizeInGBs = model.SizeInGBs + m.SizeInMBs = model.SizeInMBs + nn, e := model.SourceDetails.UnmarshalPolymorphicJSON(model.SourceDetails.JsonData) + if e != nil { + return + } + m.SourceDetails = nn + m.VolumeBackupId = model.VolumeBackupId + m.AvailabilityDomain = model.AvailabilityDomain + m.CompartmentId = model.CompartmentId + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/create_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/create_volume_request_response.go new file mode 100644 index 0000000000..d505805f4a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/create_volume_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateVolumeRequest wrapper for the CreateVolume operation +type CreateVolumeRequest struct { + + // Request to create a new volume. + CreateVolumeDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateVolumeRequest) String() string { + return common.PointerString(request) +} + +// CreateVolumeResponse wrapper for the CreateVolume operation +type CreateVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Volume instance + Volume `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/cross_connect.go b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect.go new file mode 100644 index 0000000000..67f43bf747 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect.go @@ -0,0 +1,94 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CrossConnect For use with Oracle Cloud Infrastructure FastConnect. A cross-connect represents a +// physical connection between an existing network and Oracle. Customers who are colocated +// with Oracle in a FastConnect location create and use cross-connects. For more +// information, see FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +// Oracle recommends you create each cross-connect in a +// CrossConnectGroup so you can use link aggregation +// with the connection. +// **Note:** If you're a provider who is setting up a physical connection to Oracle so customers +// can use FastConnect over the connection, be aware that your connection is modeled the +// same way as a colocated customer's (with `CrossConnect` and `CrossConnectGroup` objects, and so on). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type CrossConnect struct { + + // The OCID of the compartment containing the cross-connect group. + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // The OCID of the cross-connect group this cross-connect belongs to (if any). + CrossConnectGroupId *string `mandatory:"false" json:"crossConnectGroupId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The cross-connect's Oracle ID (OCID). + Id *string `mandatory:"false" json:"id"` + + // The cross-connect's current state. + LifecycleState CrossConnectLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The name of the FastConnect location where this cross-connect is installed. + LocationName *string `mandatory:"false" json:"locationName"` + + // A string identifying the meet-me room port for this cross-connect. + PortName *string `mandatory:"false" json:"portName"` + + // The port speed for this cross-connect. + // Example: `10 Gbps` + PortSpeedShapeName *string `mandatory:"false" json:"portSpeedShapeName"` + + // The date and time the cross-connect was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m CrossConnect) String() string { + return common.PointerString(m) +} + +// CrossConnectLifecycleStateEnum Enum with underlying type: string +type CrossConnectLifecycleStateEnum string + +// Set of constants representing the allowable values for CrossConnectLifecycleState +const ( + CrossConnectLifecycleStatePendingCustomer CrossConnectLifecycleStateEnum = "PENDING_CUSTOMER" + CrossConnectLifecycleStateProvisioning CrossConnectLifecycleStateEnum = "PROVISIONING" + CrossConnectLifecycleStateProvisioned CrossConnectLifecycleStateEnum = "PROVISIONED" + CrossConnectLifecycleStateInactive CrossConnectLifecycleStateEnum = "INACTIVE" + CrossConnectLifecycleStateTerminating CrossConnectLifecycleStateEnum = "TERMINATING" + CrossConnectLifecycleStateTerminated CrossConnectLifecycleStateEnum = "TERMINATED" +) + +var mappingCrossConnectLifecycleState = map[string]CrossConnectLifecycleStateEnum{ + "PENDING_CUSTOMER": CrossConnectLifecycleStatePendingCustomer, + "PROVISIONING": CrossConnectLifecycleStateProvisioning, + "PROVISIONED": CrossConnectLifecycleStateProvisioned, + "INACTIVE": CrossConnectLifecycleStateInactive, + "TERMINATING": CrossConnectLifecycleStateTerminating, + "TERMINATED": CrossConnectLifecycleStateTerminated, +} + +// GetCrossConnectLifecycleStateEnumValues Enumerates the set of values for CrossConnectLifecycleState +func GetCrossConnectLifecycleStateEnumValues() []CrossConnectLifecycleStateEnum { + values := make([]CrossConnectLifecycleStateEnum, 0) + for _, v := range mappingCrossConnectLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_group.go b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_group.go new file mode 100644 index 0000000000..2193bf7e75 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_group.go @@ -0,0 +1,77 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CrossConnectGroup For use with Oracle Cloud Infrastructure FastConnect. A cross-connect group +// is a link aggregation group (LAG), which can contain one or more +// CrossConnect. Customers who are colocated with +// Oracle in a FastConnect location create and use cross-connect groups. For more +// information, see FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +// **Note:** If you're a provider who is setting up a physical connection to Oracle so customers +// can use FastConnect over the connection, be aware that your connection is modeled the +// same way as a colocated customer's (with `CrossConnect` and `CrossConnectGroup` objects, and so on). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type CrossConnectGroup struct { + + // The OCID of the compartment containing the cross-connect group. + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // The display name of A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The cross-connect group's Oracle ID (OCID). + Id *string `mandatory:"false" json:"id"` + + // The cross-connect group's current state. + LifecycleState CrossConnectGroupLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The date and time the cross-connect group was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m CrossConnectGroup) String() string { + return common.PointerString(m) +} + +// CrossConnectGroupLifecycleStateEnum Enum with underlying type: string +type CrossConnectGroupLifecycleStateEnum string + +// Set of constants representing the allowable values for CrossConnectGroupLifecycleState +const ( + CrossConnectGroupLifecycleStateProvisioning CrossConnectGroupLifecycleStateEnum = "PROVISIONING" + CrossConnectGroupLifecycleStateProvisioned CrossConnectGroupLifecycleStateEnum = "PROVISIONED" + CrossConnectGroupLifecycleStateInactive CrossConnectGroupLifecycleStateEnum = "INACTIVE" + CrossConnectGroupLifecycleStateTerminating CrossConnectGroupLifecycleStateEnum = "TERMINATING" + CrossConnectGroupLifecycleStateTerminated CrossConnectGroupLifecycleStateEnum = "TERMINATED" +) + +var mappingCrossConnectGroupLifecycleState = map[string]CrossConnectGroupLifecycleStateEnum{ + "PROVISIONING": CrossConnectGroupLifecycleStateProvisioning, + "PROVISIONED": CrossConnectGroupLifecycleStateProvisioned, + "INACTIVE": CrossConnectGroupLifecycleStateInactive, + "TERMINATING": CrossConnectGroupLifecycleStateTerminating, + "TERMINATED": CrossConnectGroupLifecycleStateTerminated, +} + +// GetCrossConnectGroupLifecycleStateEnumValues Enumerates the set of values for CrossConnectGroupLifecycleState +func GetCrossConnectGroupLifecycleStateEnumValues() []CrossConnectGroupLifecycleStateEnum { + values := make([]CrossConnectGroupLifecycleStateEnum, 0) + for _, v := range mappingCrossConnectGroupLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_location.go b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_location.go new file mode 100644 index 0000000000..3a291556bb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_location.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CrossConnectLocation An individual FastConnect location. +type CrossConnectLocation struct { + + // A description of the location. + Description *string `mandatory:"true" json:"description"` + + // The name of the location. + // Example: `CyrusOne, Chandler, AZ` + Name *string `mandatory:"true" json:"name"` +} + +func (m CrossConnectLocation) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_mapping.go b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_mapping.go new file mode 100644 index 0000000000..43ec7d68ec --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_mapping.go @@ -0,0 +1,76 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CrossConnectMapping For use with Oracle Cloud Infrastructure FastConnect. Each +// VirtualCircuit runs on one or +// more cross-connects or cross-connect groups. A `CrossConnectMapping` +// contains the properties for an individual cross-connect or cross-connect group +// associated with a given virtual circuit. +// The mapping includes information about the cross-connect or +// cross-connect group, the VLAN, and the BGP peering session. +// If you're a customer who is colocated with Oracle, that means you own both +// the virtual circuit and the physical connection it runs on (cross-connect or +// cross-connect group), so you specify all the information in the mapping. There's +// one exception: for a public virtual circuit, Oracle specifies the BGP IP +// addresses. +// If you're a provider, then you own the physical connection that the customer's +// virtual circuit runs on, so you contribute information about the cross-connect +// or cross-connect group and VLAN. +// Who specifies the BGP peering information in the case of customer connection via +// provider? If the BGP session goes from Oracle to the provider's edge router, then +// the provider also specifies the BGP peering information. If the BGP session instead +// goes from Oracle to the customer's edge router, then the customer specifies the BGP +// peering information. There's one exception: for a public virtual circuit, Oracle +// specifies the BGP IP addresses. +type CrossConnectMapping struct { + + // The key for BGP MD5 authentication. Only applicable if your system + // requires MD5 authentication. If empty or not set (null), that + // means you don't use BGP MD5 authentication. + BgpMd5AuthKey *string `mandatory:"false" json:"bgpMd5AuthKey"` + + // The OCID of the cross-connect or cross-connect group for this mapping. + // Specified by the owner of the cross-connect or cross-connect group (the + // customer if the customer is colocated with Oracle, or the provider if the + // customer is connecting via provider). + CrossConnectOrCrossConnectGroupId *string `mandatory:"false" json:"crossConnectOrCrossConnectGroupId"` + + // The BGP IP address for the router on the other end of the BGP session from + // Oracle. Specified by the owner of that router. If the session goes from Oracle + // to a customer, this is the BGP IP address of the customer's edge router. If the + // session goes from Oracle to a provider, this is the BGP IP address of the + // provider's edge router. Must use a /30 or /31 subnet mask. + // There's one exception: for a public virtual circuit, Oracle specifies the BGP IP addresses. + // Example: `10.0.0.18/31` + CustomerBgpPeeringIp *string `mandatory:"false" json:"customerBgpPeeringIp"` + + // The IP address for Oracle's end of the BGP session. Must use a /30 or /31 + // subnet mask. If the session goes from Oracle to a customer's edge router, + // the customer specifies this information. If the session goes from Oracle to + // a provider's edge router, the provider specifies this. + // There's one exception: for a public virtual circuit, Oracle specifies the BGP IP addresses. + // Example: `10.0.0.19/31` + OracleBgpPeeringIp *string `mandatory:"false" json:"oracleBgpPeeringIp"` + + // The number of the specific VLAN (on the cross-connect or cross-connect group) + // that is assigned to this virtual circuit. Specified by the owner of the cross-connect + // or cross-connect group (the customer if the customer is colocated with Oracle, or + // the provider if the customer is connecting via provider). + // Example: `200` + Vlan *int `mandatory:"false" json:"vlan"` +} + +func (m CrossConnectMapping) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_port_speed_shape.go b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_port_speed_shape.go new file mode 100644 index 0000000000..3e854fa23e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_port_speed_shape.go @@ -0,0 +1,29 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CrossConnectPortSpeedShape An individual port speed level for cross-connects. +type CrossConnectPortSpeedShape struct { + + // The name of the port speed shape. + // Example: `10 Gbps` + Name *string `mandatory:"true" json:"name"` + + // The port speed in Gbps. + // Example: `10` + PortSpeedInGbps *int `mandatory:"true" json:"portSpeedInGbps"` +} + +func (m CrossConnectPortSpeedShape) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_status.go b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_status.go new file mode 100644 index 0000000000..608ab9c802 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/cross_connect_status.go @@ -0,0 +1,91 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CrossConnectStatus The status of the cross-connect. +type CrossConnectStatus struct { + + // The OCID of the cross-connect. + CrossConnectId *string `mandatory:"true" json:"crossConnectId"` + + // Whether Oracle's side of the interface is up or down. + InterfaceState CrossConnectStatusInterfaceStateEnum `mandatory:"false" json:"interfaceState,omitempty"` + + // The light level of the cross-connect (in dBm). + // Example: `14.0` + LightLevelIndBm *float32 `mandatory:"false" json:"lightLevelIndBm"` + + // Status indicator corresponding to the light level. + // * **NO_LIGHT:** No measurable light + // * **LOW_WARN:** There's measurable light but it's too low + // * **HIGH_WARN:** Light level is too high + // * **BAD:** There's measurable light but the signal-to-noise ratio is bad + // * **GOOD:** Good light level + LightLevelIndicator CrossConnectStatusLightLevelIndicatorEnum `mandatory:"false" json:"lightLevelIndicator,omitempty"` +} + +func (m CrossConnectStatus) String() string { + return common.PointerString(m) +} + +// CrossConnectStatusInterfaceStateEnum Enum with underlying type: string +type CrossConnectStatusInterfaceStateEnum string + +// Set of constants representing the allowable values for CrossConnectStatusInterfaceState +const ( + CrossConnectStatusInterfaceStateUp CrossConnectStatusInterfaceStateEnum = "UP" + CrossConnectStatusInterfaceStateDown CrossConnectStatusInterfaceStateEnum = "DOWN" +) + +var mappingCrossConnectStatusInterfaceState = map[string]CrossConnectStatusInterfaceStateEnum{ + "UP": CrossConnectStatusInterfaceStateUp, + "DOWN": CrossConnectStatusInterfaceStateDown, +} + +// GetCrossConnectStatusInterfaceStateEnumValues Enumerates the set of values for CrossConnectStatusInterfaceState +func GetCrossConnectStatusInterfaceStateEnumValues() []CrossConnectStatusInterfaceStateEnum { + values := make([]CrossConnectStatusInterfaceStateEnum, 0) + for _, v := range mappingCrossConnectStatusInterfaceState { + values = append(values, v) + } + return values +} + +// CrossConnectStatusLightLevelIndicatorEnum Enum with underlying type: string +type CrossConnectStatusLightLevelIndicatorEnum string + +// Set of constants representing the allowable values for CrossConnectStatusLightLevelIndicator +const ( + CrossConnectStatusLightLevelIndicatorNoLight CrossConnectStatusLightLevelIndicatorEnum = "NO_LIGHT" + CrossConnectStatusLightLevelIndicatorLowWarn CrossConnectStatusLightLevelIndicatorEnum = "LOW_WARN" + CrossConnectStatusLightLevelIndicatorHighWarn CrossConnectStatusLightLevelIndicatorEnum = "HIGH_WARN" + CrossConnectStatusLightLevelIndicatorBad CrossConnectStatusLightLevelIndicatorEnum = "BAD" + CrossConnectStatusLightLevelIndicatorGood CrossConnectStatusLightLevelIndicatorEnum = "GOOD" +) + +var mappingCrossConnectStatusLightLevelIndicator = map[string]CrossConnectStatusLightLevelIndicatorEnum{ + "NO_LIGHT": CrossConnectStatusLightLevelIndicatorNoLight, + "LOW_WARN": CrossConnectStatusLightLevelIndicatorLowWarn, + "HIGH_WARN": CrossConnectStatusLightLevelIndicatorHighWarn, + "BAD": CrossConnectStatusLightLevelIndicatorBad, + "GOOD": CrossConnectStatusLightLevelIndicatorGood, +} + +// GetCrossConnectStatusLightLevelIndicatorEnumValues Enumerates the set of values for CrossConnectStatusLightLevelIndicator +func GetCrossConnectStatusLightLevelIndicatorEnumValues() []CrossConnectStatusLightLevelIndicatorEnum { + values := make([]CrossConnectStatusLightLevelIndicatorEnum, 0) + for _, v := range mappingCrossConnectStatusLightLevelIndicator { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_boot_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_boot_volume_request_response.go new file mode 100644 index 0000000000..1f5d59d9a1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_boot_volume_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteBootVolumeRequest wrapper for the DeleteBootVolume operation +type DeleteBootVolumeRequest struct { + + // The OCID of the boot volume. + BootVolumeId *string `mandatory:"true" contributesTo:"path" name:"bootVolumeId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteBootVolumeRequest) String() string { + return common.PointerString(request) +} + +// DeleteBootVolumeResponse wrapper for the DeleteBootVolume operation +type DeleteBootVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteBootVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_console_history_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_console_history_request_response.go new file mode 100644 index 0000000000..e964e9bf4a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_console_history_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteConsoleHistoryRequest wrapper for the DeleteConsoleHistory operation +type DeleteConsoleHistoryRequest struct { + + // The OCID of the console history. + InstanceConsoleHistoryId *string `mandatory:"true" contributesTo:"path" name:"instanceConsoleHistoryId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteConsoleHistoryRequest) String() string { + return common.PointerString(request) +} + +// DeleteConsoleHistoryResponse wrapper for the DeleteConsoleHistory operation +type DeleteConsoleHistoryResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteConsoleHistoryResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_cpe_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_cpe_request_response.go new file mode 100644 index 0000000000..6a398d9228 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_cpe_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteCpeRequest wrapper for the DeleteCpe operation +type DeleteCpeRequest struct { + + // The OCID of the CPE. + CpeId *string `mandatory:"true" contributesTo:"path" name:"cpeId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteCpeRequest) String() string { + return common.PointerString(request) +} + +// DeleteCpeResponse wrapper for the DeleteCpe operation +type DeleteCpeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteCpeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_cross_connect_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_cross_connect_group_request_response.go new file mode 100644 index 0000000000..fbfaf81e1a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_cross_connect_group_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteCrossConnectGroupRequest wrapper for the DeleteCrossConnectGroup operation +type DeleteCrossConnectGroupRequest struct { + + // The OCID of the cross-connect group. + CrossConnectGroupId *string `mandatory:"true" contributesTo:"path" name:"crossConnectGroupId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteCrossConnectGroupRequest) String() string { + return common.PointerString(request) +} + +// DeleteCrossConnectGroupResponse wrapper for the DeleteCrossConnectGroup operation +type DeleteCrossConnectGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteCrossConnectGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_cross_connect_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_cross_connect_request_response.go new file mode 100644 index 0000000000..f3641dfd2d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_cross_connect_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteCrossConnectRequest wrapper for the DeleteCrossConnect operation +type DeleteCrossConnectRequest struct { + + // The OCID of the cross-connect. + CrossConnectId *string `mandatory:"true" contributesTo:"path" name:"crossConnectId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteCrossConnectRequest) String() string { + return common.PointerString(request) +} + +// DeleteCrossConnectResponse wrapper for the DeleteCrossConnect operation +type DeleteCrossConnectResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteCrossConnectResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_dhcp_options_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_dhcp_options_request_response.go new file mode 100644 index 0000000000..e89249eec3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_dhcp_options_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteDhcpOptionsRequest wrapper for the DeleteDhcpOptions operation +type DeleteDhcpOptionsRequest struct { + + // The OCID for the set of DHCP options. + DhcpId *string `mandatory:"true" contributesTo:"path" name:"dhcpId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteDhcpOptionsRequest) String() string { + return common.PointerString(request) +} + +// DeleteDhcpOptionsResponse wrapper for the DeleteDhcpOptions operation +type DeleteDhcpOptionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteDhcpOptionsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_drg_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_drg_attachment_request_response.go new file mode 100644 index 0000000000..a921056e59 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_drg_attachment_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteDrgAttachmentRequest wrapper for the DeleteDrgAttachment operation +type DeleteDrgAttachmentRequest struct { + + // The OCID of the DRG attachment. + DrgAttachmentId *string `mandatory:"true" contributesTo:"path" name:"drgAttachmentId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteDrgAttachmentRequest) String() string { + return common.PointerString(request) +} + +// DeleteDrgAttachmentResponse wrapper for the DeleteDrgAttachment operation +type DeleteDrgAttachmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteDrgAttachmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_drg_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_drg_request_response.go new file mode 100644 index 0000000000..225db2c443 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_drg_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteDrgRequest wrapper for the DeleteDrg operation +type DeleteDrgRequest struct { + + // The OCID of the DRG. + DrgId *string `mandatory:"true" contributesTo:"path" name:"drgId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteDrgRequest) String() string { + return common.PointerString(request) +} + +// DeleteDrgResponse wrapper for the DeleteDrg operation +type DeleteDrgResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteDrgResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_i_p_sec_connection_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_i_p_sec_connection_request_response.go new file mode 100644 index 0000000000..47a19acffb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_i_p_sec_connection_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteIPSecConnectionRequest wrapper for the DeleteIPSecConnection operation +type DeleteIPSecConnectionRequest struct { + + // The OCID of the IPSec connection. + IpscId *string `mandatory:"true" contributesTo:"path" name:"ipscId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteIPSecConnectionRequest) String() string { + return common.PointerString(request) +} + +// DeleteIPSecConnectionResponse wrapper for the DeleteIPSecConnection operation +type DeleteIPSecConnectionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteIPSecConnectionResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_image_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_image_request_response.go new file mode 100644 index 0000000000..f7c0a2b7fe --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_image_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteImageRequest wrapper for the DeleteImage operation +type DeleteImageRequest struct { + + // The OCID of the image. + ImageId *string `mandatory:"true" contributesTo:"path" name:"imageId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteImageRequest) String() string { + return common.PointerString(request) +} + +// DeleteImageResponse wrapper for the DeleteImage operation +type DeleteImageResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteImageResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_instance_console_connection_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_instance_console_connection_request_response.go new file mode 100644 index 0000000000..126d52c84f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_instance_console_connection_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteInstanceConsoleConnectionRequest wrapper for the DeleteInstanceConsoleConnection operation +type DeleteInstanceConsoleConnectionRequest struct { + + // The OCID of the intance console connection + InstanceConsoleConnectionId *string `mandatory:"true" contributesTo:"path" name:"instanceConsoleConnectionId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteInstanceConsoleConnectionRequest) String() string { + return common.PointerString(request) +} + +// DeleteInstanceConsoleConnectionResponse wrapper for the DeleteInstanceConsoleConnection operation +type DeleteInstanceConsoleConnectionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteInstanceConsoleConnectionResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_internet_gateway_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_internet_gateway_request_response.go new file mode 100644 index 0000000000..e1c2fcf278 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_internet_gateway_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteInternetGatewayRequest wrapper for the DeleteInternetGateway operation +type DeleteInternetGatewayRequest struct { + + // The OCID of the Internet Gateway. + IgId *string `mandatory:"true" contributesTo:"path" name:"igId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteInternetGatewayRequest) String() string { + return common.PointerString(request) +} + +// DeleteInternetGatewayResponse wrapper for the DeleteInternetGateway operation +type DeleteInternetGatewayResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteInternetGatewayResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_local_peering_gateway_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_local_peering_gateway_request_response.go new file mode 100644 index 0000000000..312cd74851 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_local_peering_gateway_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteLocalPeeringGatewayRequest wrapper for the DeleteLocalPeeringGateway operation +type DeleteLocalPeeringGatewayRequest struct { + + // The OCID of the local peering gateway. + LocalPeeringGatewayId *string `mandatory:"true" contributesTo:"path" name:"localPeeringGatewayId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteLocalPeeringGatewayRequest) String() string { + return common.PointerString(request) +} + +// DeleteLocalPeeringGatewayResponse wrapper for the DeleteLocalPeeringGateway operation +type DeleteLocalPeeringGatewayResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteLocalPeeringGatewayResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_private_ip_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_private_ip_request_response.go new file mode 100644 index 0000000000..6994c13208 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_private_ip_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeletePrivateIpRequest wrapper for the DeletePrivateIp operation +type DeletePrivateIpRequest struct { + + // The private IP's OCID. + PrivateIpId *string `mandatory:"true" contributesTo:"path" name:"privateIpId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeletePrivateIpRequest) String() string { + return common.PointerString(request) +} + +// DeletePrivateIpResponse wrapper for the DeletePrivateIp operation +type DeletePrivateIpResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeletePrivateIpResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_route_table_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_route_table_request_response.go new file mode 100644 index 0000000000..79cf5fee0e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_route_table_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteRouteTableRequest wrapper for the DeleteRouteTable operation +type DeleteRouteTableRequest struct { + + // The OCID of the route table. + RtId *string `mandatory:"true" contributesTo:"path" name:"rtId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteRouteTableRequest) String() string { + return common.PointerString(request) +} + +// DeleteRouteTableResponse wrapper for the DeleteRouteTable operation +type DeleteRouteTableResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteRouteTableResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_security_list_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_security_list_request_response.go new file mode 100644 index 0000000000..6fccea27e8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_security_list_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteSecurityListRequest wrapper for the DeleteSecurityList operation +type DeleteSecurityListRequest struct { + + // The OCID of the security list. + SecurityListId *string `mandatory:"true" contributesTo:"path" name:"securityListId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteSecurityListRequest) String() string { + return common.PointerString(request) +} + +// DeleteSecurityListResponse wrapper for the DeleteSecurityList operation +type DeleteSecurityListResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteSecurityListResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_subnet_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_subnet_request_response.go new file mode 100644 index 0000000000..cd198d8930 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_subnet_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteSubnetRequest wrapper for the DeleteSubnet operation +type DeleteSubnetRequest struct { + + // The OCID of the subnet. + SubnetId *string `mandatory:"true" contributesTo:"path" name:"subnetId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteSubnetRequest) String() string { + return common.PointerString(request) +} + +// DeleteSubnetResponse wrapper for the DeleteSubnet operation +type DeleteSubnetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteSubnetResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_vcn_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_vcn_request_response.go new file mode 100644 index 0000000000..9e30cccc4f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_vcn_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteVcnRequest wrapper for the DeleteVcn operation +type DeleteVcnRequest struct { + + // The OCID of the VCN. + VcnId *string `mandatory:"true" contributesTo:"path" name:"vcnId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteVcnRequest) String() string { + return common.PointerString(request) +} + +// DeleteVcnResponse wrapper for the DeleteVcn operation +type DeleteVcnResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteVcnResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_virtual_circuit_public_prefix_details.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_virtual_circuit_public_prefix_details.go new file mode 100644 index 0000000000..cea9aca23e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_virtual_circuit_public_prefix_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DeleteVirtualCircuitPublicPrefixDetails The representation of DeleteVirtualCircuitPublicPrefixDetails +type DeleteVirtualCircuitPublicPrefixDetails struct { + + // An individual public IP prefix (CIDR) to remove from the public virtual circuit. + CidrBlock *string `mandatory:"true" json:"cidrBlock"` +} + +func (m DeleteVirtualCircuitPublicPrefixDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_virtual_circuit_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_virtual_circuit_request_response.go new file mode 100644 index 0000000000..55caa0d271 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_virtual_circuit_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteVirtualCircuitRequest wrapper for the DeleteVirtualCircuit operation +type DeleteVirtualCircuitRequest struct { + + // The OCID of the virtual circuit. + VirtualCircuitId *string `mandatory:"true" contributesTo:"path" name:"virtualCircuitId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteVirtualCircuitRequest) String() string { + return common.PointerString(request) +} + +// DeleteVirtualCircuitResponse wrapper for the DeleteVirtualCircuit operation +type DeleteVirtualCircuitResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteVirtualCircuitResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_volume_backup_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_volume_backup_request_response.go new file mode 100644 index 0000000000..4c1e30354c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_volume_backup_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteVolumeBackupRequest wrapper for the DeleteVolumeBackup operation +type DeleteVolumeBackupRequest struct { + + // The OCID of the volume backup. + VolumeBackupId *string `mandatory:"true" contributesTo:"path" name:"volumeBackupId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteVolumeBackupRequest) String() string { + return common.PointerString(request) +} + +// DeleteVolumeBackupResponse wrapper for the DeleteVolumeBackup operation +type DeleteVolumeBackupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteVolumeBackupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/delete_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/delete_volume_request_response.go new file mode 100644 index 0000000000..e9bfd8a606 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/delete_volume_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteVolumeRequest wrapper for the DeleteVolume operation +type DeleteVolumeRequest struct { + + // The OCID of the volume. + VolumeId *string `mandatory:"true" contributesTo:"path" name:"volumeId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteVolumeRequest) String() string { + return common.PointerString(request) +} + +// DeleteVolumeResponse wrapper for the DeleteVolume operation +type DeleteVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/detach_boot_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/detach_boot_volume_request_response.go new file mode 100644 index 0000000000..5820949e9f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/detach_boot_volume_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DetachBootVolumeRequest wrapper for the DetachBootVolume operation +type DetachBootVolumeRequest struct { + + // The OCID of the boot volume attachment. + BootVolumeAttachmentId *string `mandatory:"true" contributesTo:"path" name:"bootVolumeAttachmentId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DetachBootVolumeRequest) String() string { + return common.PointerString(request) +} + +// DetachBootVolumeResponse wrapper for the DetachBootVolume operation +type DetachBootVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DetachBootVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/detach_vnic_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/detach_vnic_request_response.go new file mode 100644 index 0000000000..7f4bf5e93f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/detach_vnic_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DetachVnicRequest wrapper for the DetachVnic operation +type DetachVnicRequest struct { + + // The OCID of the VNIC attachment. + VnicAttachmentId *string `mandatory:"true" contributesTo:"path" name:"vnicAttachmentId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DetachVnicRequest) String() string { + return common.PointerString(request) +} + +// DetachVnicResponse wrapper for the DetachVnic operation +type DetachVnicResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DetachVnicResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/detach_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/detach_volume_request_response.go new file mode 100644 index 0000000000..59188b4348 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/detach_volume_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DetachVolumeRequest wrapper for the DetachVolume operation +type DetachVolumeRequest struct { + + // The OCID of the volume attachment. + VolumeAttachmentId *string `mandatory:"true" contributesTo:"path" name:"volumeAttachmentId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DetachVolumeRequest) String() string { + return common.PointerString(request) +} + +// DetachVolumeResponse wrapper for the DetachVolume operation +type DetachVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DetachVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/dhcp_dns_option.go b/vendor/github.com/oracle/oci-go-sdk/core/dhcp_dns_option.go new file mode 100644 index 0000000000..51237ca28c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/dhcp_dns_option.go @@ -0,0 +1,81 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// DhcpDnsOption DHCP option for specifying how DNS (hostname resolution) is handled in the subnets in the VCN. +// For more information, see +// DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). +type DhcpDnsOption struct { + + // If you set `serverType` to `CustomDnsServer`, specify the IP address + // of at least one DNS server of your choice (three maximum). + CustomDnsServers []string `mandatory:"false" json:"customDnsServers"` + + // - **VcnLocal:** Reserved for future use. + // - **VcnLocalPlusInternet:** Also referred to as "Internet and VCN Resolver". + // Instances can resolve internet hostnames (no Internet Gateway is required), + // and can resolve hostnames of instances in the VCN. This is the default + // value in the default set of DHCP options in the VCN. For the Internet and + // VCN Resolver to work across the VCN, there must also be a DNS label set for + // the VCN, a DNS label set for each subnet, and a hostname for each instance. + // The Internet and VCN Resolver also enables reverse DNS lookup, which lets + // you determine the hostname corresponding to the private IP address. For more + // information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // - **CustomDnsServer:** Instances use a DNS server of your choice (three maximum). + ServerType DhcpDnsOptionServerTypeEnum `mandatory:"true" json:"serverType"` +} + +func (m DhcpDnsOption) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m DhcpDnsOption) MarshalJSON() (buff []byte, e error) { + type MarshalTypeDhcpDnsOption DhcpDnsOption + s := struct { + DiscriminatorParam string `json:"type"` + MarshalTypeDhcpDnsOption + }{ + "DomainNameServer", + (MarshalTypeDhcpDnsOption)(m), + } + + return json.Marshal(&s) +} + +// DhcpDnsOptionServerTypeEnum Enum with underlying type: string +type DhcpDnsOptionServerTypeEnum string + +// Set of constants representing the allowable values for DhcpDnsOptionServerType +const ( + DhcpDnsOptionServerTypeVcnlocal DhcpDnsOptionServerTypeEnum = "VcnLocal" + DhcpDnsOptionServerTypeVcnlocalplusinternet DhcpDnsOptionServerTypeEnum = "VcnLocalPlusInternet" + DhcpDnsOptionServerTypeCustomdnsserver DhcpDnsOptionServerTypeEnum = "CustomDnsServer" +) + +var mappingDhcpDnsOptionServerType = map[string]DhcpDnsOptionServerTypeEnum{ + "VcnLocal": DhcpDnsOptionServerTypeVcnlocal, + "VcnLocalPlusInternet": DhcpDnsOptionServerTypeVcnlocalplusinternet, + "CustomDnsServer": DhcpDnsOptionServerTypeCustomdnsserver, +} + +// GetDhcpDnsOptionServerTypeEnumValues Enumerates the set of values for DhcpDnsOptionServerType +func GetDhcpDnsOptionServerTypeEnumValues() []DhcpDnsOptionServerTypeEnum { + values := make([]DhcpDnsOptionServerTypeEnum, 0) + for _, v := range mappingDhcpDnsOptionServerType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/dhcp_option.go b/vendor/github.com/oracle/oci-go-sdk/core/dhcp_option.go new file mode 100644 index 0000000000..742f3411be --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/dhcp_option.go @@ -0,0 +1,64 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// DhcpOption A single DHCP option according to RFC 1533 (https://tools.ietf.org/html/rfc1533). +// The two options available to use are DhcpDnsOption +// and DhcpSearchDomainOption. For more +// information, see DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm) +// and DHCP Options (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingDHCP.htm). +type DhcpOption interface { +} + +type dhcpoption struct { + JsonData []byte + Type string `json:"type"` +} + +// UnmarshalJSON unmarshals json +func (m *dhcpoption) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerdhcpoption dhcpoption + s := struct { + Model Unmarshalerdhcpoption + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.Type = s.Model.Type + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *dhcpoption) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.Type { + case "DomainNameServer": + mm := DhcpDnsOption{} + err = json.Unmarshal(data, &mm) + return mm, err + case "SearchDomain": + mm := DhcpSearchDomainOption{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +func (m dhcpoption) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/dhcp_options.go b/vendor/github.com/oracle/oci-go-sdk/core/dhcp_options.go new file mode 100644 index 0000000000..f96edd9956 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/dhcp_options.go @@ -0,0 +1,115 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// DhcpOptions A set of DHCP options. Used by the VCN to automatically provide configuration +// information to the instances when they boot up. There are two options you can set: +// - DhcpDnsOption: Lets you specify how DNS (hostname resolution) is +// handled in the subnets in your VCN. +// - DhcpSearchDomainOption: Lets you specify +// a search domain name to use for DNS queries. +// For more information, see DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm) +// and DHCP Options (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingDHCP.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type DhcpOptions struct { + + // The OCID of the compartment containing the set of DHCP options. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Oracle ID (OCID) for the set of DHCP options. + Id *string `mandatory:"true" json:"id"` + + // The current state of the set of DHCP options. + LifecycleState DhcpOptionsLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The collection of individual DHCP options. + Options []DhcpOption `mandatory:"true" json:"options"` + + // Date and time the set of DHCP options was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The OCID of the VCN the set of DHCP options belongs to. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m DhcpOptions) String() string { + return common.PointerString(m) +} + +// UnmarshalJSON unmarshals from json +func (m *DhcpOptions) UnmarshalJSON(data []byte) (e error) { + model := struct { + DisplayName *string `json:"displayName"` + CompartmentId *string `json:"compartmentId"` + Id *string `json:"id"` + LifecycleState DhcpOptionsLifecycleStateEnum `json:"lifecycleState"` + Options []dhcpoption `json:"options"` + TimeCreated *common.SDKTime `json:"timeCreated"` + VcnId *string `json:"vcnId"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + m.DisplayName = model.DisplayName + m.CompartmentId = model.CompartmentId + m.Id = model.Id + m.LifecycleState = model.LifecycleState + m.Options = make([]DhcpOption, len(model.Options)) + for i, n := range model.Options { + nn, err := n.UnmarshalPolymorphicJSON(n.JsonData) + if err != nil { + return err + } + m.Options[i] = nn + } + m.TimeCreated = model.TimeCreated + m.VcnId = model.VcnId + return +} + +// DhcpOptionsLifecycleStateEnum Enum with underlying type: string +type DhcpOptionsLifecycleStateEnum string + +// Set of constants representing the allowable values for DhcpOptionsLifecycleState +const ( + DhcpOptionsLifecycleStateProvisioning DhcpOptionsLifecycleStateEnum = "PROVISIONING" + DhcpOptionsLifecycleStateAvailable DhcpOptionsLifecycleStateEnum = "AVAILABLE" + DhcpOptionsLifecycleStateTerminating DhcpOptionsLifecycleStateEnum = "TERMINATING" + DhcpOptionsLifecycleStateTerminated DhcpOptionsLifecycleStateEnum = "TERMINATED" +) + +var mappingDhcpOptionsLifecycleState = map[string]DhcpOptionsLifecycleStateEnum{ + "PROVISIONING": DhcpOptionsLifecycleStateProvisioning, + "AVAILABLE": DhcpOptionsLifecycleStateAvailable, + "TERMINATING": DhcpOptionsLifecycleStateTerminating, + "TERMINATED": DhcpOptionsLifecycleStateTerminated, +} + +// GetDhcpOptionsLifecycleStateEnumValues Enumerates the set of values for DhcpOptionsLifecycleState +func GetDhcpOptionsLifecycleStateEnumValues() []DhcpOptionsLifecycleStateEnum { + values := make([]DhcpOptionsLifecycleStateEnum, 0) + for _, v := range mappingDhcpOptionsLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/dhcp_search_domain_option.go b/vendor/github.com/oracle/oci-go-sdk/core/dhcp_search_domain_option.go new file mode 100644 index 0000000000..58968eb53e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/dhcp_search_domain_option.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// DhcpSearchDomainOption DHCP option for specifying a search domain name for DNS queries. For more information, see +// DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). +type DhcpSearchDomainOption struct { + + // A single search domain name according to RFC 952 (https://tools.ietf.org/html/rfc952) + // and RFC 1123 (https://tools.ietf.org/html/rfc1123). During a DNS query, + // the OS will append this search domain name to the value being queried. + // If you set DhcpDnsOption to `VcnLocalPlusInternet`, + // and you assign a DNS label to the VCN during creation, the search domain name in the + // VCN's default set of DHCP options is automatically set to the VCN domain + // (for example, `vcn1.oraclevcn.com`). + // If you don't want to use a search domain name, omit this option from the + // set of DHCP options. Do not include this option with an empty list + // of search domain names, or with an empty string as the value for any search + // domain name. + SearchDomainNames []string `mandatory:"true" json:"searchDomainNames"` +} + +func (m DhcpSearchDomainOption) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m DhcpSearchDomainOption) MarshalJSON() (buff []byte, e error) { + type MarshalTypeDhcpSearchDomainOption DhcpSearchDomainOption + s := struct { + DiscriminatorParam string `json:"type"` + MarshalTypeDhcpSearchDomainOption + }{ + "SearchDomain", + (MarshalTypeDhcpSearchDomainOption)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/drg.go b/vendor/github.com/oracle/oci-go-sdk/core/drg.go new file mode 100644 index 0000000000..b87673bbab --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/drg.go @@ -0,0 +1,72 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Drg A Dynamic Routing Gateway (DRG), which is a virtual router that provides a path for private +// network traffic between your VCN and your existing network. You use it with other Networking +// Service components to create an IPSec VPN or a connection that uses +// Oracle Cloud Infrastructure FastConnect. For more information, see +// Overview of the Networking Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Drg struct { + + // The OCID of the compartment containing the DRG. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The DRG's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The DRG's current state. + LifecycleState DrgLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The date and time the DRG was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m Drg) String() string { + return common.PointerString(m) +} + +// DrgLifecycleStateEnum Enum with underlying type: string +type DrgLifecycleStateEnum string + +// Set of constants representing the allowable values for DrgLifecycleState +const ( + DrgLifecycleStateProvisioning DrgLifecycleStateEnum = "PROVISIONING" + DrgLifecycleStateAvailable DrgLifecycleStateEnum = "AVAILABLE" + DrgLifecycleStateTerminating DrgLifecycleStateEnum = "TERMINATING" + DrgLifecycleStateTerminated DrgLifecycleStateEnum = "TERMINATED" +) + +var mappingDrgLifecycleState = map[string]DrgLifecycleStateEnum{ + "PROVISIONING": DrgLifecycleStateProvisioning, + "AVAILABLE": DrgLifecycleStateAvailable, + "TERMINATING": DrgLifecycleStateTerminating, + "TERMINATED": DrgLifecycleStateTerminated, +} + +// GetDrgLifecycleStateEnumValues Enumerates the set of values for DrgLifecycleState +func GetDrgLifecycleStateEnumValues() []DrgLifecycleStateEnum { + values := make([]DrgLifecycleStateEnum, 0) + for _, v := range mappingDrgLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/drg_attachment.go b/vendor/github.com/oracle/oci-go-sdk/core/drg_attachment.go new file mode 100644 index 0000000000..1087634574 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/drg_attachment.go @@ -0,0 +1,72 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DrgAttachment A link between a DRG and VCN. For more information, see +// Overview of the Networking Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm). +type DrgAttachment struct { + + // The OCID of the compartment containing the DRG attachment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the DRG. + DrgId *string `mandatory:"true" json:"drgId"` + + // The DRG attachment's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The DRG attachment's current state. + LifecycleState DrgAttachmentLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID of the VCN. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The date and time the DRG attachment was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m DrgAttachment) String() string { + return common.PointerString(m) +} + +// DrgAttachmentLifecycleStateEnum Enum with underlying type: string +type DrgAttachmentLifecycleStateEnum string + +// Set of constants representing the allowable values for DrgAttachmentLifecycleState +const ( + DrgAttachmentLifecycleStateAttaching DrgAttachmentLifecycleStateEnum = "ATTACHING" + DrgAttachmentLifecycleStateAttached DrgAttachmentLifecycleStateEnum = "ATTACHED" + DrgAttachmentLifecycleStateDetaching DrgAttachmentLifecycleStateEnum = "DETACHING" + DrgAttachmentLifecycleStateDetached DrgAttachmentLifecycleStateEnum = "DETACHED" +) + +var mappingDrgAttachmentLifecycleState = map[string]DrgAttachmentLifecycleStateEnum{ + "ATTACHING": DrgAttachmentLifecycleStateAttaching, + "ATTACHED": DrgAttachmentLifecycleStateAttached, + "DETACHING": DrgAttachmentLifecycleStateDetaching, + "DETACHED": DrgAttachmentLifecycleStateDetached, +} + +// GetDrgAttachmentLifecycleStateEnumValues Enumerates the set of values for DrgAttachmentLifecycleState +func GetDrgAttachmentLifecycleStateEnumValues() []DrgAttachmentLifecycleStateEnum { + values := make([]DrgAttachmentLifecycleStateEnum, 0) + for _, v := range mappingDrgAttachmentLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/egress_security_rule.go b/vendor/github.com/oracle/oci-go-sdk/core/egress_security_rule.go new file mode 100644 index 0000000000..313470a2f2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/egress_security_rule.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// EgressSecurityRule A rule for allowing outbound IP packets. +type EgressSecurityRule struct { + + // The destination CIDR block for the egress rule. This is the range of IP addresses that a + // packet originating from the instance can go to. + Destination *string `mandatory:"true" json:"destination"` + + // The transport protocol. Specify either `all` or an IPv4 protocol number as + // defined in + // Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + // Options are supported only for ICMP ("1"), TCP ("6"), and UDP ("17"). + Protocol *string `mandatory:"true" json:"protocol"` + + // Optional and valid only for ICMP. Use to specify a particular ICMP type and code + // as defined in + // ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml). + // If you specify ICMP as the protocol but omit this object, then all ICMP types and + // codes are allowed. If you do provide this object, the type is required and the code is optional. + // To enable MTU negotiation for ingress internet traffic, make sure to allow type 3 ("Destination + // Unreachable") code 4 ("Fragmentation Needed and Don't Fragment was Set"). If you need to specify + // multiple codes for a single type, create a separate security list rule for each. + IcmpOptions *IcmpOptions `mandatory:"false" json:"icmpOptions"` + + // A stateless rule allows traffic in one direction. Remember to add a corresponding + // stateless rule in the other direction if you need to support bidirectional traffic. For + // example, if egress traffic allows TCP destination port 80, there should be an ingress + // rule to allow TCP source port 80. Defaults to false, which means the rule is stateful + // and a corresponding rule is not necessary for bidirectional traffic. + IsStateless *bool `mandatory:"false" json:"isStateless"` + + // Optional and valid only for TCP. Use to specify particular destination ports for TCP rules. + // If you specify TCP as the protocol but omit this object, then all destination ports are allowed. + TcpOptions *TcpOptions `mandatory:"false" json:"tcpOptions"` + + // Optional and valid only for UDP. Use to specify particular destination ports for UDP rules. + // If you specify UDP as the protocol but omit this object, then all destination ports are allowed. + UdpOptions *UdpOptions `mandatory:"false" json:"udpOptions"` +} + +func (m EgressSecurityRule) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/export_image_details.go b/vendor/github.com/oracle/oci-go-sdk/core/export_image_details.go new file mode 100644 index 0000000000..f066a58a77 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/export_image_details.go @@ -0,0 +1,66 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// ExportImageDetails The destination details for the image export. +// Set `destinationType` to `objectStorageTuple` +// and use ExportImageViaObjectStorageTupleDetails +// when specifying the namespace, bucket name, and object name. +// Set `destinationType` to `objectStorageUri` and +// use ExportImageViaObjectStorageUriDetails +// when specifying the Object Storage URL. +type ExportImageDetails interface { +} + +type exportimagedetails struct { + JsonData []byte + DestinationType string `json:"destinationType"` +} + +// UnmarshalJSON unmarshals json +func (m *exportimagedetails) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerexportimagedetails exportimagedetails + s := struct { + Model Unmarshalerexportimagedetails + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.DestinationType = s.Model.DestinationType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *exportimagedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.DestinationType { + case "objectStorageUri": + mm := ExportImageViaObjectStorageUriDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + case "objectStorageTuple": + mm := ExportImageViaObjectStorageTupleDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +func (m exportimagedetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/export_image_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/export_image_request_response.go new file mode 100644 index 0000000000..4ecb1a3ce7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/export_image_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ExportImageRequest wrapper for the ExportImage operation +type ExportImageRequest struct { + + // The OCID of the image. + ImageId *string `mandatory:"true" contributesTo:"path" name:"imageId"` + + // Details for the image export. + ExportImageDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request ExportImageRequest) String() string { + return common.PointerString(request) +} + +// ExportImageResponse wrapper for the ExportImage operation +type ExportImageResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Image instance + Image `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ExportImageResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/export_image_via_object_storage_tuple_details.go b/vendor/github.com/oracle/oci-go-sdk/core/export_image_via_object_storage_tuple_details.go new file mode 100644 index 0000000000..39d08873f1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/export_image_via_object_storage_tuple_details.go @@ -0,0 +1,45 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// ExportImageViaObjectStorageTupleDetails The representation of ExportImageViaObjectStorageTupleDetails +type ExportImageViaObjectStorageTupleDetails struct { + + // The Object Storage bucket to export the image to. + BucketName *string `mandatory:"false" json:"bucketName"` + + // The Object Storage namespace to export the image to. + NamespaceName *string `mandatory:"false" json:"namespaceName"` + + // The Object Storage object name for the exported image. + ObjectName *string `mandatory:"false" json:"objectName"` +} + +func (m ExportImageViaObjectStorageTupleDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m ExportImageViaObjectStorageTupleDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeExportImageViaObjectStorageTupleDetails ExportImageViaObjectStorageTupleDetails + s := struct { + DiscriminatorParam string `json:"destinationType"` + MarshalTypeExportImageViaObjectStorageTupleDetails + }{ + "objectStorageTuple", + (MarshalTypeExportImageViaObjectStorageTupleDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/export_image_via_object_storage_uri_details.go b/vendor/github.com/oracle/oci-go-sdk/core/export_image_via_object_storage_uri_details.go new file mode 100644 index 0000000000..5a44a21a63 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/export_image_via_object_storage_uri_details.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// ExportImageViaObjectStorageUriDetails The representation of ExportImageViaObjectStorageUriDetails +type ExportImageViaObjectStorageUriDetails struct { + + // The Object Storage URL to export the image to. See Object Storage URLs (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/imageimportexport.htm#URLs) + // and pre-authenticated requests (https://docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/managingaccess.htm#pre-auth) for constructing URLs for image import/export. + DestinationUri *string `mandatory:"true" json:"destinationUri"` +} + +func (m ExportImageViaObjectStorageUriDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m ExportImageViaObjectStorageUriDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeExportImageViaObjectStorageUriDetails ExportImageViaObjectStorageUriDetails + s := struct { + DiscriminatorParam string `json:"destinationType"` + MarshalTypeExportImageViaObjectStorageUriDetails + }{ + "objectStorageUri", + (MarshalTypeExportImageViaObjectStorageUriDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/fast_connect_provider_service.go b/vendor/github.com/oracle/oci-go-sdk/core/fast_connect_provider_service.go new file mode 100644 index 0000000000..1b8dcca1d7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/fast_connect_provider_service.go @@ -0,0 +1,142 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// FastConnectProviderService A service offering from a supported provider. For more information, +// see FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +type FastConnectProviderService struct { + + // The OCID of the service offered by the provider. + Id *string `mandatory:"true" json:"id"` + + // Private peering BGP management. + PrivatePeeringBgpManagement FastConnectProviderServicePrivatePeeringBgpManagementEnum `mandatory:"true" json:"privatePeeringBgpManagement"` + + // The name of the provider. + ProviderName *string `mandatory:"true" json:"providerName"` + + // The name of the service offered by the provider. + ProviderServiceName *string `mandatory:"true" json:"providerServiceName"` + + // Public peering BGP management. + PublicPeeringBgpManagement FastConnectProviderServicePublicPeeringBgpManagementEnum `mandatory:"true" json:"publicPeeringBgpManagement"` + + // Provider service type. + Type FastConnectProviderServiceTypeEnum `mandatory:"true" json:"type"` + + // A description of the service offered by the provider. + Description *string `mandatory:"false" json:"description"` + + // An array of virtual circuit types supported by this service. + SupportedVirtualCircuitTypes []FastConnectProviderServiceSupportedVirtualCircuitTypesEnum `mandatory:"false" json:"supportedVirtualCircuitTypes,omitempty"` +} + +func (m FastConnectProviderService) String() string { + return common.PointerString(m) +} + +// FastConnectProviderServicePrivatePeeringBgpManagementEnum Enum with underlying type: string +type FastConnectProviderServicePrivatePeeringBgpManagementEnum string + +// Set of constants representing the allowable values for FastConnectProviderServicePrivatePeeringBgpManagement +const ( + FastConnectProviderServicePrivatePeeringBgpManagementCustomerManaged FastConnectProviderServicePrivatePeeringBgpManagementEnum = "CUSTOMER_MANAGED" + FastConnectProviderServicePrivatePeeringBgpManagementProviderManaged FastConnectProviderServicePrivatePeeringBgpManagementEnum = "PROVIDER_MANAGED" + FastConnectProviderServicePrivatePeeringBgpManagementOracleManaged FastConnectProviderServicePrivatePeeringBgpManagementEnum = "ORACLE_MANAGED" +) + +var mappingFastConnectProviderServicePrivatePeeringBgpManagement = map[string]FastConnectProviderServicePrivatePeeringBgpManagementEnum{ + "CUSTOMER_MANAGED": FastConnectProviderServicePrivatePeeringBgpManagementCustomerManaged, + "PROVIDER_MANAGED": FastConnectProviderServicePrivatePeeringBgpManagementProviderManaged, + "ORACLE_MANAGED": FastConnectProviderServicePrivatePeeringBgpManagementOracleManaged, +} + +// GetFastConnectProviderServicePrivatePeeringBgpManagementEnumValues Enumerates the set of values for FastConnectProviderServicePrivatePeeringBgpManagement +func GetFastConnectProviderServicePrivatePeeringBgpManagementEnumValues() []FastConnectProviderServicePrivatePeeringBgpManagementEnum { + values := make([]FastConnectProviderServicePrivatePeeringBgpManagementEnum, 0) + for _, v := range mappingFastConnectProviderServicePrivatePeeringBgpManagement { + values = append(values, v) + } + return values +} + +// FastConnectProviderServicePublicPeeringBgpManagementEnum Enum with underlying type: string +type FastConnectProviderServicePublicPeeringBgpManagementEnum string + +// Set of constants representing the allowable values for FastConnectProviderServicePublicPeeringBgpManagement +const ( + FastConnectProviderServicePublicPeeringBgpManagementCustomerManaged FastConnectProviderServicePublicPeeringBgpManagementEnum = "CUSTOMER_MANAGED" + FastConnectProviderServicePublicPeeringBgpManagementProviderManaged FastConnectProviderServicePublicPeeringBgpManagementEnum = "PROVIDER_MANAGED" + FastConnectProviderServicePublicPeeringBgpManagementOracleManaged FastConnectProviderServicePublicPeeringBgpManagementEnum = "ORACLE_MANAGED" +) + +var mappingFastConnectProviderServicePublicPeeringBgpManagement = map[string]FastConnectProviderServicePublicPeeringBgpManagementEnum{ + "CUSTOMER_MANAGED": FastConnectProviderServicePublicPeeringBgpManagementCustomerManaged, + "PROVIDER_MANAGED": FastConnectProviderServicePublicPeeringBgpManagementProviderManaged, + "ORACLE_MANAGED": FastConnectProviderServicePublicPeeringBgpManagementOracleManaged, +} + +// GetFastConnectProviderServicePublicPeeringBgpManagementEnumValues Enumerates the set of values for FastConnectProviderServicePublicPeeringBgpManagement +func GetFastConnectProviderServicePublicPeeringBgpManagementEnumValues() []FastConnectProviderServicePublicPeeringBgpManagementEnum { + values := make([]FastConnectProviderServicePublicPeeringBgpManagementEnum, 0) + for _, v := range mappingFastConnectProviderServicePublicPeeringBgpManagement { + values = append(values, v) + } + return values +} + +// FastConnectProviderServiceSupportedVirtualCircuitTypesEnum Enum with underlying type: string +type FastConnectProviderServiceSupportedVirtualCircuitTypesEnum string + +// Set of constants representing the allowable values for FastConnectProviderServiceSupportedVirtualCircuitTypes +const ( + FastConnectProviderServiceSupportedVirtualCircuitTypesPublic FastConnectProviderServiceSupportedVirtualCircuitTypesEnum = "PUBLIC" + FastConnectProviderServiceSupportedVirtualCircuitTypesPrivate FastConnectProviderServiceSupportedVirtualCircuitTypesEnum = "PRIVATE" +) + +var mappingFastConnectProviderServiceSupportedVirtualCircuitTypes = map[string]FastConnectProviderServiceSupportedVirtualCircuitTypesEnum{ + "PUBLIC": FastConnectProviderServiceSupportedVirtualCircuitTypesPublic, + "PRIVATE": FastConnectProviderServiceSupportedVirtualCircuitTypesPrivate, +} + +// GetFastConnectProviderServiceSupportedVirtualCircuitTypesEnumValues Enumerates the set of values for FastConnectProviderServiceSupportedVirtualCircuitTypes +func GetFastConnectProviderServiceSupportedVirtualCircuitTypesEnumValues() []FastConnectProviderServiceSupportedVirtualCircuitTypesEnum { + values := make([]FastConnectProviderServiceSupportedVirtualCircuitTypesEnum, 0) + for _, v := range mappingFastConnectProviderServiceSupportedVirtualCircuitTypes { + values = append(values, v) + } + return values +} + +// FastConnectProviderServiceTypeEnum Enum with underlying type: string +type FastConnectProviderServiceTypeEnum string + +// Set of constants representing the allowable values for FastConnectProviderServiceType +const ( + FastConnectProviderServiceTypeLayer2 FastConnectProviderServiceTypeEnum = "LAYER2" + FastConnectProviderServiceTypeLayer3 FastConnectProviderServiceTypeEnum = "LAYER3" +) + +var mappingFastConnectProviderServiceType = map[string]FastConnectProviderServiceTypeEnum{ + "LAYER2": FastConnectProviderServiceTypeLayer2, + "LAYER3": FastConnectProviderServiceTypeLayer3, +} + +// GetFastConnectProviderServiceTypeEnumValues Enumerates the set of values for FastConnectProviderServiceType +func GetFastConnectProviderServiceTypeEnumValues() []FastConnectProviderServiceTypeEnum { + values := make([]FastConnectProviderServiceTypeEnum, 0) + for _, v := range mappingFastConnectProviderServiceType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_boot_volume_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_boot_volume_attachment_request_response.go new file mode 100644 index 0000000000..e14e9201bb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_boot_volume_attachment_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetBootVolumeAttachmentRequest wrapper for the GetBootVolumeAttachment operation +type GetBootVolumeAttachmentRequest struct { + + // The OCID of the boot volume attachment. + BootVolumeAttachmentId *string `mandatory:"true" contributesTo:"path" name:"bootVolumeAttachmentId"` +} + +func (request GetBootVolumeAttachmentRequest) String() string { + return common.PointerString(request) +} + +// GetBootVolumeAttachmentResponse wrapper for the GetBootVolumeAttachment operation +type GetBootVolumeAttachmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The BootVolumeAttachment instance + BootVolumeAttachment `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetBootVolumeAttachmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_boot_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_boot_volume_request_response.go new file mode 100644 index 0000000000..95c3d09093 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_boot_volume_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetBootVolumeRequest wrapper for the GetBootVolume operation +type GetBootVolumeRequest struct { + + // The OCID of the boot volume. + BootVolumeId *string `mandatory:"true" contributesTo:"path" name:"bootVolumeId"` +} + +func (request GetBootVolumeRequest) String() string { + return common.PointerString(request) +} + +// GetBootVolumeResponse wrapper for the GetBootVolume operation +type GetBootVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The BootVolume instance + BootVolume `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetBootVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_console_history_content_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_console_history_content_request_response.go new file mode 100644 index 0000000000..4fc8e50ba8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_console_history_content_request_response.go @@ -0,0 +1,47 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetConsoleHistoryContentRequest wrapper for the GetConsoleHistoryContent operation +type GetConsoleHistoryContentRequest struct { + + // The OCID of the console history. + InstanceConsoleHistoryId *string `mandatory:"true" contributesTo:"path" name:"instanceConsoleHistoryId"` + + // Offset of the snapshot data to retrieve. + Offset *int `mandatory:"false" contributesTo:"query" name:"offset"` + + // Length of the snapshot data to retrieve. + Length *int `mandatory:"false" contributesTo:"query" name:"length"` +} + +func (request GetConsoleHistoryContentRequest) String() string { + return common.PointerString(request) +} + +// GetConsoleHistoryContentResponse wrapper for the GetConsoleHistoryContent operation +type GetConsoleHistoryContentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The string instance + Value *string `presentIn:"body" encoding:"plain-text"` + + // The number of bytes remaining in the snapshot. + OpcBytesRemaining *int `presentIn:"header" name:"opc-bytes-remaining"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetConsoleHistoryContentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_console_history_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_console_history_request_response.go new file mode 100644 index 0000000000..b5aa9eb388 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_console_history_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetConsoleHistoryRequest wrapper for the GetConsoleHistory operation +type GetConsoleHistoryRequest struct { + + // The OCID of the console history. + InstanceConsoleHistoryId *string `mandatory:"true" contributesTo:"path" name:"instanceConsoleHistoryId"` +} + +func (request GetConsoleHistoryRequest) String() string { + return common.PointerString(request) +} + +// GetConsoleHistoryResponse wrapper for the GetConsoleHistory operation +type GetConsoleHistoryResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The ConsoleHistory instance + ConsoleHistory `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetConsoleHistoryResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_cpe_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_cpe_request_response.go new file mode 100644 index 0000000000..0ed76a7f99 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_cpe_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetCpeRequest wrapper for the GetCpe operation +type GetCpeRequest struct { + + // The OCID of the CPE. + CpeId *string `mandatory:"true" contributesTo:"path" name:"cpeId"` +} + +func (request GetCpeRequest) String() string { + return common.PointerString(request) +} + +// GetCpeResponse wrapper for the GetCpe operation +type GetCpeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Cpe instance + Cpe `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetCpeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_group_request_response.go new file mode 100644 index 0000000000..fd3d8803e5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_group_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetCrossConnectGroupRequest wrapper for the GetCrossConnectGroup operation +type GetCrossConnectGroupRequest struct { + + // The OCID of the cross-connect group. + CrossConnectGroupId *string `mandatory:"true" contributesTo:"path" name:"crossConnectGroupId"` +} + +func (request GetCrossConnectGroupRequest) String() string { + return common.PointerString(request) +} + +// GetCrossConnectGroupResponse wrapper for the GetCrossConnectGroup operation +type GetCrossConnectGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CrossConnectGroup instance + CrossConnectGroup `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetCrossConnectGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_letter_of_authority_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_letter_of_authority_request_response.go new file mode 100644 index 0000000000..674ea1f194 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_letter_of_authority_request_response.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetCrossConnectLetterOfAuthorityRequest wrapper for the GetCrossConnectLetterOfAuthority operation +type GetCrossConnectLetterOfAuthorityRequest struct { + + // The OCID of the cross-connect. + CrossConnectId *string `mandatory:"true" contributesTo:"path" name:"crossConnectId"` +} + +func (request GetCrossConnectLetterOfAuthorityRequest) String() string { + return common.PointerString(request) +} + +// GetCrossConnectLetterOfAuthorityResponse wrapper for the GetCrossConnectLetterOfAuthority operation +type GetCrossConnectLetterOfAuthorityResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The LetterOfAuthority instance + LetterOfAuthority `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetCrossConnectLetterOfAuthorityResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_request_response.go new file mode 100644 index 0000000000..b505c6ad5e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetCrossConnectRequest wrapper for the GetCrossConnect operation +type GetCrossConnectRequest struct { + + // The OCID of the cross-connect. + CrossConnectId *string `mandatory:"true" contributesTo:"path" name:"crossConnectId"` +} + +func (request GetCrossConnectRequest) String() string { + return common.PointerString(request) +} + +// GetCrossConnectResponse wrapper for the GetCrossConnect operation +type GetCrossConnectResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CrossConnect instance + CrossConnect `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetCrossConnectResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_status_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_status_request_response.go new file mode 100644 index 0000000000..cf826242ef --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_cross_connect_status_request_response.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetCrossConnectStatusRequest wrapper for the GetCrossConnectStatus operation +type GetCrossConnectStatusRequest struct { + + // The OCID of the cross-connect. + CrossConnectId *string `mandatory:"true" contributesTo:"path" name:"crossConnectId"` +} + +func (request GetCrossConnectStatusRequest) String() string { + return common.PointerString(request) +} + +// GetCrossConnectStatusResponse wrapper for the GetCrossConnectStatus operation +type GetCrossConnectStatusResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CrossConnectStatus instance + CrossConnectStatus `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetCrossConnectStatusResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_dhcp_options_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_dhcp_options_request_response.go new file mode 100644 index 0000000000..72f46761c0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_dhcp_options_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDhcpOptionsRequest wrapper for the GetDhcpOptions operation +type GetDhcpOptionsRequest struct { + + // The OCID for the set of DHCP options. + DhcpId *string `mandatory:"true" contributesTo:"path" name:"dhcpId"` +} + +func (request GetDhcpOptionsRequest) String() string { + return common.PointerString(request) +} + +// GetDhcpOptionsResponse wrapper for the GetDhcpOptions operation +type GetDhcpOptionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DhcpOptions instance + DhcpOptions `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDhcpOptionsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_drg_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_drg_attachment_request_response.go new file mode 100644 index 0000000000..b485721ae2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_drg_attachment_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDrgAttachmentRequest wrapper for the GetDrgAttachment operation +type GetDrgAttachmentRequest struct { + + // The OCID of the DRG attachment. + DrgAttachmentId *string `mandatory:"true" contributesTo:"path" name:"drgAttachmentId"` +} + +func (request GetDrgAttachmentRequest) String() string { + return common.PointerString(request) +} + +// GetDrgAttachmentResponse wrapper for the GetDrgAttachment operation +type GetDrgAttachmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DrgAttachment instance + DrgAttachment `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDrgAttachmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_drg_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_drg_request_response.go new file mode 100644 index 0000000000..4488accfcb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_drg_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDrgRequest wrapper for the GetDrg operation +type GetDrgRequest struct { + + // The OCID of the DRG. + DrgId *string `mandatory:"true" contributesTo:"path" name:"drgId"` +} + +func (request GetDrgRequest) String() string { + return common.PointerString(request) +} + +// GetDrgResponse wrapper for the GetDrg operation +type GetDrgResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Drg instance + Drg `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDrgResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_fast_connect_provider_service_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_fast_connect_provider_service_request_response.go new file mode 100644 index 0000000000..28b3524030 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_fast_connect_provider_service_request_response.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetFastConnectProviderServiceRequest wrapper for the GetFastConnectProviderService operation +type GetFastConnectProviderServiceRequest struct { + + // The OCID of the provider service. + ProviderServiceId *string `mandatory:"true" contributesTo:"path" name:"providerServiceId"` +} + +func (request GetFastConnectProviderServiceRequest) String() string { + return common.PointerString(request) +} + +// GetFastConnectProviderServiceResponse wrapper for the GetFastConnectProviderService operation +type GetFastConnectProviderServiceResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The FastConnectProviderService instance + FastConnectProviderService `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetFastConnectProviderServiceResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_i_p_sec_connection_device_config_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_i_p_sec_connection_device_config_request_response.go new file mode 100644 index 0000000000..a41b69aede --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_i_p_sec_connection_device_config_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetIPSecConnectionDeviceConfigRequest wrapper for the GetIPSecConnectionDeviceConfig operation +type GetIPSecConnectionDeviceConfigRequest struct { + + // The OCID of the IPSec connection. + IpscId *string `mandatory:"true" contributesTo:"path" name:"ipscId"` +} + +func (request GetIPSecConnectionDeviceConfigRequest) String() string { + return common.PointerString(request) +} + +// GetIPSecConnectionDeviceConfigResponse wrapper for the GetIPSecConnectionDeviceConfig operation +type GetIPSecConnectionDeviceConfigResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IpSecConnectionDeviceConfig instance + IpSecConnectionDeviceConfig `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetIPSecConnectionDeviceConfigResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_i_p_sec_connection_device_status_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_i_p_sec_connection_device_status_request_response.go new file mode 100644 index 0000000000..c3fbde11dc --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_i_p_sec_connection_device_status_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetIPSecConnectionDeviceStatusRequest wrapper for the GetIPSecConnectionDeviceStatus operation +type GetIPSecConnectionDeviceStatusRequest struct { + + // The OCID of the IPSec connection. + IpscId *string `mandatory:"true" contributesTo:"path" name:"ipscId"` +} + +func (request GetIPSecConnectionDeviceStatusRequest) String() string { + return common.PointerString(request) +} + +// GetIPSecConnectionDeviceStatusResponse wrapper for the GetIPSecConnectionDeviceStatus operation +type GetIPSecConnectionDeviceStatusResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IpSecConnectionDeviceStatus instance + IpSecConnectionDeviceStatus `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetIPSecConnectionDeviceStatusResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_i_p_sec_connection_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_i_p_sec_connection_request_response.go new file mode 100644 index 0000000000..1ba8d86d05 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_i_p_sec_connection_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetIPSecConnectionRequest wrapper for the GetIPSecConnection operation +type GetIPSecConnectionRequest struct { + + // The OCID of the IPSec connection. + IpscId *string `mandatory:"true" contributesTo:"path" name:"ipscId"` +} + +func (request GetIPSecConnectionRequest) String() string { + return common.PointerString(request) +} + +// GetIPSecConnectionResponse wrapper for the GetIPSecConnection operation +type GetIPSecConnectionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IpSecConnection instance + IpSecConnection `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetIPSecConnectionResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_image_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_image_request_response.go new file mode 100644 index 0000000000..9c64a24293 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_image_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetImageRequest wrapper for the GetImage operation +type GetImageRequest struct { + + // The OCID of the image. + ImageId *string `mandatory:"true" contributesTo:"path" name:"imageId"` +} + +func (request GetImageRequest) String() string { + return common.PointerString(request) +} + +// GetImageResponse wrapper for the GetImage operation +type GetImageResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Image instance + Image `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetImageResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_instance_console_connection_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_instance_console_connection_request_response.go new file mode 100644 index 0000000000..c90d9c464d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_instance_console_connection_request_response.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetInstanceConsoleConnectionRequest wrapper for the GetInstanceConsoleConnection operation +type GetInstanceConsoleConnectionRequest struct { + + // The OCID of the intance console connection + InstanceConsoleConnectionId *string `mandatory:"true" contributesTo:"path" name:"instanceConsoleConnectionId"` +} + +func (request GetInstanceConsoleConnectionRequest) String() string { + return common.PointerString(request) +} + +// GetInstanceConsoleConnectionResponse wrapper for the GetInstanceConsoleConnection operation +type GetInstanceConsoleConnectionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The InstanceConsoleConnection instance + InstanceConsoleConnection `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetInstanceConsoleConnectionResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_instance_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_instance_request_response.go new file mode 100644 index 0000000000..8619c5ade1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_instance_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetInstanceRequest wrapper for the GetInstance operation +type GetInstanceRequest struct { + + // The OCID of the instance. + InstanceId *string `mandatory:"true" contributesTo:"path" name:"instanceId"` +} + +func (request GetInstanceRequest) String() string { + return common.PointerString(request) +} + +// GetInstanceResponse wrapper for the GetInstance operation +type GetInstanceResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Instance instance + Instance `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetInstanceResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_internet_gateway_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_internet_gateway_request_response.go new file mode 100644 index 0000000000..61423dffb1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_internet_gateway_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetInternetGatewayRequest wrapper for the GetInternetGateway operation +type GetInternetGatewayRequest struct { + + // The OCID of the Internet Gateway. + IgId *string `mandatory:"true" contributesTo:"path" name:"igId"` +} + +func (request GetInternetGatewayRequest) String() string { + return common.PointerString(request) +} + +// GetInternetGatewayResponse wrapper for the GetInternetGateway operation +type GetInternetGatewayResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The InternetGateway instance + InternetGateway `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetInternetGatewayResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_local_peering_gateway_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_local_peering_gateway_request_response.go new file mode 100644 index 0000000000..3a04a7c17b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_local_peering_gateway_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetLocalPeeringGatewayRequest wrapper for the GetLocalPeeringGateway operation +type GetLocalPeeringGatewayRequest struct { + + // The OCID of the local peering gateway. + LocalPeeringGatewayId *string `mandatory:"true" contributesTo:"path" name:"localPeeringGatewayId"` +} + +func (request GetLocalPeeringGatewayRequest) String() string { + return common.PointerString(request) +} + +// GetLocalPeeringGatewayResponse wrapper for the GetLocalPeeringGateway operation +type GetLocalPeeringGatewayResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The LocalPeeringGateway instance + LocalPeeringGateway `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetLocalPeeringGatewayResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_private_ip_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_private_ip_request_response.go new file mode 100644 index 0000000000..778c771bff --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_private_ip_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetPrivateIpRequest wrapper for the GetPrivateIp operation +type GetPrivateIpRequest struct { + + // The private IP's OCID. + PrivateIpId *string `mandatory:"true" contributesTo:"path" name:"privateIpId"` +} + +func (request GetPrivateIpRequest) String() string { + return common.PointerString(request) +} + +// GetPrivateIpResponse wrapper for the GetPrivateIp operation +type GetPrivateIpResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The PrivateIp instance + PrivateIp `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetPrivateIpResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_route_table_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_route_table_request_response.go new file mode 100644 index 0000000000..f74bee61b9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_route_table_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetRouteTableRequest wrapper for the GetRouteTable operation +type GetRouteTableRequest struct { + + // The OCID of the route table. + RtId *string `mandatory:"true" contributesTo:"path" name:"rtId"` +} + +func (request GetRouteTableRequest) String() string { + return common.PointerString(request) +} + +// GetRouteTableResponse wrapper for the GetRouteTable operation +type GetRouteTableResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The RouteTable instance + RouteTable `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetRouteTableResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_security_list_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_security_list_request_response.go new file mode 100644 index 0000000000..a62a52d895 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_security_list_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetSecurityListRequest wrapper for the GetSecurityList operation +type GetSecurityListRequest struct { + + // The OCID of the security list. + SecurityListId *string `mandatory:"true" contributesTo:"path" name:"securityListId"` +} + +func (request GetSecurityListRequest) String() string { + return common.PointerString(request) +} + +// GetSecurityListResponse wrapper for the GetSecurityList operation +type GetSecurityListResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The SecurityList instance + SecurityList `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetSecurityListResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_subnet_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_subnet_request_response.go new file mode 100644 index 0000000000..a8ffa4c103 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_subnet_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetSubnetRequest wrapper for the GetSubnet operation +type GetSubnetRequest struct { + + // The OCID of the subnet. + SubnetId *string `mandatory:"true" contributesTo:"path" name:"subnetId"` +} + +func (request GetSubnetRequest) String() string { + return common.PointerString(request) +} + +// GetSubnetResponse wrapper for the GetSubnet operation +type GetSubnetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Subnet instance + Subnet `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetSubnetResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_vcn_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_vcn_request_response.go new file mode 100644 index 0000000000..5696f7c3fe --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_vcn_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetVcnRequest wrapper for the GetVcn operation +type GetVcnRequest struct { + + // The OCID of the VCN. + VcnId *string `mandatory:"true" contributesTo:"path" name:"vcnId"` +} + +func (request GetVcnRequest) String() string { + return common.PointerString(request) +} + +// GetVcnResponse wrapper for the GetVcn operation +type GetVcnResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Vcn instance + Vcn `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetVcnResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_virtual_circuit_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_virtual_circuit_request_response.go new file mode 100644 index 0000000000..85ac112591 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_virtual_circuit_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetVirtualCircuitRequest wrapper for the GetVirtualCircuit operation +type GetVirtualCircuitRequest struct { + + // The OCID of the virtual circuit. + VirtualCircuitId *string `mandatory:"true" contributesTo:"path" name:"virtualCircuitId"` +} + +func (request GetVirtualCircuitRequest) String() string { + return common.PointerString(request) +} + +// GetVirtualCircuitResponse wrapper for the GetVirtualCircuit operation +type GetVirtualCircuitResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VirtualCircuit instance + VirtualCircuit `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetVirtualCircuitResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_vnic_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_vnic_attachment_request_response.go new file mode 100644 index 0000000000..3c0e62d0e4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_vnic_attachment_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetVnicAttachmentRequest wrapper for the GetVnicAttachment operation +type GetVnicAttachmentRequest struct { + + // The OCID of the VNIC attachment. + VnicAttachmentId *string `mandatory:"true" contributesTo:"path" name:"vnicAttachmentId"` +} + +func (request GetVnicAttachmentRequest) String() string { + return common.PointerString(request) +} + +// GetVnicAttachmentResponse wrapper for the GetVnicAttachment operation +type GetVnicAttachmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VnicAttachment instance + VnicAttachment `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetVnicAttachmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_vnic_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_vnic_request_response.go new file mode 100644 index 0000000000..6f52d96c57 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_vnic_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetVnicRequest wrapper for the GetVnic operation +type GetVnicRequest struct { + + // The OCID of the VNIC. + VnicId *string `mandatory:"true" contributesTo:"path" name:"vnicId"` +} + +func (request GetVnicRequest) String() string { + return common.PointerString(request) +} + +// GetVnicResponse wrapper for the GetVnic operation +type GetVnicResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Vnic instance + Vnic `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetVnicResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_volume_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_volume_attachment_request_response.go new file mode 100644 index 0000000000..e9492439f6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_volume_attachment_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetVolumeAttachmentRequest wrapper for the GetVolumeAttachment operation +type GetVolumeAttachmentRequest struct { + + // The OCID of the volume attachment. + VolumeAttachmentId *string `mandatory:"true" contributesTo:"path" name:"volumeAttachmentId"` +} + +func (request GetVolumeAttachmentRequest) String() string { + return common.PointerString(request) +} + +// GetVolumeAttachmentResponse wrapper for the GetVolumeAttachment operation +type GetVolumeAttachmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VolumeAttachment instance + VolumeAttachment `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetVolumeAttachmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_volume_backup_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_volume_backup_request_response.go new file mode 100644 index 0000000000..6ca44c9777 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_volume_backup_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetVolumeBackupRequest wrapper for the GetVolumeBackup operation +type GetVolumeBackupRequest struct { + + // The OCID of the volume backup. + VolumeBackupId *string `mandatory:"true" contributesTo:"path" name:"volumeBackupId"` +} + +func (request GetVolumeBackupRequest) String() string { + return common.PointerString(request) +} + +// GetVolumeBackupResponse wrapper for the GetVolumeBackup operation +type GetVolumeBackupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VolumeBackup instance + VolumeBackup `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetVolumeBackupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_volume_request_response.go new file mode 100644 index 0000000000..57e71a0f26 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_volume_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetVolumeRequest wrapper for the GetVolume operation +type GetVolumeRequest struct { + + // The OCID of the volume. + VolumeId *string `mandatory:"true" contributesTo:"path" name:"volumeId"` +} + +func (request GetVolumeRequest) String() string { + return common.PointerString(request) +} + +// GetVolumeResponse wrapper for the GetVolume operation +type GetVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Volume instance + Volume `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/get_windows_instance_initial_credentials_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/get_windows_instance_initial_credentials_request_response.go new file mode 100644 index 0000000000..98d138e2b5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/get_windows_instance_initial_credentials_request_response.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetWindowsInstanceInitialCredentialsRequest wrapper for the GetWindowsInstanceInitialCredentials operation +type GetWindowsInstanceInitialCredentialsRequest struct { + + // The OCID of the instance. + InstanceId *string `mandatory:"true" contributesTo:"path" name:"instanceId"` +} + +func (request GetWindowsInstanceInitialCredentialsRequest) String() string { + return common.PointerString(request) +} + +// GetWindowsInstanceInitialCredentialsResponse wrapper for the GetWindowsInstanceInitialCredentials operation +type GetWindowsInstanceInitialCredentialsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The InstanceCredentials instance + InstanceCredentials `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetWindowsInstanceInitialCredentialsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/i_scsi_volume_attachment.go b/vendor/github.com/oracle/oci-go-sdk/core/i_scsi_volume_attachment.go new file mode 100644 index 0000000000..107ab34f37 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/i_scsi_volume_attachment.go @@ -0,0 +1,125 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// IScsiVolumeAttachment An ISCSI volume attachment. +type IScsiVolumeAttachment struct { + + // The Availability Domain of an instance. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the volume attachment. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the instance the volume is attached to. + InstanceId *string `mandatory:"true" json:"instanceId"` + + // The date and time the volume was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The OCID of the volume. + VolumeId *string `mandatory:"true" json:"volumeId"` + + // The volume's iSCSI IP address. + // Example: `169.254.0.2` + Ipv4 *string `mandatory:"true" json:"ipv4"` + + // The target volume's iSCSI Qualified Name in the format defined by RFC 3720. + // Example: `iqn.2015-12.us.oracle.com:456b0391-17b8-4122-bbf1-f85fc0bb97d9` + Iqn *string `mandatory:"true" json:"iqn"` + + // The volume's iSCSI port. + // Example: `3260` + Port *int `mandatory:"true" json:"port"` + + // A user-friendly name. Does not have to be unique, and it cannot be changed. + // Avoid entering confidential information. + // Example: `My volume attachment` + DisplayName *string `mandatory:"false" json:"displayName"` + + // The Challenge-Handshake-Authentication-Protocol (CHAP) secret valid for the associated CHAP user name. + // (Also called the "CHAP password".) + // Example: `d6866c0d-298b-48ba-95af-309b4faux45e` + ChapSecret *string `mandatory:"false" json:"chapSecret"` + + // The volume's system-generated Challenge-Handshake-Authentication-Protocol (CHAP) user name. + // Example: `ocid1.volume.oc1.phx.abyhqljrgvttnlx73nmrwfaux7kcvzfs3s66izvxf2h4lgvyndsdsnoiwr5q` + ChapUsername *string `mandatory:"false" json:"chapUsername"` + + // The current state of the volume attachment. + LifecycleState VolumeAttachmentLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` +} + +//GetAvailabilityDomain returns AvailabilityDomain +func (m IScsiVolumeAttachment) GetAvailabilityDomain() *string { + return m.AvailabilityDomain +} + +//GetCompartmentId returns CompartmentId +func (m IScsiVolumeAttachment) GetCompartmentId() *string { + return m.CompartmentId +} + +//GetDisplayName returns DisplayName +func (m IScsiVolumeAttachment) GetDisplayName() *string { + return m.DisplayName +} + +//GetId returns Id +func (m IScsiVolumeAttachment) GetId() *string { + return m.Id +} + +//GetInstanceId returns InstanceId +func (m IScsiVolumeAttachment) GetInstanceId() *string { + return m.InstanceId +} + +//GetLifecycleState returns LifecycleState +func (m IScsiVolumeAttachment) GetLifecycleState() VolumeAttachmentLifecycleStateEnum { + return m.LifecycleState +} + +//GetTimeCreated returns TimeCreated +func (m IScsiVolumeAttachment) GetTimeCreated() *common.SDKTime { + return m.TimeCreated +} + +//GetVolumeId returns VolumeId +func (m IScsiVolumeAttachment) GetVolumeId() *string { + return m.VolumeId +} + +func (m IScsiVolumeAttachment) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m IScsiVolumeAttachment) MarshalJSON() (buff []byte, e error) { + type MarshalTypeIScsiVolumeAttachment IScsiVolumeAttachment + s := struct { + DiscriminatorParam string `json:"attachmentType"` + MarshalTypeIScsiVolumeAttachment + }{ + "iscsi", + (MarshalTypeIScsiVolumeAttachment)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/icmp_options.go b/vendor/github.com/oracle/oci-go-sdk/core/icmp_options.go new file mode 100644 index 0000000000..79b841e78a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/icmp_options.go @@ -0,0 +1,33 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// IcmpOptions Optional object to specify a particular ICMP type and code. If you specify ICMP as the protocol +// but do not provide this object, then all ICMP types and codes are allowed. If you do provide +// this object, the type is required and the code is optional. +// See ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) +// for allowed values. To enable MTU negotiation for ingress internet traffic, make sure to allow +// type 3 ("Destination Unreachable") code 4 ("Fragmentation Needed and Don't Fragment was Set"). +// If you need to specify multiple codes for a single type, create a separate security list rule for each. +type IcmpOptions struct { + + // The ICMP type. + Type *int `mandatory:"true" json:"type"` + + // The ICMP code (optional). + Code *int `mandatory:"false" json:"code"` +} + +func (m IcmpOptions) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/image.go b/vendor/github.com/oracle/oci-go-sdk/core/image.go new file mode 100644 index 0000000000..250a1af1c2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/image.go @@ -0,0 +1,90 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Image A boot disk image for launching an instance. For more information, see +// Overview of the Compute Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Concepts/computeoverview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Image struct { + + // The OCID of the compartment containing the instance you want to use as the basis for the image. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Whether instances launched with this image can be used to create new images. + // For example, you cannot create an image of an Oracle Database instance. + // Example: `true` + CreateImageAllowed *bool `mandatory:"true" json:"createImageAllowed"` + + // The OCID of the image. + Id *string `mandatory:"true" json:"id"` + + LifecycleState ImageLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The image's operating system. + // Example: `Oracle Linux` + OperatingSystem *string `mandatory:"true" json:"operatingSystem"` + + // The image's operating system version. + // Example: `7.2` + OperatingSystemVersion *string `mandatory:"true" json:"operatingSystemVersion"` + + // The date and time the image was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The OCID of the image originally used to launch the instance. + BaseImageId *string `mandatory:"false" json:"baseImageId"` + + // A user-friendly name for the image. It does not have to be unique, and it's changeable. + // Avoid entering confidential information. + // You cannot use an Oracle-provided image name as a custom image name. + // Example: `My custom Oracle Linux image` + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m Image) String() string { + return common.PointerString(m) +} + +// ImageLifecycleStateEnum Enum with underlying type: string +type ImageLifecycleStateEnum string + +// Set of constants representing the allowable values for ImageLifecycleState +const ( + ImageLifecycleStateProvisioning ImageLifecycleStateEnum = "PROVISIONING" + ImageLifecycleStateImporting ImageLifecycleStateEnum = "IMPORTING" + ImageLifecycleStateAvailable ImageLifecycleStateEnum = "AVAILABLE" + ImageLifecycleStateExporting ImageLifecycleStateEnum = "EXPORTING" + ImageLifecycleStateDisabled ImageLifecycleStateEnum = "DISABLED" + ImageLifecycleStateDeleted ImageLifecycleStateEnum = "DELETED" +) + +var mappingImageLifecycleState = map[string]ImageLifecycleStateEnum{ + "PROVISIONING": ImageLifecycleStateProvisioning, + "IMPORTING": ImageLifecycleStateImporting, + "AVAILABLE": ImageLifecycleStateAvailable, + "EXPORTING": ImageLifecycleStateExporting, + "DISABLED": ImageLifecycleStateDisabled, + "DELETED": ImageLifecycleStateDeleted, +} + +// GetImageLifecycleStateEnumValues Enumerates the set of values for ImageLifecycleState +func GetImageLifecycleStateEnumValues() []ImageLifecycleStateEnum { + values := make([]ImageLifecycleStateEnum, 0) + for _, v := range mappingImageLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/image_source_details.go b/vendor/github.com/oracle/oci-go-sdk/core/image_source_details.go new file mode 100644 index 0000000000..ae8d32acb1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/image_source_details.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// ImageSourceDetails The representation of ImageSourceDetails +type ImageSourceDetails interface { +} + +type imagesourcedetails struct { + JsonData []byte + SourceType string `json:"sourceType"` +} + +// UnmarshalJSON unmarshals json +func (m *imagesourcedetails) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerimagesourcedetails imagesourcedetails + s := struct { + Model Unmarshalerimagesourcedetails + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.SourceType = s.Model.SourceType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *imagesourcedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.SourceType { + case "objectStorageTuple": + mm := ImageSourceViaObjectStorageTupleDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + case "objectStorageUri": + mm := ImageSourceViaObjectStorageUriDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +func (m imagesourcedetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/image_source_via_object_storage_tuple_details.go b/vendor/github.com/oracle/oci-go-sdk/core/image_source_via_object_storage_tuple_details.go new file mode 100644 index 0000000000..61eddb488e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/image_source_via_object_storage_tuple_details.go @@ -0,0 +1,45 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// ImageSourceViaObjectStorageTupleDetails The representation of ImageSourceViaObjectStorageTupleDetails +type ImageSourceViaObjectStorageTupleDetails struct { + + // The Object Storage bucket for the image. + BucketName *string `mandatory:"true" json:"bucketName"` + + // The Object Storage namespace for the image. + NamespaceName *string `mandatory:"true" json:"namespaceName"` + + // The Object Storage name for the image. + ObjectName *string `mandatory:"true" json:"objectName"` +} + +func (m ImageSourceViaObjectStorageTupleDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m ImageSourceViaObjectStorageTupleDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeImageSourceViaObjectStorageTupleDetails ImageSourceViaObjectStorageTupleDetails + s := struct { + DiscriminatorParam string `json:"sourceType"` + MarshalTypeImageSourceViaObjectStorageTupleDetails + }{ + "objectStorageTuple", + (MarshalTypeImageSourceViaObjectStorageTupleDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/image_source_via_object_storage_uri_details.go b/vendor/github.com/oracle/oci-go-sdk/core/image_source_via_object_storage_uri_details.go new file mode 100644 index 0000000000..e65376d4df --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/image_source_via_object_storage_uri_details.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// ImageSourceViaObjectStorageUriDetails The representation of ImageSourceViaObjectStorageUriDetails +type ImageSourceViaObjectStorageUriDetails struct { + + // The Object Storage URL for the image. + SourceUri *string `mandatory:"true" json:"sourceUri"` +} + +func (m ImageSourceViaObjectStorageUriDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m ImageSourceViaObjectStorageUriDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeImageSourceViaObjectStorageUriDetails ImageSourceViaObjectStorageUriDetails + s := struct { + DiscriminatorParam string `json:"sourceType"` + MarshalTypeImageSourceViaObjectStorageUriDetails + }{ + "objectStorageUri", + (MarshalTypeImageSourceViaObjectStorageUriDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/ingress_security_rule.go b/vendor/github.com/oracle/oci-go-sdk/core/ingress_security_rule.go new file mode 100644 index 0000000000..fbd7d7561f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/ingress_security_rule.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// IngressSecurityRule A rule for allowing inbound IP packets. +type IngressSecurityRule struct { + + // The transport protocol. Specify either `all` or an IPv4 protocol number as + // defined in + // Protocol Numbers (http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). + // Options are supported only for ICMP ("1"), TCP ("6"), and UDP ("17"). + Protocol *string `mandatory:"true" json:"protocol"` + + // The source CIDR block for the ingress rule. This is the range of IP addresses that a + // packet coming into the instance can come from. + Source *string `mandatory:"true" json:"source"` + + // Optional and valid only for ICMP. Use to specify a particular ICMP type and code + // as defined in + // ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml). + // If you specify ICMP as the protocol but omit this object, then all ICMP types and + // codes are allowed. If you do provide this object, the type is required and the code is optional. + // To enable MTU negotiation for ingress internet traffic, make sure to allow type 3 ("Destination + // Unreachable") code 4 ("Fragmentation Needed and Don't Fragment was Set"). If you need to specify + // multiple codes for a single type, create a separate security list rule for each. + IcmpOptions *IcmpOptions `mandatory:"false" json:"icmpOptions"` + + // A stateless rule allows traffic in one direction. Remember to add a corresponding + // stateless rule in the other direction if you need to support bidirectional traffic. For + // example, if ingress traffic allows TCP destination port 80, there should be an egress + // rule to allow TCP source port 80. Defaults to false, which means the rule is stateful + // and a corresponding rule is not necessary for bidirectional traffic. + IsStateless *bool `mandatory:"false" json:"isStateless"` + + // Optional and valid only for TCP. Use to specify particular destination ports for TCP rules. + // If you specify TCP as the protocol but omit this object, then all destination ports are allowed. + TcpOptions *TcpOptions `mandatory:"false" json:"tcpOptions"` + + // Optional and valid only for UDP. Use to specify particular destination ports for UDP rules. + // If you specify UDP as the protocol but omit this object, then all destination ports are allowed. + UdpOptions *UdpOptions `mandatory:"false" json:"udpOptions"` +} + +func (m IngressSecurityRule) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/instance.go b/vendor/github.com/oracle/oci-go-sdk/core/instance.go new file mode 100644 index 0000000000..afad7986f5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/instance.go @@ -0,0 +1,170 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// Instance A compute host. The image used to launch the instance determines its operating system and other +// software. The shape specified during the launch process determines the number of CPUs and memory +// allocated to the instance. For more information, see +// Overview of the Compute Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Concepts/computeoverview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Instance struct { + + // The Availability Domain the instance is running in. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment that contains the instance. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the instance. + Id *string `mandatory:"true" json:"id"` + + // The current state of the instance. + LifecycleState InstanceLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The region that contains the Availability Domain the instance is running in. + // Example: `phx` + Region *string `mandatory:"true" json:"region"` + + // The shape of the instance. The shape determines the number of CPUs and the amount of memory + // allocated to the instance. You can enumerate all available shapes by calling + // ListShapes. + Shape *string `mandatory:"true" json:"shape"` + + // The date and time the instance was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + // Example: `My bare metal instance` + DisplayName *string `mandatory:"false" json:"displayName"` + + // Additional metadata key/value pairs that you provide. They serve a similar purpose and functionality from fields in the 'metadata' object. + // They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only). + // If you don't need nested metadata values, it is strongly advised to avoid using this object and use the Metadata object instead. + ExtendedMetadata map[string]interface{} `mandatory:"false" json:"extendedMetadata"` + + // Deprecated. Use `sourceDetails` instead. + ImageId *string `mandatory:"false" json:"imageId"` + + // When a bare metal or virtual machine + // instance boots, the iPXE firmware that runs on the instance is + // configured to run an iPXE script to continue the boot process. + // If you want more control over the boot process, you can provide + // your own custom iPXE script that will run when the instance boots; + // however, you should be aware that the same iPXE script will run + // every time an instance boots; not only after the initial + // LaunchInstance call. + // The default iPXE script connects to the instance's local boot + // volume over iSCSI and performs a network boot. If you use a custom iPXE + // script and want to network-boot from the instance's local boot volume + // over iSCSI the same way as the default iPXE script, you should use the + // following iSCSI IP address: 169.254.0.2, and boot volume IQN: + // iqn.2015-02.oracle.boot. + // For more information about the Bring Your Own Image feature of + // Oracle Cloud Infrastructure, see + // Bring Your Own Image (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/bringyourownimage.htm). + // For more information about iPXE, see http://ipxe.org. + IpxeScript *string `mandatory:"false" json:"ipxeScript"` + + // Custom metadata that you provide. + Metadata map[string]string `mandatory:"false" json:"metadata"` + + // Details for creating an instance + SourceDetails InstanceSourceDetails `mandatory:"false" json:"sourceDetails"` +} + +func (m Instance) String() string { + return common.PointerString(m) +} + +// UnmarshalJSON unmarshals from json +func (m *Instance) UnmarshalJSON(data []byte) (e error) { + model := struct { + DisplayName *string `json:"displayName"` + ExtendedMetadata map[string]interface{} `json:"extendedMetadata"` + ImageId *string `json:"imageId"` + IpxeScript *string `json:"ipxeScript"` + Metadata map[string]string `json:"metadata"` + SourceDetails instancesourcedetails `json:"sourceDetails"` + AvailabilityDomain *string `json:"availabilityDomain"` + CompartmentId *string `json:"compartmentId"` + Id *string `json:"id"` + LifecycleState InstanceLifecycleStateEnum `json:"lifecycleState"` + Region *string `json:"region"` + Shape *string `json:"shape"` + TimeCreated *common.SDKTime `json:"timeCreated"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + m.DisplayName = model.DisplayName + m.ExtendedMetadata = model.ExtendedMetadata + m.ImageId = model.ImageId + m.IpxeScript = model.IpxeScript + m.Metadata = model.Metadata + nn, e := model.SourceDetails.UnmarshalPolymorphicJSON(model.SourceDetails.JsonData) + if e != nil { + return + } + m.SourceDetails = nn + m.AvailabilityDomain = model.AvailabilityDomain + m.CompartmentId = model.CompartmentId + m.Id = model.Id + m.LifecycleState = model.LifecycleState + m.Region = model.Region + m.Shape = model.Shape + m.TimeCreated = model.TimeCreated + return +} + +// InstanceLifecycleStateEnum Enum with underlying type: string +type InstanceLifecycleStateEnum string + +// Set of constants representing the allowable values for InstanceLifecycleState +const ( + InstanceLifecycleStateProvisioning InstanceLifecycleStateEnum = "PROVISIONING" + InstanceLifecycleStateRunning InstanceLifecycleStateEnum = "RUNNING" + InstanceLifecycleStateStarting InstanceLifecycleStateEnum = "STARTING" + InstanceLifecycleStateStopping InstanceLifecycleStateEnum = "STOPPING" + InstanceLifecycleStateStopped InstanceLifecycleStateEnum = "STOPPED" + InstanceLifecycleStateCreatingImage InstanceLifecycleStateEnum = "CREATING_IMAGE" + InstanceLifecycleStateTerminating InstanceLifecycleStateEnum = "TERMINATING" + InstanceLifecycleStateTerminated InstanceLifecycleStateEnum = "TERMINATED" +) + +var mappingInstanceLifecycleState = map[string]InstanceLifecycleStateEnum{ + "PROVISIONING": InstanceLifecycleStateProvisioning, + "RUNNING": InstanceLifecycleStateRunning, + "STARTING": InstanceLifecycleStateStarting, + "STOPPING": InstanceLifecycleStateStopping, + "STOPPED": InstanceLifecycleStateStopped, + "CREATING_IMAGE": InstanceLifecycleStateCreatingImage, + "TERMINATING": InstanceLifecycleStateTerminating, + "TERMINATED": InstanceLifecycleStateTerminated, +} + +// GetInstanceLifecycleStateEnumValues Enumerates the set of values for InstanceLifecycleState +func GetInstanceLifecycleStateEnumValues() []InstanceLifecycleStateEnum { + values := make([]InstanceLifecycleStateEnum, 0) + for _, v := range mappingInstanceLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/instance_action_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/instance_action_request_response.go new file mode 100644 index 0000000000..37faf19663 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/instance_action_request_response.go @@ -0,0 +1,83 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// InstanceActionRequest wrapper for the InstanceAction operation +type InstanceActionRequest struct { + + // The OCID of the instance. + InstanceId *string `mandatory:"true" contributesTo:"path" name:"instanceId"` + + // The action to perform on the instance. + Action InstanceActionActionEnum `mandatory:"true" contributesTo:"query" name:"action" omitEmpty:"true"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request InstanceActionRequest) String() string { + return common.PointerString(request) +} + +// InstanceActionResponse wrapper for the InstanceAction operation +type InstanceActionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Instance instance + Instance `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response InstanceActionResponse) String() string { + return common.PointerString(response) +} + +// InstanceActionActionEnum Enum with underlying type: string +type InstanceActionActionEnum string + +// Set of constants representing the allowable values for InstanceActionAction +const ( + InstanceActionActionStop InstanceActionActionEnum = "STOP" + InstanceActionActionStart InstanceActionActionEnum = "START" + InstanceActionActionSoftreset InstanceActionActionEnum = "SOFTRESET" + InstanceActionActionReset InstanceActionActionEnum = "RESET" +) + +var mappingInstanceActionAction = map[string]InstanceActionActionEnum{ + "STOP": InstanceActionActionStop, + "START": InstanceActionActionStart, + "SOFTRESET": InstanceActionActionSoftreset, + "RESET": InstanceActionActionReset, +} + +// GetInstanceActionActionEnumValues Enumerates the set of values for InstanceActionAction +func GetInstanceActionActionEnumValues() []InstanceActionActionEnum { + values := make([]InstanceActionActionEnum, 0) + for _, v := range mappingInstanceActionAction { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/instance_console_connection.go b/vendor/github.com/oracle/oci-go-sdk/core/instance_console_connection.go new file mode 100644 index 0000000000..3dd2f61a44 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/instance_console_connection.go @@ -0,0 +1,71 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// InstanceConsoleConnection The `InstanceConsoleConnection` API provides you with console access to virtual machine (VM) instances, +// enabling you to troubleshoot malfunctioning instances remotely. +// For more information about console access, see +// Accessing the Console (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/serialconsole.htm). +type InstanceConsoleConnection struct { + + // The OCID of the compartment to contain the console connection. + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // The SSH connection string for the console connection. + ConnectionString *string `mandatory:"false" json:"connectionString"` + + // The SSH public key fingerprint for the console connection. + Fingerprint *string `mandatory:"false" json:"fingerprint"` + + // The OCID of the console connection. + Id *string `mandatory:"false" json:"id"` + + // The OCID of the instance the console connection connects to. + InstanceId *string `mandatory:"false" json:"instanceId"` + + // The current state of the console connection. + LifecycleState InstanceConsoleConnectionLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` +} + +func (m InstanceConsoleConnection) String() string { + return common.PointerString(m) +} + +// InstanceConsoleConnectionLifecycleStateEnum Enum with underlying type: string +type InstanceConsoleConnectionLifecycleStateEnum string + +// Set of constants representing the allowable values for InstanceConsoleConnectionLifecycleState +const ( + InstanceConsoleConnectionLifecycleStateActive InstanceConsoleConnectionLifecycleStateEnum = "ACTIVE" + InstanceConsoleConnectionLifecycleStateCreating InstanceConsoleConnectionLifecycleStateEnum = "CREATING" + InstanceConsoleConnectionLifecycleStateDeleted InstanceConsoleConnectionLifecycleStateEnum = "DELETED" + InstanceConsoleConnectionLifecycleStateDeleting InstanceConsoleConnectionLifecycleStateEnum = "DELETING" + InstanceConsoleConnectionLifecycleStateFailed InstanceConsoleConnectionLifecycleStateEnum = "FAILED" +) + +var mappingInstanceConsoleConnectionLifecycleState = map[string]InstanceConsoleConnectionLifecycleStateEnum{ + "ACTIVE": InstanceConsoleConnectionLifecycleStateActive, + "CREATING": InstanceConsoleConnectionLifecycleStateCreating, + "DELETED": InstanceConsoleConnectionLifecycleStateDeleted, + "DELETING": InstanceConsoleConnectionLifecycleStateDeleting, + "FAILED": InstanceConsoleConnectionLifecycleStateFailed, +} + +// GetInstanceConsoleConnectionLifecycleStateEnumValues Enumerates the set of values for InstanceConsoleConnectionLifecycleState +func GetInstanceConsoleConnectionLifecycleStateEnumValues() []InstanceConsoleConnectionLifecycleStateEnum { + values := make([]InstanceConsoleConnectionLifecycleStateEnum, 0) + for _, v := range mappingInstanceConsoleConnectionLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/instance_credentials.go b/vendor/github.com/oracle/oci-go-sdk/core/instance_credentials.go new file mode 100644 index 0000000000..62f78e9357 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/instance_credentials.go @@ -0,0 +1,27 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// InstanceCredentials The credentials for a particular instance. +type InstanceCredentials struct { + + // The password for the username. + Password *string `mandatory:"true" json:"password"` + + // The username. + Username *string `mandatory:"true" json:"username"` +} + +func (m InstanceCredentials) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/instance_source_details.go b/vendor/github.com/oracle/oci-go-sdk/core/instance_source_details.go new file mode 100644 index 0000000000..c9dffbd343 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/instance_source_details.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// InstanceSourceDetails The representation of InstanceSourceDetails +type InstanceSourceDetails interface { +} + +type instancesourcedetails struct { + JsonData []byte + SourceType string `json:"sourceType"` +} + +// UnmarshalJSON unmarshals json +func (m *instancesourcedetails) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerinstancesourcedetails instancesourcedetails + s := struct { + Model Unmarshalerinstancesourcedetails + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.SourceType = s.Model.SourceType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *instancesourcedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.SourceType { + case "image": + mm := InstanceSourceViaImageDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + case "bootVolume": + mm := InstanceSourceViaBootVolumeDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +func (m instancesourcedetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/instance_source_via_boot_volume_details.go b/vendor/github.com/oracle/oci-go-sdk/core/instance_source_via_boot_volume_details.go new file mode 100644 index 0000000000..9dc4b23265 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/instance_source_via_boot_volume_details.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// InstanceSourceViaBootVolumeDetails The representation of InstanceSourceViaBootVolumeDetails +type InstanceSourceViaBootVolumeDetails struct { + + // The OCID of the boot volume used to boot the instance. + BootVolumeId *string `mandatory:"true" json:"bootVolumeId"` +} + +func (m InstanceSourceViaBootVolumeDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m InstanceSourceViaBootVolumeDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeInstanceSourceViaBootVolumeDetails InstanceSourceViaBootVolumeDetails + s := struct { + DiscriminatorParam string `json:"sourceType"` + MarshalTypeInstanceSourceViaBootVolumeDetails + }{ + "bootVolume", + (MarshalTypeInstanceSourceViaBootVolumeDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/instance_source_via_image_details.go b/vendor/github.com/oracle/oci-go-sdk/core/instance_source_via_image_details.go new file mode 100644 index 0000000000..3327d9ecfb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/instance_source_via_image_details.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// InstanceSourceViaImageDetails The representation of InstanceSourceViaImageDetails +type InstanceSourceViaImageDetails struct { + + // The OCID of the image used to boot the instance. + ImageId *string `mandatory:"true" json:"imageId"` +} + +func (m InstanceSourceViaImageDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m InstanceSourceViaImageDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeInstanceSourceViaImageDetails InstanceSourceViaImageDetails + s := struct { + DiscriminatorParam string `json:"sourceType"` + MarshalTypeInstanceSourceViaImageDetails + }{ + "image", + (MarshalTypeInstanceSourceViaImageDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/internet_gateway.go b/vendor/github.com/oracle/oci-go-sdk/core/internet_gateway.go new file mode 100644 index 0000000000..a9b8f1c0b0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/internet_gateway.go @@ -0,0 +1,77 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// InternetGateway Represents a router that connects the edge of a VCN with the Internet. For an example scenario +// that uses an Internet Gateway, see +// Typical Networking Service Scenarios (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm#scenarios). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type InternetGateway struct { + + // The OCID of the compartment containing the Internet Gateway. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The Internet Gateway's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The Internet Gateway's current state. + LifecycleState InternetGatewayLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID of the VCN the Internet Gateway belongs to. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // Whether the gateway is enabled. When the gateway is disabled, traffic is not + // routed to/from the Internet, regardless of route rules. + IsEnabled *bool `mandatory:"false" json:"isEnabled"` + + // The date and time the Internet Gateway was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m InternetGateway) String() string { + return common.PointerString(m) +} + +// InternetGatewayLifecycleStateEnum Enum with underlying type: string +type InternetGatewayLifecycleStateEnum string + +// Set of constants representing the allowable values for InternetGatewayLifecycleState +const ( + InternetGatewayLifecycleStateProvisioning InternetGatewayLifecycleStateEnum = "PROVISIONING" + InternetGatewayLifecycleStateAvailable InternetGatewayLifecycleStateEnum = "AVAILABLE" + InternetGatewayLifecycleStateTerminating InternetGatewayLifecycleStateEnum = "TERMINATING" + InternetGatewayLifecycleStateTerminated InternetGatewayLifecycleStateEnum = "TERMINATED" +) + +var mappingInternetGatewayLifecycleState = map[string]InternetGatewayLifecycleStateEnum{ + "PROVISIONING": InternetGatewayLifecycleStateProvisioning, + "AVAILABLE": InternetGatewayLifecycleStateAvailable, + "TERMINATING": InternetGatewayLifecycleStateTerminating, + "TERMINATED": InternetGatewayLifecycleStateTerminated, +} + +// GetInternetGatewayLifecycleStateEnumValues Enumerates the set of values for InternetGatewayLifecycleState +func GetInternetGatewayLifecycleStateEnumValues() []InternetGatewayLifecycleStateEnum { + values := make([]InternetGatewayLifecycleStateEnum, 0) + for _, v := range mappingInternetGatewayLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/ip_sec_connection.go b/vendor/github.com/oracle/oci-go-sdk/core/ip_sec_connection.go new file mode 100644 index 0000000000..c57e745591 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/ip_sec_connection.go @@ -0,0 +1,82 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// IpSecConnection A connection between a DRG and CPE. This connection consists of multiple IPSec +// tunnels. Creating this connection is one of the steps required when setting up +// an IPSec VPN. For more information, see +// Overview of the Networking Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type IpSecConnection struct { + + // The OCID of the compartment containing the IPSec connection. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the CPE. + CpeId *string `mandatory:"true" json:"cpeId"` + + // The OCID of the DRG. + DrgId *string `mandatory:"true" json:"drgId"` + + // The IPSec connection's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The IPSec connection's current state. + LifecycleState IpSecConnectionLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // Static routes to the CPE. At least one route must be included. The CIDR must not be a + // multicast address or class E address. + // Example: `10.0.1.0/24` + StaticRoutes []string `mandatory:"true" json:"staticRoutes"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The date and time the IPSec connection was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m IpSecConnection) String() string { + return common.PointerString(m) +} + +// IpSecConnectionLifecycleStateEnum Enum with underlying type: string +type IpSecConnectionLifecycleStateEnum string + +// Set of constants representing the allowable values for IpSecConnectionLifecycleState +const ( + IpSecConnectionLifecycleStateProvisioning IpSecConnectionLifecycleStateEnum = "PROVISIONING" + IpSecConnectionLifecycleStateAvailable IpSecConnectionLifecycleStateEnum = "AVAILABLE" + IpSecConnectionLifecycleStateTerminating IpSecConnectionLifecycleStateEnum = "TERMINATING" + IpSecConnectionLifecycleStateTerminated IpSecConnectionLifecycleStateEnum = "TERMINATED" +) + +var mappingIpSecConnectionLifecycleState = map[string]IpSecConnectionLifecycleStateEnum{ + "PROVISIONING": IpSecConnectionLifecycleStateProvisioning, + "AVAILABLE": IpSecConnectionLifecycleStateAvailable, + "TERMINATING": IpSecConnectionLifecycleStateTerminating, + "TERMINATED": IpSecConnectionLifecycleStateTerminated, +} + +// GetIpSecConnectionLifecycleStateEnumValues Enumerates the set of values for IpSecConnectionLifecycleState +func GetIpSecConnectionLifecycleStateEnumValues() []IpSecConnectionLifecycleStateEnum { + values := make([]IpSecConnectionLifecycleStateEnum, 0) + for _, v := range mappingIpSecConnectionLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/ip_sec_connection_device_config.go b/vendor/github.com/oracle/oci-go-sdk/core/ip_sec_connection_device_config.go new file mode 100644 index 0000000000..5572af6376 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/ip_sec_connection_device_config.go @@ -0,0 +1,33 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// IpSecConnectionDeviceConfig Information about the IPSecConnection device configuration. +type IpSecConnectionDeviceConfig struct { + + // The OCID of the compartment containing the IPSec connection. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The IPSec connection's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The date and time the IPSec connection was created. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // Two TunnelConfig objects. + Tunnels []TunnelConfig `mandatory:"false" json:"tunnels"` +} + +func (m IpSecConnectionDeviceConfig) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/ip_sec_connection_device_status.go b/vendor/github.com/oracle/oci-go-sdk/core/ip_sec_connection_device_status.go new file mode 100644 index 0000000000..5f5a4d3c9c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/ip_sec_connection_device_status.go @@ -0,0 +1,34 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// IpSecConnectionDeviceStatus Status of the IPSec connection. +type IpSecConnectionDeviceStatus struct { + + // The OCID of the compartment containing the IPSec connection. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The IPSec connection's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The date and time the IPSec connection was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // Two TunnelStatus objects. + Tunnels []TunnelStatus `mandatory:"false" json:"tunnels"` +} + +func (m IpSecConnectionDeviceStatus) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/launch_instance_details.go b/vendor/github.com/oracle/oci-go-sdk/core/launch_instance_details.go new file mode 100644 index 0000000000..c40c778ca8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/launch_instance_details.go @@ -0,0 +1,172 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// LaunchInstanceDetails Instance launch details. +// Use the sourceDetails parameter to specify whether a boot volume should be used for a new instance launch. +type LaunchInstanceDetails struct { + + // The Availability Domain of the instance. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The shape of an instance. The shape determines the number of CPUs, amount of memory, + // and other resources allocated to the instance. + // You can enumerate all available shapes by calling ListShapes. + Shape *string `mandatory:"true" json:"shape"` + + // Details for the primary VNIC, which is automatically created and attached when + // the instance is launched. + CreateVnicDetails *CreateVnicDetails `mandatory:"false" json:"createVnicDetails"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + // Example: `My bare metal instance` + DisplayName *string `mandatory:"false" json:"displayName"` + + // Additional metadata key/value pairs that you provide. They serve a similar purpose and functionality from fields in the 'metadata' object. + // They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only). + // If you don't need nested metadata values, it is strongly advised to avoid using this object and use the Metadata object instead. + ExtendedMetadata map[string]interface{} `mandatory:"false" json:"extendedMetadata"` + + // Deprecated. Instead Use `hostnameLabel` in + // CreateVnicDetails. + // If you provide both, the values must match. + HostnameLabel *string `mandatory:"false" json:"hostnameLabel"` + + // Deprecated. Use `sourceDetails` with InstanceSourceViaImageDetails + // source type instead. If you specify values for both, the values must match. + ImageId *string `mandatory:"false" json:"imageId"` + + // This is an advanced option. + // When a bare metal or virtual machine + // instance boots, the iPXE firmware that runs on the instance is + // configured to run an iPXE script to continue the boot process. + // If you want more control over the boot process, you can provide + // your own custom iPXE script that will run when the instance boots; + // however, you should be aware that the same iPXE script will run + // every time an instance boots; not only after the initial + // LaunchInstance call. + // The default iPXE script connects to the instance's local boot + // volume over iSCSI and performs a network boot. If you use a custom iPXE + // script and want to network-boot from the instance's local boot volume + // over iSCSI the same way as the default iPXE script, you should use the + // following iSCSI IP address: 169.254.0.2, and boot volume IQN: + // iqn.2015-02.oracle.boot. + // For more information about the Bring Your Own Image feature of + // Oracle Cloud Infrastructure, see + // Bring Your Own Image (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/bringyourownimage.htm). + // For more information about iPXE, see http://ipxe.org. + IpxeScript *string `mandatory:"false" json:"ipxeScript"` + + // Custom metadata key/value pairs that you provide, such as the SSH public key + // required to connect to the instance. + // A metadata service runs on every launched instance. The service is an HTTP + // endpoint listening on 169.254.169.254. You can use the service to: + // * Provide information to Cloud-Init (https://cloudinit.readthedocs.org/en/latest/) + // to be used for various system initialization tasks. + // * Get information about the instance, including the custom metadata that you + // provide when you launch the instance. + // **Providing Cloud-Init Metadata** + // You can use the following metadata key names to provide information to + // Cloud-Init: + // **"ssh_authorized_keys"** - Provide one or more public SSH keys to be + // included in the `~/.ssh/authorized_keys` file for the default user on the + // instance. Use a newline character to separate multiple keys. The SSH + // keys must be in the format necessary for the `authorized_keys` file, as shown + // in the example below. + // **"user_data"** - Provide your own base64-encoded data to be used by + // Cloud-Init to run custom scripts or provide custom Cloud-Init configuration. For + // information about how to take advantage of user data, see the + // Cloud-Init Documentation (http://cloudinit.readthedocs.org/en/latest/topics/format.html). + // **Note:** Cloud-Init does not pull this data from the `http://169.254.169.254/opc/v1/instance/metadata/` + // path. When the instance launches and either of these keys are provided, the key values are formatted as + // OpenStack metadata and copied to the following locations, which are recognized by Cloud-Init: + // `http://169.254.169.254/openstack/latest/meta_data.json` - This JSON blob + // contains, among other things, the SSH keys that you provided for + // **"ssh_authorized_keys"**. + // `http://169.254.169.254/openstack/latest/user_data` - Contains the + // base64-decoded data that you provided for **"user_data"**. + // **Metadata Example** + // "metadata" : { + // "quake_bot_level" : "Severe", + // "ssh_authorized_keys" : "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCZ06fccNTQfq+xubFlJ5ZR3kt+uzspdH9tXL+lAejSM1NXM+CFZev7MIxfEjas06y80ZBZ7DUTQO0GxJPeD8NCOb1VorF8M4xuLwrmzRtkoZzU16umt4y1W0Q4ifdp3IiiU0U8/WxczSXcUVZOLqkz5dc6oMHdMVpkimietWzGZ4LBBsH/LjEVY7E0V+a0sNchlVDIZcm7ErReBLcdTGDq0uLBiuChyl6RUkX1PNhusquTGwK7zc8OBXkRuubn5UKXhI3Ul9Nyk4XESkVWIGNKmw8mSpoJSjR8P9ZjRmcZVo8S+x4KVPMZKQEor== ryan.smith@company.com + // ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAzJSAtwEPoB3Jmr58IXrDGzLuDYkWAYg8AsLYlo6JZvKpjY1xednIcfEVQJm4T2DhVmdWhRrwQ8DmayVZvBkLt+zs2LdoAJEVimKwXcJFD/7wtH8Lnk17HiglbbbNXsemjDY0hea4JUE5CfvkIdZBITuMrfqSmA4n3VNoorXYdvtTMoGG8fxMub46RPtuxtqi9bG9Zqenordkg5FJt2mVNfQRqf83CWojcOkklUWq4CjyxaeLf5i9gv1fRoBo4QhiA8I6NCSppO8GnoV/6Ox6TNoh9BiifqGKC9VGYuC89RvUajRBTZSK2TK4DPfaT+2R+slPsFrwiT/oPEhhEK1S5Q== rsa-key-20160227", + // "user_data" : "SWYgeW91IGNhbiBzZWUgdGhpcywgdGhlbiBpdCB3b3JrZWQgbWF5YmUuCg==" + // } + // **Getting Metadata on the Instance** + // To get information about your instance, connect to the instance using SSH and issue any of the + // following GET requests: + // curl http://169.254.169.254/opc/v1/instance/ + // curl http://169.254.169.254/opc/v1/instance/metadata/ + // curl http://169.254.169.254/opc/v1/instance/metadata/ + // You'll get back a response that includes all the instance information; only the metadata information; or + // the metadata information for the specified key name, respectively. + Metadata map[string]string `mandatory:"false" json:"metadata"` + + // Details for creating an instance. + SourceDetails InstanceSourceDetails `mandatory:"false" json:"sourceDetails"` + + // Deprecated. Instead use `subnetId` in + // CreateVnicDetails. + // At least one of them is required; if you provide both, the values must match. + SubnetId *string `mandatory:"false" json:"subnetId"` +} + +func (m LaunchInstanceDetails) String() string { + return common.PointerString(m) +} + +// UnmarshalJSON unmarshals from json +func (m *LaunchInstanceDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + CreateVnicDetails *CreateVnicDetails `json:"createVnicDetails"` + DisplayName *string `json:"displayName"` + ExtendedMetadata map[string]interface{} `json:"extendedMetadata"` + HostnameLabel *string `json:"hostnameLabel"` + ImageId *string `json:"imageId"` + IpxeScript *string `json:"ipxeScript"` + Metadata map[string]string `json:"metadata"` + SourceDetails instancesourcedetails `json:"sourceDetails"` + SubnetId *string `json:"subnetId"` + AvailabilityDomain *string `json:"availabilityDomain"` + CompartmentId *string `json:"compartmentId"` + Shape *string `json:"shape"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + m.CreateVnicDetails = model.CreateVnicDetails + m.DisplayName = model.DisplayName + m.ExtendedMetadata = model.ExtendedMetadata + m.HostnameLabel = model.HostnameLabel + m.ImageId = model.ImageId + m.IpxeScript = model.IpxeScript + m.Metadata = model.Metadata + nn, e := model.SourceDetails.UnmarshalPolymorphicJSON(model.SourceDetails.JsonData) + if e != nil { + return + } + m.SourceDetails = nn + m.SubnetId = model.SubnetId + m.AvailabilityDomain = model.AvailabilityDomain + m.CompartmentId = model.CompartmentId + m.Shape = model.Shape + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/launch_instance_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/launch_instance_request_response.go new file mode 100644 index 0000000000..dfccbc48b1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/launch_instance_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// LaunchInstanceRequest wrapper for the LaunchInstance operation +type LaunchInstanceRequest struct { + + // Instance details + LaunchInstanceDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request LaunchInstanceRequest) String() string { + return common.PointerString(request) +} + +// LaunchInstanceResponse wrapper for the LaunchInstance operation +type LaunchInstanceResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Instance instance + Instance `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response LaunchInstanceResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/letter_of_authority.go b/vendor/github.com/oracle/oci-go-sdk/core/letter_of_authority.go new file mode 100644 index 0000000000..3b24abade5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/letter_of_authority.go @@ -0,0 +1,67 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// LetterOfAuthority The Letter of Authority for the cross-connect. You must submit this letter when +// requesting cabling for the cross-connect at the FastConnect location. +type LetterOfAuthority struct { + + // The name of the entity authorized by this Letter of Authority. + AuthorizedEntityName *string `mandatory:"false" json:"authorizedEntityName"` + + // The type of cross-connect fiber, termination, and optical specification. + CircuitType LetterOfAuthorityCircuitTypeEnum `mandatory:"false" json:"circuitType,omitempty"` + + // The OCID of the cross-connect. + CrossConnectId *string `mandatory:"false" json:"crossConnectId"` + + // The address of the FastConnect location. + FacilityLocation *string `mandatory:"false" json:"facilityLocation"` + + // The meet-me room port for this cross-connect. + PortName *string `mandatory:"false" json:"portName"` + + // The date and time when the Letter of Authority expires, in the format defined by RFC3339. + TimeExpires *common.SDKTime `mandatory:"false" json:"timeExpires"` + + // The date and time the Letter of Authority was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeIssued *common.SDKTime `mandatory:"false" json:"timeIssued"` +} + +func (m LetterOfAuthority) String() string { + return common.PointerString(m) +} + +// LetterOfAuthorityCircuitTypeEnum Enum with underlying type: string +type LetterOfAuthorityCircuitTypeEnum string + +// Set of constants representing the allowable values for LetterOfAuthorityCircuitType +const ( + LetterOfAuthorityCircuitTypeLc LetterOfAuthorityCircuitTypeEnum = "Single_mode_LC" + LetterOfAuthorityCircuitTypeSc LetterOfAuthorityCircuitTypeEnum = "Single_mode_SC" +) + +var mappingLetterOfAuthorityCircuitType = map[string]LetterOfAuthorityCircuitTypeEnum{ + "Single_mode_LC": LetterOfAuthorityCircuitTypeLc, + "Single_mode_SC": LetterOfAuthorityCircuitTypeSc, +} + +// GetLetterOfAuthorityCircuitTypeEnumValues Enumerates the set of values for LetterOfAuthorityCircuitType +func GetLetterOfAuthorityCircuitTypeEnumValues() []LetterOfAuthorityCircuitTypeEnum { + values := make([]LetterOfAuthorityCircuitTypeEnum, 0) + for _, v := range mappingLetterOfAuthorityCircuitType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_boot_volume_attachments_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_boot_volume_attachments_request_response.go new file mode 100644 index 0000000000..51669f7e15 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_boot_volume_attachments_request_response.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListBootVolumeAttachmentsRequest wrapper for the ListBootVolumeAttachments operation +type ListBootVolumeAttachmentsRequest struct { + + // The name of the Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" contributesTo:"query" name:"availabilityDomain"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The OCID of the instance. + InstanceId *string `mandatory:"false" contributesTo:"query" name:"instanceId"` + + // The OCID of the boot volume. + BootVolumeId *string `mandatory:"false" contributesTo:"query" name:"bootVolumeId"` +} + +func (request ListBootVolumeAttachmentsRequest) String() string { + return common.PointerString(request) +} + +// ListBootVolumeAttachmentsResponse wrapper for the ListBootVolumeAttachments operation +type ListBootVolumeAttachmentsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []BootVolumeAttachment instance + Items []BootVolumeAttachment `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListBootVolumeAttachmentsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_boot_volumes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_boot_volumes_request_response.go new file mode 100644 index 0000000000..20370d3155 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_boot_volumes_request_response.go @@ -0,0 +1,54 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListBootVolumesRequest wrapper for the ListBootVolumes operation +type ListBootVolumesRequest struct { + + // The name of the Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" contributesTo:"query" name:"availabilityDomain"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListBootVolumesRequest) String() string { + return common.PointerString(request) +} + +// ListBootVolumesResponse wrapper for the ListBootVolumes operation +type ListBootVolumesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []BootVolume instance + Items []BootVolume `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListBootVolumesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_console_histories_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_console_histories_request_response.go new file mode 100644 index 0000000000..e47d043330 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_console_histories_request_response.go @@ -0,0 +1,119 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListConsoleHistoriesRequest wrapper for the ListConsoleHistories operation +type ListConsoleHistoriesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The name of the Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"false" contributesTo:"query" name:"availabilityDomain"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The OCID of the instance. + InstanceId *string `mandatory:"false" contributesTo:"query" name:"instanceId"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListConsoleHistoriesSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListConsoleHistoriesSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState ConsoleHistoryLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListConsoleHistoriesRequest) String() string { + return common.PointerString(request) +} + +// ListConsoleHistoriesResponse wrapper for the ListConsoleHistories operation +type ListConsoleHistoriesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []ConsoleHistory instance + Items []ConsoleHistory `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListConsoleHistoriesResponse) String() string { + return common.PointerString(response) +} + +// ListConsoleHistoriesSortByEnum Enum with underlying type: string +type ListConsoleHistoriesSortByEnum string + +// Set of constants representing the allowable values for ListConsoleHistoriesSortBy +const ( + ListConsoleHistoriesSortByTimecreated ListConsoleHistoriesSortByEnum = "TIMECREATED" + ListConsoleHistoriesSortByDisplayname ListConsoleHistoriesSortByEnum = "DISPLAYNAME" +) + +var mappingListConsoleHistoriesSortBy = map[string]ListConsoleHistoriesSortByEnum{ + "TIMECREATED": ListConsoleHistoriesSortByTimecreated, + "DISPLAYNAME": ListConsoleHistoriesSortByDisplayname, +} + +// GetListConsoleHistoriesSortByEnumValues Enumerates the set of values for ListConsoleHistoriesSortBy +func GetListConsoleHistoriesSortByEnumValues() []ListConsoleHistoriesSortByEnum { + values := make([]ListConsoleHistoriesSortByEnum, 0) + for _, v := range mappingListConsoleHistoriesSortBy { + values = append(values, v) + } + return values +} + +// ListConsoleHistoriesSortOrderEnum Enum with underlying type: string +type ListConsoleHistoriesSortOrderEnum string + +// Set of constants representing the allowable values for ListConsoleHistoriesSortOrder +const ( + ListConsoleHistoriesSortOrderAsc ListConsoleHistoriesSortOrderEnum = "ASC" + ListConsoleHistoriesSortOrderDesc ListConsoleHistoriesSortOrderEnum = "DESC" +) + +var mappingListConsoleHistoriesSortOrder = map[string]ListConsoleHistoriesSortOrderEnum{ + "ASC": ListConsoleHistoriesSortOrderAsc, + "DESC": ListConsoleHistoriesSortOrderDesc, +} + +// GetListConsoleHistoriesSortOrderEnumValues Enumerates the set of values for ListConsoleHistoriesSortOrder +func GetListConsoleHistoriesSortOrderEnumValues() []ListConsoleHistoriesSortOrderEnum { + values := make([]ListConsoleHistoriesSortOrderEnum, 0) + for _, v := range mappingListConsoleHistoriesSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_cpes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_cpes_request_response.go new file mode 100644 index 0000000000..5a0ce9fb34 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_cpes_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListCpesRequest wrapper for the ListCpes operation +type ListCpesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListCpesRequest) String() string { + return common.PointerString(request) +} + +// ListCpesResponse wrapper for the ListCpes operation +type ListCpesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Cpe instance + Items []Cpe `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListCpesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_cross_connect_groups_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_cross_connect_groups_request_response.go new file mode 100644 index 0000000000..221747c685 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_cross_connect_groups_request_response.go @@ -0,0 +1,115 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListCrossConnectGroupsRequest wrapper for the ListCrossConnectGroups operation +type ListCrossConnectGroupsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListCrossConnectGroupsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListCrossConnectGroupsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to return only resources that match the specified lifecycle state. The value is case insensitive. + LifecycleState CrossConnectGroupLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListCrossConnectGroupsRequest) String() string { + return common.PointerString(request) +} + +// ListCrossConnectGroupsResponse wrapper for the ListCrossConnectGroups operation +type ListCrossConnectGroupsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []CrossConnectGroup instance + Items []CrossConnectGroup `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListCrossConnectGroupsResponse) String() string { + return common.PointerString(response) +} + +// ListCrossConnectGroupsSortByEnum Enum with underlying type: string +type ListCrossConnectGroupsSortByEnum string + +// Set of constants representing the allowable values for ListCrossConnectGroupsSortBy +const ( + ListCrossConnectGroupsSortByTimecreated ListCrossConnectGroupsSortByEnum = "TIMECREATED" + ListCrossConnectGroupsSortByDisplayname ListCrossConnectGroupsSortByEnum = "DISPLAYNAME" +) + +var mappingListCrossConnectGroupsSortBy = map[string]ListCrossConnectGroupsSortByEnum{ + "TIMECREATED": ListCrossConnectGroupsSortByTimecreated, + "DISPLAYNAME": ListCrossConnectGroupsSortByDisplayname, +} + +// GetListCrossConnectGroupsSortByEnumValues Enumerates the set of values for ListCrossConnectGroupsSortBy +func GetListCrossConnectGroupsSortByEnumValues() []ListCrossConnectGroupsSortByEnum { + values := make([]ListCrossConnectGroupsSortByEnum, 0) + for _, v := range mappingListCrossConnectGroupsSortBy { + values = append(values, v) + } + return values +} + +// ListCrossConnectGroupsSortOrderEnum Enum with underlying type: string +type ListCrossConnectGroupsSortOrderEnum string + +// Set of constants representing the allowable values for ListCrossConnectGroupsSortOrder +const ( + ListCrossConnectGroupsSortOrderAsc ListCrossConnectGroupsSortOrderEnum = "ASC" + ListCrossConnectGroupsSortOrderDesc ListCrossConnectGroupsSortOrderEnum = "DESC" +) + +var mappingListCrossConnectGroupsSortOrder = map[string]ListCrossConnectGroupsSortOrderEnum{ + "ASC": ListCrossConnectGroupsSortOrderAsc, + "DESC": ListCrossConnectGroupsSortOrderDesc, +} + +// GetListCrossConnectGroupsSortOrderEnumValues Enumerates the set of values for ListCrossConnectGroupsSortOrder +func GetListCrossConnectGroupsSortOrderEnumValues() []ListCrossConnectGroupsSortOrderEnum { + values := make([]ListCrossConnectGroupsSortOrderEnum, 0) + for _, v := range mappingListCrossConnectGroupsSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_cross_connect_locations_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_cross_connect_locations_request_response.go new file mode 100644 index 0000000000..4200b32ac0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_cross_connect_locations_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListCrossConnectLocationsRequest wrapper for the ListCrossConnectLocations operation +type ListCrossConnectLocationsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListCrossConnectLocationsRequest) String() string { + return common.PointerString(request) +} + +// ListCrossConnectLocationsResponse wrapper for the ListCrossConnectLocations operation +type ListCrossConnectLocationsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []CrossConnectLocation instance + Items []CrossConnectLocation `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListCrossConnectLocationsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_cross_connects_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_cross_connects_request_response.go new file mode 100644 index 0000000000..e10f72d55a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_cross_connects_request_response.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListCrossConnectsRequest wrapper for the ListCrossConnects operation +type ListCrossConnectsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the cross-connect group. + CrossConnectGroupId *string `mandatory:"false" contributesTo:"query" name:"crossConnectGroupId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListCrossConnectsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListCrossConnectsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to return only resources that match the specified lifecycle state. The value is case insensitive. + LifecycleState CrossConnectLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListCrossConnectsRequest) String() string { + return common.PointerString(request) +} + +// ListCrossConnectsResponse wrapper for the ListCrossConnects operation +type ListCrossConnectsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []CrossConnect instance + Items []CrossConnect `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListCrossConnectsResponse) String() string { + return common.PointerString(response) +} + +// ListCrossConnectsSortByEnum Enum with underlying type: string +type ListCrossConnectsSortByEnum string + +// Set of constants representing the allowable values for ListCrossConnectsSortBy +const ( + ListCrossConnectsSortByTimecreated ListCrossConnectsSortByEnum = "TIMECREATED" + ListCrossConnectsSortByDisplayname ListCrossConnectsSortByEnum = "DISPLAYNAME" +) + +var mappingListCrossConnectsSortBy = map[string]ListCrossConnectsSortByEnum{ + "TIMECREATED": ListCrossConnectsSortByTimecreated, + "DISPLAYNAME": ListCrossConnectsSortByDisplayname, +} + +// GetListCrossConnectsSortByEnumValues Enumerates the set of values for ListCrossConnectsSortBy +func GetListCrossConnectsSortByEnumValues() []ListCrossConnectsSortByEnum { + values := make([]ListCrossConnectsSortByEnum, 0) + for _, v := range mappingListCrossConnectsSortBy { + values = append(values, v) + } + return values +} + +// ListCrossConnectsSortOrderEnum Enum with underlying type: string +type ListCrossConnectsSortOrderEnum string + +// Set of constants representing the allowable values for ListCrossConnectsSortOrder +const ( + ListCrossConnectsSortOrderAsc ListCrossConnectsSortOrderEnum = "ASC" + ListCrossConnectsSortOrderDesc ListCrossConnectsSortOrderEnum = "DESC" +) + +var mappingListCrossConnectsSortOrder = map[string]ListCrossConnectsSortOrderEnum{ + "ASC": ListCrossConnectsSortOrderAsc, + "DESC": ListCrossConnectsSortOrderDesc, +} + +// GetListCrossConnectsSortOrderEnumValues Enumerates the set of values for ListCrossConnectsSortOrder +func GetListCrossConnectsSortOrderEnumValues() []ListCrossConnectsSortOrderEnum { + values := make([]ListCrossConnectsSortOrderEnum, 0) + for _, v := range mappingListCrossConnectsSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_crossconnect_port_speed_shapes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_crossconnect_port_speed_shapes_request_response.go new file mode 100644 index 0000000000..b606553482 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_crossconnect_port_speed_shapes_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListCrossconnectPortSpeedShapesRequest wrapper for the ListCrossconnectPortSpeedShapes operation +type ListCrossconnectPortSpeedShapesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListCrossconnectPortSpeedShapesRequest) String() string { + return common.PointerString(request) +} + +// ListCrossconnectPortSpeedShapesResponse wrapper for the ListCrossconnectPortSpeedShapes operation +type ListCrossconnectPortSpeedShapesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []CrossConnectPortSpeedShape instance + Items []CrossConnectPortSpeedShape `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListCrossconnectPortSpeedShapesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_dhcp_options_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_dhcp_options_request_response.go new file mode 100644 index 0000000000..f06466fc66 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_dhcp_options_request_response.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDhcpOptionsRequest wrapper for the ListDhcpOptions operation +type ListDhcpOptionsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the VCN. + VcnId *string `mandatory:"true" contributesTo:"query" name:"vcnId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListDhcpOptionsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListDhcpOptionsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState DhcpOptionsLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListDhcpOptionsRequest) String() string { + return common.PointerString(request) +} + +// ListDhcpOptionsResponse wrapper for the ListDhcpOptions operation +type ListDhcpOptionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []DhcpOptions instance + Items []DhcpOptions `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDhcpOptionsResponse) String() string { + return common.PointerString(response) +} + +// ListDhcpOptionsSortByEnum Enum with underlying type: string +type ListDhcpOptionsSortByEnum string + +// Set of constants representing the allowable values for ListDhcpOptionsSortBy +const ( + ListDhcpOptionsSortByTimecreated ListDhcpOptionsSortByEnum = "TIMECREATED" + ListDhcpOptionsSortByDisplayname ListDhcpOptionsSortByEnum = "DISPLAYNAME" +) + +var mappingListDhcpOptionsSortBy = map[string]ListDhcpOptionsSortByEnum{ + "TIMECREATED": ListDhcpOptionsSortByTimecreated, + "DISPLAYNAME": ListDhcpOptionsSortByDisplayname, +} + +// GetListDhcpOptionsSortByEnumValues Enumerates the set of values for ListDhcpOptionsSortBy +func GetListDhcpOptionsSortByEnumValues() []ListDhcpOptionsSortByEnum { + values := make([]ListDhcpOptionsSortByEnum, 0) + for _, v := range mappingListDhcpOptionsSortBy { + values = append(values, v) + } + return values +} + +// ListDhcpOptionsSortOrderEnum Enum with underlying type: string +type ListDhcpOptionsSortOrderEnum string + +// Set of constants representing the allowable values for ListDhcpOptionsSortOrder +const ( + ListDhcpOptionsSortOrderAsc ListDhcpOptionsSortOrderEnum = "ASC" + ListDhcpOptionsSortOrderDesc ListDhcpOptionsSortOrderEnum = "DESC" +) + +var mappingListDhcpOptionsSortOrder = map[string]ListDhcpOptionsSortOrderEnum{ + "ASC": ListDhcpOptionsSortOrderAsc, + "DESC": ListDhcpOptionsSortOrderDesc, +} + +// GetListDhcpOptionsSortOrderEnumValues Enumerates the set of values for ListDhcpOptionsSortOrder +func GetListDhcpOptionsSortOrderEnumValues() []ListDhcpOptionsSortOrderEnum { + values := make([]ListDhcpOptionsSortOrderEnum, 0) + for _, v := range mappingListDhcpOptionsSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_drg_attachments_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_drg_attachments_request_response.go new file mode 100644 index 0000000000..d526209d55 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_drg_attachments_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDrgAttachmentsRequest wrapper for the ListDrgAttachments operation +type ListDrgAttachmentsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the VCN. + VcnId *string `mandatory:"false" contributesTo:"query" name:"vcnId"` + + // The OCID of the DRG. + DrgId *string `mandatory:"false" contributesTo:"query" name:"drgId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDrgAttachmentsRequest) String() string { + return common.PointerString(request) +} + +// ListDrgAttachmentsResponse wrapper for the ListDrgAttachments operation +type ListDrgAttachmentsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []DrgAttachment instance + Items []DrgAttachment `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDrgAttachmentsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_drgs_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_drgs_request_response.go new file mode 100644 index 0000000000..6577f9c2ff --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_drgs_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDrgsRequest wrapper for the ListDrgs operation +type ListDrgsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDrgsRequest) String() string { + return common.PointerString(request) +} + +// ListDrgsResponse wrapper for the ListDrgs operation +type ListDrgsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Drg instance + Items []Drg `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDrgsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_fast_connect_provider_services_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_fast_connect_provider_services_request_response.go new file mode 100644 index 0000000000..27614fd852 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_fast_connect_provider_services_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListFastConnectProviderServicesRequest wrapper for the ListFastConnectProviderServices operation +type ListFastConnectProviderServicesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListFastConnectProviderServicesRequest) String() string { + return common.PointerString(request) +} + +// ListFastConnectProviderServicesResponse wrapper for the ListFastConnectProviderServices operation +type ListFastConnectProviderServicesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []FastConnectProviderService instance + Items []FastConnectProviderService `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListFastConnectProviderServicesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_fast_connect_provider_virtual_circuit_bandwidth_shapes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_fast_connect_provider_virtual_circuit_bandwidth_shapes_request_response.go new file mode 100644 index 0000000000..6197b9b541 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_fast_connect_provider_virtual_circuit_bandwidth_shapes_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListFastConnectProviderVirtualCircuitBandwidthShapesRequest wrapper for the ListFastConnectProviderVirtualCircuitBandwidthShapes operation +type ListFastConnectProviderVirtualCircuitBandwidthShapesRequest struct { + + // The OCID of the provider service. + ProviderServiceId *string `mandatory:"true" contributesTo:"path" name:"providerServiceId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListFastConnectProviderVirtualCircuitBandwidthShapesRequest) String() string { + return common.PointerString(request) +} + +// ListFastConnectProviderVirtualCircuitBandwidthShapesResponse wrapper for the ListFastConnectProviderVirtualCircuitBandwidthShapes operation +type ListFastConnectProviderVirtualCircuitBandwidthShapesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []VirtualCircuitBandwidthShape instance + Items []VirtualCircuitBandwidthShape `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListFastConnectProviderVirtualCircuitBandwidthShapesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_i_p_sec_connections_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_i_p_sec_connections_request_response.go new file mode 100644 index 0000000000..c1b3467548 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_i_p_sec_connections_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListIPSecConnectionsRequest wrapper for the ListIPSecConnections operation +type ListIPSecConnectionsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the DRG. + DrgId *string `mandatory:"false" contributesTo:"query" name:"drgId"` + + // The OCID of the CPE. + CpeId *string `mandatory:"false" contributesTo:"query" name:"cpeId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListIPSecConnectionsRequest) String() string { + return common.PointerString(request) +} + +// ListIPSecConnectionsResponse wrapper for the ListIPSecConnections operation +type ListIPSecConnectionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []IpSecConnection instance + Items []IpSecConnection `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListIPSecConnectionsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_images_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_images_request_response.go new file mode 100644 index 0000000000..5ac8868609 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_images_request_response.go @@ -0,0 +1,123 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListImagesRequest wrapper for the ListImages operation +type ListImagesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The image's operating system. + // Example: `Oracle Linux` + OperatingSystem *string `mandatory:"false" contributesTo:"query" name:"operatingSystem"` + + // The image's operating system version. + // Example: `7.2` + OperatingSystemVersion *string `mandatory:"false" contributesTo:"query" name:"operatingSystemVersion"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListImagesSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListImagesSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState ImageLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListImagesRequest) String() string { + return common.PointerString(request) +} + +// ListImagesResponse wrapper for the ListImages operation +type ListImagesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Image instance + Items []Image `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListImagesResponse) String() string { + return common.PointerString(response) +} + +// ListImagesSortByEnum Enum with underlying type: string +type ListImagesSortByEnum string + +// Set of constants representing the allowable values for ListImagesSortBy +const ( + ListImagesSortByTimecreated ListImagesSortByEnum = "TIMECREATED" + ListImagesSortByDisplayname ListImagesSortByEnum = "DISPLAYNAME" +) + +var mappingListImagesSortBy = map[string]ListImagesSortByEnum{ + "TIMECREATED": ListImagesSortByTimecreated, + "DISPLAYNAME": ListImagesSortByDisplayname, +} + +// GetListImagesSortByEnumValues Enumerates the set of values for ListImagesSortBy +func GetListImagesSortByEnumValues() []ListImagesSortByEnum { + values := make([]ListImagesSortByEnum, 0) + for _, v := range mappingListImagesSortBy { + values = append(values, v) + } + return values +} + +// ListImagesSortOrderEnum Enum with underlying type: string +type ListImagesSortOrderEnum string + +// Set of constants representing the allowable values for ListImagesSortOrder +const ( + ListImagesSortOrderAsc ListImagesSortOrderEnum = "ASC" + ListImagesSortOrderDesc ListImagesSortOrderEnum = "DESC" +) + +var mappingListImagesSortOrder = map[string]ListImagesSortOrderEnum{ + "ASC": ListImagesSortOrderAsc, + "DESC": ListImagesSortOrderDesc, +} + +// GetListImagesSortOrderEnumValues Enumerates the set of values for ListImagesSortOrder +func GetListImagesSortOrderEnumValues() []ListImagesSortOrderEnum { + values := make([]ListImagesSortOrderEnum, 0) + for _, v := range mappingListImagesSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_instance_console_connections_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_instance_console_connections_request_response.go new file mode 100644 index 0000000000..012b2a77b7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_instance_console_connections_request_response.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListInstanceConsoleConnectionsRequest wrapper for the ListInstanceConsoleConnections operation +type ListInstanceConsoleConnectionsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the instance. + InstanceId *string `mandatory:"false" contributesTo:"query" name:"instanceId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListInstanceConsoleConnectionsRequest) String() string { + return common.PointerString(request) +} + +// ListInstanceConsoleConnectionsResponse wrapper for the ListInstanceConsoleConnections operation +type ListInstanceConsoleConnectionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []InstanceConsoleConnection instance + Items []InstanceConsoleConnection `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListInstanceConsoleConnectionsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_instances_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_instances_request_response.go new file mode 100644 index 0000000000..f687890c46 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_instances_request_response.go @@ -0,0 +1,119 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListInstancesRequest wrapper for the ListInstances operation +type ListInstancesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The name of the Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"false" contributesTo:"query" name:"availabilityDomain"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListInstancesSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListInstancesSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState InstanceLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListInstancesRequest) String() string { + return common.PointerString(request) +} + +// ListInstancesResponse wrapper for the ListInstances operation +type ListInstancesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Instance instance + Items []Instance `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListInstancesResponse) String() string { + return common.PointerString(response) +} + +// ListInstancesSortByEnum Enum with underlying type: string +type ListInstancesSortByEnum string + +// Set of constants representing the allowable values for ListInstancesSortBy +const ( + ListInstancesSortByTimecreated ListInstancesSortByEnum = "TIMECREATED" + ListInstancesSortByDisplayname ListInstancesSortByEnum = "DISPLAYNAME" +) + +var mappingListInstancesSortBy = map[string]ListInstancesSortByEnum{ + "TIMECREATED": ListInstancesSortByTimecreated, + "DISPLAYNAME": ListInstancesSortByDisplayname, +} + +// GetListInstancesSortByEnumValues Enumerates the set of values for ListInstancesSortBy +func GetListInstancesSortByEnumValues() []ListInstancesSortByEnum { + values := make([]ListInstancesSortByEnum, 0) + for _, v := range mappingListInstancesSortBy { + values = append(values, v) + } + return values +} + +// ListInstancesSortOrderEnum Enum with underlying type: string +type ListInstancesSortOrderEnum string + +// Set of constants representing the allowable values for ListInstancesSortOrder +const ( + ListInstancesSortOrderAsc ListInstancesSortOrderEnum = "ASC" + ListInstancesSortOrderDesc ListInstancesSortOrderEnum = "DESC" +) + +var mappingListInstancesSortOrder = map[string]ListInstancesSortOrderEnum{ + "ASC": ListInstancesSortOrderAsc, + "DESC": ListInstancesSortOrderDesc, +} + +// GetListInstancesSortOrderEnumValues Enumerates the set of values for ListInstancesSortOrder +func GetListInstancesSortOrderEnumValues() []ListInstancesSortOrderEnum { + values := make([]ListInstancesSortOrderEnum, 0) + for _, v := range mappingListInstancesSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_internet_gateways_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_internet_gateways_request_response.go new file mode 100644 index 0000000000..b37985a4d1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_internet_gateways_request_response.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListInternetGatewaysRequest wrapper for the ListInternetGateways operation +type ListInternetGatewaysRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the VCN. + VcnId *string `mandatory:"true" contributesTo:"query" name:"vcnId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListInternetGatewaysSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListInternetGatewaysSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState InternetGatewayLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListInternetGatewaysRequest) String() string { + return common.PointerString(request) +} + +// ListInternetGatewaysResponse wrapper for the ListInternetGateways operation +type ListInternetGatewaysResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []InternetGateway instance + Items []InternetGateway `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListInternetGatewaysResponse) String() string { + return common.PointerString(response) +} + +// ListInternetGatewaysSortByEnum Enum with underlying type: string +type ListInternetGatewaysSortByEnum string + +// Set of constants representing the allowable values for ListInternetGatewaysSortBy +const ( + ListInternetGatewaysSortByTimecreated ListInternetGatewaysSortByEnum = "TIMECREATED" + ListInternetGatewaysSortByDisplayname ListInternetGatewaysSortByEnum = "DISPLAYNAME" +) + +var mappingListInternetGatewaysSortBy = map[string]ListInternetGatewaysSortByEnum{ + "TIMECREATED": ListInternetGatewaysSortByTimecreated, + "DISPLAYNAME": ListInternetGatewaysSortByDisplayname, +} + +// GetListInternetGatewaysSortByEnumValues Enumerates the set of values for ListInternetGatewaysSortBy +func GetListInternetGatewaysSortByEnumValues() []ListInternetGatewaysSortByEnum { + values := make([]ListInternetGatewaysSortByEnum, 0) + for _, v := range mappingListInternetGatewaysSortBy { + values = append(values, v) + } + return values +} + +// ListInternetGatewaysSortOrderEnum Enum with underlying type: string +type ListInternetGatewaysSortOrderEnum string + +// Set of constants representing the allowable values for ListInternetGatewaysSortOrder +const ( + ListInternetGatewaysSortOrderAsc ListInternetGatewaysSortOrderEnum = "ASC" + ListInternetGatewaysSortOrderDesc ListInternetGatewaysSortOrderEnum = "DESC" +) + +var mappingListInternetGatewaysSortOrder = map[string]ListInternetGatewaysSortOrderEnum{ + "ASC": ListInternetGatewaysSortOrderAsc, + "DESC": ListInternetGatewaysSortOrderDesc, +} + +// GetListInternetGatewaysSortOrderEnumValues Enumerates the set of values for ListInternetGatewaysSortOrder +func GetListInternetGatewaysSortOrderEnumValues() []ListInternetGatewaysSortOrderEnum { + values := make([]ListInternetGatewaysSortOrderEnum, 0) + for _, v := range mappingListInternetGatewaysSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_local_peering_gateways_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_local_peering_gateways_request_response.go new file mode 100644 index 0000000000..071ec59af3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_local_peering_gateways_request_response.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListLocalPeeringGatewaysRequest wrapper for the ListLocalPeeringGateways operation +type ListLocalPeeringGatewaysRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the VCN. + VcnId *string `mandatory:"true" contributesTo:"query" name:"vcnId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListLocalPeeringGatewaysRequest) String() string { + return common.PointerString(request) +} + +// ListLocalPeeringGatewaysResponse wrapper for the ListLocalPeeringGateways operation +type ListLocalPeeringGatewaysResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []LocalPeeringGateway instance + Items []LocalPeeringGateway `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListLocalPeeringGatewaysResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_private_ips_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_private_ips_request_response.go new file mode 100644 index 0000000000..7054edfc3a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_private_ips_request_response.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListPrivateIpsRequest wrapper for the ListPrivateIps operation +type ListPrivateIpsRequest struct { + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The private IP address of the `privateIp` object. + // Example: `10.0.3.3` + IpAddress *string `mandatory:"false" contributesTo:"query" name:"ipAddress"` + + // The OCID of the subnet. + SubnetId *string `mandatory:"false" contributesTo:"query" name:"subnetId"` + + // The OCID of the VNIC. + VnicId *string `mandatory:"false" contributesTo:"query" name:"vnicId"` +} + +func (request ListPrivateIpsRequest) String() string { + return common.PointerString(request) +} + +// ListPrivateIpsResponse wrapper for the ListPrivateIps operation +type ListPrivateIpsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []PrivateIp instance + Items []PrivateIp `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListPrivateIpsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_route_tables_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_route_tables_request_response.go new file mode 100644 index 0000000000..88cc414c23 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_route_tables_request_response.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListRouteTablesRequest wrapper for the ListRouteTables operation +type ListRouteTablesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the VCN. + VcnId *string `mandatory:"true" contributesTo:"query" name:"vcnId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListRouteTablesSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListRouteTablesSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState RouteTableLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListRouteTablesRequest) String() string { + return common.PointerString(request) +} + +// ListRouteTablesResponse wrapper for the ListRouteTables operation +type ListRouteTablesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []RouteTable instance + Items []RouteTable `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListRouteTablesResponse) String() string { + return common.PointerString(response) +} + +// ListRouteTablesSortByEnum Enum with underlying type: string +type ListRouteTablesSortByEnum string + +// Set of constants representing the allowable values for ListRouteTablesSortBy +const ( + ListRouteTablesSortByTimecreated ListRouteTablesSortByEnum = "TIMECREATED" + ListRouteTablesSortByDisplayname ListRouteTablesSortByEnum = "DISPLAYNAME" +) + +var mappingListRouteTablesSortBy = map[string]ListRouteTablesSortByEnum{ + "TIMECREATED": ListRouteTablesSortByTimecreated, + "DISPLAYNAME": ListRouteTablesSortByDisplayname, +} + +// GetListRouteTablesSortByEnumValues Enumerates the set of values for ListRouteTablesSortBy +func GetListRouteTablesSortByEnumValues() []ListRouteTablesSortByEnum { + values := make([]ListRouteTablesSortByEnum, 0) + for _, v := range mappingListRouteTablesSortBy { + values = append(values, v) + } + return values +} + +// ListRouteTablesSortOrderEnum Enum with underlying type: string +type ListRouteTablesSortOrderEnum string + +// Set of constants representing the allowable values for ListRouteTablesSortOrder +const ( + ListRouteTablesSortOrderAsc ListRouteTablesSortOrderEnum = "ASC" + ListRouteTablesSortOrderDesc ListRouteTablesSortOrderEnum = "DESC" +) + +var mappingListRouteTablesSortOrder = map[string]ListRouteTablesSortOrderEnum{ + "ASC": ListRouteTablesSortOrderAsc, + "DESC": ListRouteTablesSortOrderDesc, +} + +// GetListRouteTablesSortOrderEnumValues Enumerates the set of values for ListRouteTablesSortOrder +func GetListRouteTablesSortOrderEnumValues() []ListRouteTablesSortOrderEnum { + values := make([]ListRouteTablesSortOrderEnum, 0) + for _, v := range mappingListRouteTablesSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_security_lists_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_security_lists_request_response.go new file mode 100644 index 0000000000..883452ce7b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_security_lists_request_response.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListSecurityListsRequest wrapper for the ListSecurityLists operation +type ListSecurityListsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the VCN. + VcnId *string `mandatory:"true" contributesTo:"query" name:"vcnId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListSecurityListsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListSecurityListsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState SecurityListLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListSecurityListsRequest) String() string { + return common.PointerString(request) +} + +// ListSecurityListsResponse wrapper for the ListSecurityLists operation +type ListSecurityListsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []SecurityList instance + Items []SecurityList `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListSecurityListsResponse) String() string { + return common.PointerString(response) +} + +// ListSecurityListsSortByEnum Enum with underlying type: string +type ListSecurityListsSortByEnum string + +// Set of constants representing the allowable values for ListSecurityListsSortBy +const ( + ListSecurityListsSortByTimecreated ListSecurityListsSortByEnum = "TIMECREATED" + ListSecurityListsSortByDisplayname ListSecurityListsSortByEnum = "DISPLAYNAME" +) + +var mappingListSecurityListsSortBy = map[string]ListSecurityListsSortByEnum{ + "TIMECREATED": ListSecurityListsSortByTimecreated, + "DISPLAYNAME": ListSecurityListsSortByDisplayname, +} + +// GetListSecurityListsSortByEnumValues Enumerates the set of values for ListSecurityListsSortBy +func GetListSecurityListsSortByEnumValues() []ListSecurityListsSortByEnum { + values := make([]ListSecurityListsSortByEnum, 0) + for _, v := range mappingListSecurityListsSortBy { + values = append(values, v) + } + return values +} + +// ListSecurityListsSortOrderEnum Enum with underlying type: string +type ListSecurityListsSortOrderEnum string + +// Set of constants representing the allowable values for ListSecurityListsSortOrder +const ( + ListSecurityListsSortOrderAsc ListSecurityListsSortOrderEnum = "ASC" + ListSecurityListsSortOrderDesc ListSecurityListsSortOrderEnum = "DESC" +) + +var mappingListSecurityListsSortOrder = map[string]ListSecurityListsSortOrderEnum{ + "ASC": ListSecurityListsSortOrderAsc, + "DESC": ListSecurityListsSortOrderDesc, +} + +// GetListSecurityListsSortOrderEnumValues Enumerates the set of values for ListSecurityListsSortOrder +func GetListSecurityListsSortOrderEnumValues() []ListSecurityListsSortOrderEnum { + values := make([]ListSecurityListsSortOrderEnum, 0) + for _, v := range mappingListSecurityListsSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_shapes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_shapes_request_response.go new file mode 100644 index 0000000000..71c7a2decc --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_shapes_request_response.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListShapesRequest wrapper for the ListShapes operation +type ListShapesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The name of the Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"false" contributesTo:"query" name:"availabilityDomain"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The OCID of an image. + ImageId *string `mandatory:"false" contributesTo:"query" name:"imageId"` +} + +func (request ListShapesRequest) String() string { + return common.PointerString(request) +} + +// ListShapesResponse wrapper for the ListShapes operation +type ListShapesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Shape instance + Items []Shape `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListShapesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_subnets_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_subnets_request_response.go new file mode 100644 index 0000000000..a74e9e1343 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_subnets_request_response.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListSubnetsRequest wrapper for the ListSubnets operation +type ListSubnetsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the VCN. + VcnId *string `mandatory:"true" contributesTo:"query" name:"vcnId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListSubnetsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListSubnetsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState SubnetLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListSubnetsRequest) String() string { + return common.PointerString(request) +} + +// ListSubnetsResponse wrapper for the ListSubnets operation +type ListSubnetsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Subnet instance + Items []Subnet `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListSubnetsResponse) String() string { + return common.PointerString(response) +} + +// ListSubnetsSortByEnum Enum with underlying type: string +type ListSubnetsSortByEnum string + +// Set of constants representing the allowable values for ListSubnetsSortBy +const ( + ListSubnetsSortByTimecreated ListSubnetsSortByEnum = "TIMECREATED" + ListSubnetsSortByDisplayname ListSubnetsSortByEnum = "DISPLAYNAME" +) + +var mappingListSubnetsSortBy = map[string]ListSubnetsSortByEnum{ + "TIMECREATED": ListSubnetsSortByTimecreated, + "DISPLAYNAME": ListSubnetsSortByDisplayname, +} + +// GetListSubnetsSortByEnumValues Enumerates the set of values for ListSubnetsSortBy +func GetListSubnetsSortByEnumValues() []ListSubnetsSortByEnum { + values := make([]ListSubnetsSortByEnum, 0) + for _, v := range mappingListSubnetsSortBy { + values = append(values, v) + } + return values +} + +// ListSubnetsSortOrderEnum Enum with underlying type: string +type ListSubnetsSortOrderEnum string + +// Set of constants representing the allowable values for ListSubnetsSortOrder +const ( + ListSubnetsSortOrderAsc ListSubnetsSortOrderEnum = "ASC" + ListSubnetsSortOrderDesc ListSubnetsSortOrderEnum = "DESC" +) + +var mappingListSubnetsSortOrder = map[string]ListSubnetsSortOrderEnum{ + "ASC": ListSubnetsSortOrderAsc, + "DESC": ListSubnetsSortOrderDesc, +} + +// GetListSubnetsSortOrderEnumValues Enumerates the set of values for ListSubnetsSortOrder +func GetListSubnetsSortOrderEnumValues() []ListSubnetsSortOrderEnum { + values := make([]ListSubnetsSortOrderEnum, 0) + for _, v := range mappingListSubnetsSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_vcns_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_vcns_request_response.go new file mode 100644 index 0000000000..b1e5b0edd9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_vcns_request_response.go @@ -0,0 +1,115 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListVcnsRequest wrapper for the ListVcns operation +type ListVcnsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListVcnsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListVcnsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState VcnLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListVcnsRequest) String() string { + return common.PointerString(request) +} + +// ListVcnsResponse wrapper for the ListVcns operation +type ListVcnsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Vcn instance + Items []Vcn `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListVcnsResponse) String() string { + return common.PointerString(response) +} + +// ListVcnsSortByEnum Enum with underlying type: string +type ListVcnsSortByEnum string + +// Set of constants representing the allowable values for ListVcnsSortBy +const ( + ListVcnsSortByTimecreated ListVcnsSortByEnum = "TIMECREATED" + ListVcnsSortByDisplayname ListVcnsSortByEnum = "DISPLAYNAME" +) + +var mappingListVcnsSortBy = map[string]ListVcnsSortByEnum{ + "TIMECREATED": ListVcnsSortByTimecreated, + "DISPLAYNAME": ListVcnsSortByDisplayname, +} + +// GetListVcnsSortByEnumValues Enumerates the set of values for ListVcnsSortBy +func GetListVcnsSortByEnumValues() []ListVcnsSortByEnum { + values := make([]ListVcnsSortByEnum, 0) + for _, v := range mappingListVcnsSortBy { + values = append(values, v) + } + return values +} + +// ListVcnsSortOrderEnum Enum with underlying type: string +type ListVcnsSortOrderEnum string + +// Set of constants representing the allowable values for ListVcnsSortOrder +const ( + ListVcnsSortOrderAsc ListVcnsSortOrderEnum = "ASC" + ListVcnsSortOrderDesc ListVcnsSortOrderEnum = "DESC" +) + +var mappingListVcnsSortOrder = map[string]ListVcnsSortOrderEnum{ + "ASC": ListVcnsSortOrderAsc, + "DESC": ListVcnsSortOrderDesc, +} + +// GetListVcnsSortOrderEnumValues Enumerates the set of values for ListVcnsSortOrder +func GetListVcnsSortOrderEnumValues() []ListVcnsSortOrderEnum { + values := make([]ListVcnsSortOrderEnum, 0) + for _, v := range mappingListVcnsSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_virtual_circuit_bandwidth_shapes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_virtual_circuit_bandwidth_shapes_request_response.go new file mode 100644 index 0000000000..3d0ac62534 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_virtual_circuit_bandwidth_shapes_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListVirtualCircuitBandwidthShapesRequest wrapper for the ListVirtualCircuitBandwidthShapes operation +type ListVirtualCircuitBandwidthShapesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListVirtualCircuitBandwidthShapesRequest) String() string { + return common.PointerString(request) +} + +// ListVirtualCircuitBandwidthShapesResponse wrapper for the ListVirtualCircuitBandwidthShapes operation +type ListVirtualCircuitBandwidthShapesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []VirtualCircuitBandwidthShape instance + Items []VirtualCircuitBandwidthShape `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListVirtualCircuitBandwidthShapesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_virtual_circuit_public_prefixes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_virtual_circuit_public_prefixes_request_response.go new file mode 100644 index 0000000000..0e885eb367 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_virtual_circuit_public_prefixes_request_response.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListVirtualCircuitPublicPrefixesRequest wrapper for the ListVirtualCircuitPublicPrefixes operation +type ListVirtualCircuitPublicPrefixesRequest struct { + + // The OCID of the virtual circuit. + VirtualCircuitId *string `mandatory:"true" contributesTo:"path" name:"virtualCircuitId"` + + // A filter to only return resources that match the given verification state. + // The state value is case-insensitive. + VerificationState VirtualCircuitPublicPrefixVerificationStateEnum `mandatory:"false" contributesTo:"query" name:"verificationState" omitEmpty:"true"` +} + +func (request ListVirtualCircuitPublicPrefixesRequest) String() string { + return common.PointerString(request) +} + +// ListVirtualCircuitPublicPrefixesResponse wrapper for the ListVirtualCircuitPublicPrefixes operation +type ListVirtualCircuitPublicPrefixesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []VirtualCircuitPublicPrefix instance + Items []VirtualCircuitPublicPrefix `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListVirtualCircuitPublicPrefixesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_virtual_circuits_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_virtual_circuits_request_response.go new file mode 100644 index 0000000000..65dc99414e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_virtual_circuits_request_response.go @@ -0,0 +1,115 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListVirtualCircuitsRequest wrapper for the ListVirtualCircuits operation +type ListVirtualCircuitsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListVirtualCircuitsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListVirtualCircuitsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to return only resources that match the specified lifecycle state. The value is case insensitive. + LifecycleState VirtualCircuitLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListVirtualCircuitsRequest) String() string { + return common.PointerString(request) +} + +// ListVirtualCircuitsResponse wrapper for the ListVirtualCircuits operation +type ListVirtualCircuitsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []VirtualCircuit instance + Items []VirtualCircuit `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListVirtualCircuitsResponse) String() string { + return common.PointerString(response) +} + +// ListVirtualCircuitsSortByEnum Enum with underlying type: string +type ListVirtualCircuitsSortByEnum string + +// Set of constants representing the allowable values for ListVirtualCircuitsSortBy +const ( + ListVirtualCircuitsSortByTimecreated ListVirtualCircuitsSortByEnum = "TIMECREATED" + ListVirtualCircuitsSortByDisplayname ListVirtualCircuitsSortByEnum = "DISPLAYNAME" +) + +var mappingListVirtualCircuitsSortBy = map[string]ListVirtualCircuitsSortByEnum{ + "TIMECREATED": ListVirtualCircuitsSortByTimecreated, + "DISPLAYNAME": ListVirtualCircuitsSortByDisplayname, +} + +// GetListVirtualCircuitsSortByEnumValues Enumerates the set of values for ListVirtualCircuitsSortBy +func GetListVirtualCircuitsSortByEnumValues() []ListVirtualCircuitsSortByEnum { + values := make([]ListVirtualCircuitsSortByEnum, 0) + for _, v := range mappingListVirtualCircuitsSortBy { + values = append(values, v) + } + return values +} + +// ListVirtualCircuitsSortOrderEnum Enum with underlying type: string +type ListVirtualCircuitsSortOrderEnum string + +// Set of constants representing the allowable values for ListVirtualCircuitsSortOrder +const ( + ListVirtualCircuitsSortOrderAsc ListVirtualCircuitsSortOrderEnum = "ASC" + ListVirtualCircuitsSortOrderDesc ListVirtualCircuitsSortOrderEnum = "DESC" +) + +var mappingListVirtualCircuitsSortOrder = map[string]ListVirtualCircuitsSortOrderEnum{ + "ASC": ListVirtualCircuitsSortOrderAsc, + "DESC": ListVirtualCircuitsSortOrderDesc, +} + +// GetListVirtualCircuitsSortOrderEnumValues Enumerates the set of values for ListVirtualCircuitsSortOrder +func GetListVirtualCircuitsSortOrderEnumValues() []ListVirtualCircuitsSortOrderEnum { + values := make([]ListVirtualCircuitsSortOrderEnum, 0) + for _, v := range mappingListVirtualCircuitsSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_vnic_attachments_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_vnic_attachments_request_response.go new file mode 100644 index 0000000000..6746850b40 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_vnic_attachments_request_response.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListVnicAttachmentsRequest wrapper for the ListVnicAttachments operation +type ListVnicAttachmentsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The name of the Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"false" contributesTo:"query" name:"availabilityDomain"` + + // The OCID of the instance. + InstanceId *string `mandatory:"false" contributesTo:"query" name:"instanceId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The OCID of the VNIC. + VnicId *string `mandatory:"false" contributesTo:"query" name:"vnicId"` +} + +func (request ListVnicAttachmentsRequest) String() string { + return common.PointerString(request) +} + +// ListVnicAttachmentsResponse wrapper for the ListVnicAttachments operation +type ListVnicAttachmentsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []VnicAttachment instance + Items []VnicAttachment `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListVnicAttachmentsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_volume_attachments_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_volume_attachments_request_response.go new file mode 100644 index 0000000000..5bc7ffdf45 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_volume_attachments_request_response.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListVolumeAttachmentsRequest wrapper for the ListVolumeAttachments operation +type ListVolumeAttachmentsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The name of the Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"false" contributesTo:"query" name:"availabilityDomain"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The OCID of the instance. + InstanceId *string `mandatory:"false" contributesTo:"query" name:"instanceId"` + + // The OCID of the volume. + VolumeId *string `mandatory:"false" contributesTo:"query" name:"volumeId"` +} + +func (request ListVolumeAttachmentsRequest) String() string { + return common.PointerString(request) +} + +// ListVolumeAttachmentsResponse wrapper for the ListVolumeAttachments operation +type ListVolumeAttachmentsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []VolumeAttachment instance + Items []VolumeAttachment `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListVolumeAttachmentsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_volume_backups_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_volume_backups_request_response.go new file mode 100644 index 0000000000..19bdff08c0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_volume_backups_request_response.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListVolumeBackupsRequest wrapper for the ListVolumeBackups operation +type ListVolumeBackupsRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the volume. + VolumeId *string `mandatory:"false" contributesTo:"query" name:"volumeId"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListVolumeBackupsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListVolumeBackupsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState VolumeBackupLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListVolumeBackupsRequest) String() string { + return common.PointerString(request) +} + +// ListVolumeBackupsResponse wrapper for the ListVolumeBackups operation +type ListVolumeBackupsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []VolumeBackup instance + Items []VolumeBackup `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListVolumeBackupsResponse) String() string { + return common.PointerString(response) +} + +// ListVolumeBackupsSortByEnum Enum with underlying type: string +type ListVolumeBackupsSortByEnum string + +// Set of constants representing the allowable values for ListVolumeBackupsSortBy +const ( + ListVolumeBackupsSortByTimecreated ListVolumeBackupsSortByEnum = "TIMECREATED" + ListVolumeBackupsSortByDisplayname ListVolumeBackupsSortByEnum = "DISPLAYNAME" +) + +var mappingListVolumeBackupsSortBy = map[string]ListVolumeBackupsSortByEnum{ + "TIMECREATED": ListVolumeBackupsSortByTimecreated, + "DISPLAYNAME": ListVolumeBackupsSortByDisplayname, +} + +// GetListVolumeBackupsSortByEnumValues Enumerates the set of values for ListVolumeBackupsSortBy +func GetListVolumeBackupsSortByEnumValues() []ListVolumeBackupsSortByEnum { + values := make([]ListVolumeBackupsSortByEnum, 0) + for _, v := range mappingListVolumeBackupsSortBy { + values = append(values, v) + } + return values +} + +// ListVolumeBackupsSortOrderEnum Enum with underlying type: string +type ListVolumeBackupsSortOrderEnum string + +// Set of constants representing the allowable values for ListVolumeBackupsSortOrder +const ( + ListVolumeBackupsSortOrderAsc ListVolumeBackupsSortOrderEnum = "ASC" + ListVolumeBackupsSortOrderDesc ListVolumeBackupsSortOrderEnum = "DESC" +) + +var mappingListVolumeBackupsSortOrder = map[string]ListVolumeBackupsSortOrderEnum{ + "ASC": ListVolumeBackupsSortOrderAsc, + "DESC": ListVolumeBackupsSortOrderDesc, +} + +// GetListVolumeBackupsSortOrderEnumValues Enumerates the set of values for ListVolumeBackupsSortOrder +func GetListVolumeBackupsSortOrderEnumValues() []ListVolumeBackupsSortOrderEnum { + values := make([]ListVolumeBackupsSortOrderEnum, 0) + for _, v := range mappingListVolumeBackupsSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/list_volumes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/list_volumes_request_response.go new file mode 100644 index 0000000000..20bb4c5539 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/list_volumes_request_response.go @@ -0,0 +1,119 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListVolumesRequest wrapper for the ListVolumes operation +type ListVolumesRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The name of the Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"false" contributesTo:"query" name:"availabilityDomain"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The field to sort by. You can provide one sort order (`sortOrder`). Default order for + // TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME + // sort order is case sensitive. + // **Note:** In general, some "List" operations (for example, `ListInstances`) let you + // optionally filter by Availability Domain if the scope of the resource type is within a + // single Availability Domain. If you call one of these "List" operations without specifying + // an Availability Domain, the resources are grouped by Availability Domain, then sorted. + SortBy ListVolumesSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). The DISPLAYNAME sort order + // is case sensitive. + SortOrder ListVolumesSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given lifecycle state. The state value is case-insensitive. + LifecycleState VolumeLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListVolumesRequest) String() string { + return common.PointerString(request) +} + +// ListVolumesResponse wrapper for the ListVolumes operation +type ListVolumesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Volume instance + Items []Volume `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListVolumesResponse) String() string { + return common.PointerString(response) +} + +// ListVolumesSortByEnum Enum with underlying type: string +type ListVolumesSortByEnum string + +// Set of constants representing the allowable values for ListVolumesSortBy +const ( + ListVolumesSortByTimecreated ListVolumesSortByEnum = "TIMECREATED" + ListVolumesSortByDisplayname ListVolumesSortByEnum = "DISPLAYNAME" +) + +var mappingListVolumesSortBy = map[string]ListVolumesSortByEnum{ + "TIMECREATED": ListVolumesSortByTimecreated, + "DISPLAYNAME": ListVolumesSortByDisplayname, +} + +// GetListVolumesSortByEnumValues Enumerates the set of values for ListVolumesSortBy +func GetListVolumesSortByEnumValues() []ListVolumesSortByEnum { + values := make([]ListVolumesSortByEnum, 0) + for _, v := range mappingListVolumesSortBy { + values = append(values, v) + } + return values +} + +// ListVolumesSortOrderEnum Enum with underlying type: string +type ListVolumesSortOrderEnum string + +// Set of constants representing the allowable values for ListVolumesSortOrder +const ( + ListVolumesSortOrderAsc ListVolumesSortOrderEnum = "ASC" + ListVolumesSortOrderDesc ListVolumesSortOrderEnum = "DESC" +) + +var mappingListVolumesSortOrder = map[string]ListVolumesSortOrderEnum{ + "ASC": ListVolumesSortOrderAsc, + "DESC": ListVolumesSortOrderDesc, +} + +// GetListVolumesSortOrderEnumValues Enumerates the set of values for ListVolumesSortOrder +func GetListVolumesSortOrderEnumValues() []ListVolumesSortOrderEnum { + values := make([]ListVolumesSortOrderEnum, 0) + for _, v := range mappingListVolumesSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/local_peering_gateway.go b/vendor/github.com/oracle/oci-go-sdk/core/local_peering_gateway.go new file mode 100644 index 0000000000..61242c6672 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/local_peering_gateway.go @@ -0,0 +1,123 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// LocalPeeringGateway A local peering gateway (LPG) is an object on a VCN that lets that VCN peer +// with another VCN in the same region. *Peering* means that the two VCNs can +// communicate using private IP addresses, but without the traffic traversing the +// internet or routing through your on-premises network. For more information, +// see VCN Peering (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type LocalPeeringGateway struct { + + // The OCID of the compartment containing the LPG. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid + // entering confidential information. + DisplayName *string `mandatory:"true" json:"displayName"` + + // The LPG's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // Whether the VCN at the other end of the peering is in a different tenancy. + // Example: `false` + IsCrossTenancyPeering *bool `mandatory:"true" json:"isCrossTenancyPeering"` + + // The LPG's current lifecycle state. + LifecycleState LocalPeeringGatewayLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // Whether the LPG is peered with another LPG. `NEW` means the LPG has not yet been + // peered. `PENDING` means the peering is being established. `REVOKED` means the + // LPG at the other end of the peering has been deleted. + PeeringStatus LocalPeeringGatewayPeeringStatusEnum `mandatory:"true" json:"peeringStatus"` + + // The date and time the LPG was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The OCID of the VCN the LPG belongs to. + VcnId *string `mandatory:"true" json:"vcnId"` + + // The range of IP addresses available on the VCN at the other + // end of the peering from this LPG. The value is `null` if the LPG is not peered. + // You can use this as the destination CIDR for a route rule to route a subnet's + // traffic to this LPG. + // Example: `192.168.0.0/16` + PeerAdvertisedCidr *string `mandatory:"false" json:"peerAdvertisedCidr"` + + // Additional information regarding the peering status, if applicable. + PeeringStatusDetails *string `mandatory:"false" json:"peeringStatusDetails"` +} + +func (m LocalPeeringGateway) String() string { + return common.PointerString(m) +} + +// LocalPeeringGatewayLifecycleStateEnum Enum with underlying type: string +type LocalPeeringGatewayLifecycleStateEnum string + +// Set of constants representing the allowable values for LocalPeeringGatewayLifecycleState +const ( + LocalPeeringGatewayLifecycleStateProvisioning LocalPeeringGatewayLifecycleStateEnum = "PROVISIONING" + LocalPeeringGatewayLifecycleStateAvailable LocalPeeringGatewayLifecycleStateEnum = "AVAILABLE" + LocalPeeringGatewayLifecycleStateTerminating LocalPeeringGatewayLifecycleStateEnum = "TERMINATING" + LocalPeeringGatewayLifecycleStateTerminated LocalPeeringGatewayLifecycleStateEnum = "TERMINATED" +) + +var mappingLocalPeeringGatewayLifecycleState = map[string]LocalPeeringGatewayLifecycleStateEnum{ + "PROVISIONING": LocalPeeringGatewayLifecycleStateProvisioning, + "AVAILABLE": LocalPeeringGatewayLifecycleStateAvailable, + "TERMINATING": LocalPeeringGatewayLifecycleStateTerminating, + "TERMINATED": LocalPeeringGatewayLifecycleStateTerminated, +} + +// GetLocalPeeringGatewayLifecycleStateEnumValues Enumerates the set of values for LocalPeeringGatewayLifecycleState +func GetLocalPeeringGatewayLifecycleStateEnumValues() []LocalPeeringGatewayLifecycleStateEnum { + values := make([]LocalPeeringGatewayLifecycleStateEnum, 0) + for _, v := range mappingLocalPeeringGatewayLifecycleState { + values = append(values, v) + } + return values +} + +// LocalPeeringGatewayPeeringStatusEnum Enum with underlying type: string +type LocalPeeringGatewayPeeringStatusEnum string + +// Set of constants representing the allowable values for LocalPeeringGatewayPeeringStatus +const ( + LocalPeeringGatewayPeeringStatusInvalid LocalPeeringGatewayPeeringStatusEnum = "INVALID" + LocalPeeringGatewayPeeringStatusNew LocalPeeringGatewayPeeringStatusEnum = "NEW" + LocalPeeringGatewayPeeringStatusPeered LocalPeeringGatewayPeeringStatusEnum = "PEERED" + LocalPeeringGatewayPeeringStatusPending LocalPeeringGatewayPeeringStatusEnum = "PENDING" + LocalPeeringGatewayPeeringStatusRevoked LocalPeeringGatewayPeeringStatusEnum = "REVOKED" +) + +var mappingLocalPeeringGatewayPeeringStatus = map[string]LocalPeeringGatewayPeeringStatusEnum{ + "INVALID": LocalPeeringGatewayPeeringStatusInvalid, + "NEW": LocalPeeringGatewayPeeringStatusNew, + "PEERED": LocalPeeringGatewayPeeringStatusPeered, + "PENDING": LocalPeeringGatewayPeeringStatusPending, + "REVOKED": LocalPeeringGatewayPeeringStatusRevoked, +} + +// GetLocalPeeringGatewayPeeringStatusEnumValues Enumerates the set of values for LocalPeeringGatewayPeeringStatus +func GetLocalPeeringGatewayPeeringStatusEnumValues() []LocalPeeringGatewayPeeringStatusEnum { + values := make([]LocalPeeringGatewayPeeringStatusEnum, 0) + for _, v := range mappingLocalPeeringGatewayPeeringStatus { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/port_range.go b/vendor/github.com/oracle/oci-go-sdk/core/port_range.go new file mode 100644 index 0000000000..f01332769d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/port_range.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// PortRange The representation of PortRange +type PortRange struct { + + // The maximum port number. Must not be lower than the minimum port number. To specify + // a single port number, set both the min and max to the same value. + Max *int `mandatory:"true" json:"max"` + + // The minimum port number. Must not be greater than the maximum port number. + Min *int `mandatory:"true" json:"min"` +} + +func (m PortRange) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/private_ip.go b/vendor/github.com/oracle/oci-go-sdk/core/private_ip.go new file mode 100644 index 0000000000..7ae7b37a01 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/private_ip.go @@ -0,0 +1,89 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// PrivateIp A *private IP* is a conceptual term that refers to a private IP address and related properties. +// The `privateIp` object is the API representation of a private IP. +// Each instance has a *primary private IP* that is automatically created and +// assigned to the primary VNIC during instance launch. If you add a secondary +// VNIC to the instance, it also automatically gets a primary private IP. You +// can't remove a primary private IP from its VNIC. The primary private IP is +// automatically deleted when the VNIC is terminated. +// You can add *secondary private IPs* to a VNIC after it's created. For more +// information, see the `privateIp` operations and also +// IP Addresses (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPaddresses.htm). +// **Note:** Only +// ListPrivateIps and +// GetPrivateIp work with +// *primary* private IPs. To create and update primary private IPs, you instead +// work with instance and VNIC operations. For example, a primary private IP's +// properties come from the values you specify in +// CreateVnicDetails when calling either +// LaunchInstance or +// AttachVnic. To update the hostname +// for a primary private IP, you use UpdateVnic. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type PrivateIp struct { + + // The private IP's Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"false" json:"availabilityDomain"` + + // The OCID of the compartment containing the private IP. + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid + // entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The hostname for the private IP. Used for DNS. The value is the hostname + // portion of the private IP's fully qualified domain name (FQDN) + // (for example, `bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Must be unique across all VNICs in the subnet and comply with + // RFC 952 (https://tools.ietf.org/html/rfc952) and + // RFC 1123 (https://tools.ietf.org/html/rfc1123). + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `bminstance-1` + HostnameLabel *string `mandatory:"false" json:"hostnameLabel"` + + // The private IP's Oracle ID (OCID). + Id *string `mandatory:"false" json:"id"` + + // The private IP address of the `privateIp` object. The address is within the CIDR + // of the VNIC's subnet. + // Example: `10.0.3.3` + IpAddress *string `mandatory:"false" json:"ipAddress"` + + // Whether this private IP is the primary one on the VNIC. Primary private IPs + // are unassigned and deleted automatically when the VNIC is terminated. + // Example: `true` + IsPrimary *bool `mandatory:"false" json:"isPrimary"` + + // The OCID of the subnet the VNIC is in. + SubnetId *string `mandatory:"false" json:"subnetId"` + + // The date and time the private IP was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The OCID of the VNIC the private IP is assigned to. The VNIC and private IP + // must be in the same subnet. + VnicId *string `mandatory:"false" json:"vnicId"` +} + +func (m PrivateIp) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/route_rule.go b/vendor/github.com/oracle/oci-go-sdk/core/route_rule.go new file mode 100644 index 0000000000..11b0e1b2ab --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/route_rule.go @@ -0,0 +1,32 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// RouteRule A mapping between a destination IP address range and a virtual device to route matching +// packets to (a target). +type RouteRule struct { + + // A destination IP address range in CIDR notation. Matching packets will + // be routed to the indicated network entity (the target). + // Example: `0.0.0.0/0` + CidrBlock *string `mandatory:"true" json:"cidrBlock"` + + // The OCID for the route rule's target. For information about the type of + // targets you can specify, see + // Route Tables (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm). + NetworkEntityId *string `mandatory:"true" json:"networkEntityId"` +} + +func (m RouteRule) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/route_table.go b/vendor/github.com/oracle/oci-go-sdk/core/route_table.go new file mode 100644 index 0000000000..f255d131c0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/route_table.go @@ -0,0 +1,76 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// RouteTable A collection of `RouteRule` objects, which are used to route packets +// based on destination IP to a particular network entity. For more information, see +// Overview of the Networking Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type RouteTable struct { + + // The OCID of the compartment containing the route table. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The route table's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The route table's current state. + LifecycleState RouteTableLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The collection of rules for routing destination IPs to network devices. + RouteRules []RouteRule `mandatory:"true" json:"routeRules"` + + // The OCID of the VCN the route table list belongs to. + VcnId *string `mandatory:"true" json:"vcnId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The date and time the route table was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m RouteTable) String() string { + return common.PointerString(m) +} + +// RouteTableLifecycleStateEnum Enum with underlying type: string +type RouteTableLifecycleStateEnum string + +// Set of constants representing the allowable values for RouteTableLifecycleState +const ( + RouteTableLifecycleStateProvisioning RouteTableLifecycleStateEnum = "PROVISIONING" + RouteTableLifecycleStateAvailable RouteTableLifecycleStateEnum = "AVAILABLE" + RouteTableLifecycleStateTerminating RouteTableLifecycleStateEnum = "TERMINATING" + RouteTableLifecycleStateTerminated RouteTableLifecycleStateEnum = "TERMINATED" +) + +var mappingRouteTableLifecycleState = map[string]RouteTableLifecycleStateEnum{ + "PROVISIONING": RouteTableLifecycleStateProvisioning, + "AVAILABLE": RouteTableLifecycleStateAvailable, + "TERMINATING": RouteTableLifecycleStateTerminating, + "TERMINATED": RouteTableLifecycleStateTerminated, +} + +// GetRouteTableLifecycleStateEnumValues Enumerates the set of values for RouteTableLifecycleState +func GetRouteTableLifecycleStateEnumValues() []RouteTableLifecycleStateEnum { + values := make([]RouteTableLifecycleStateEnum, 0) + for _, v := range mappingRouteTableLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/security_list.go b/vendor/github.com/oracle/oci-go-sdk/core/security_list.go new file mode 100644 index 0000000000..d55bcd2068 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/security_list.go @@ -0,0 +1,84 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// SecurityList A set of virtual firewall rules for your VCN. Security lists are configured at the subnet +// level, but the rules are applied to the ingress and egress traffic for the individual instances +// in the subnet. The rules can be stateful or stateless. For more information, see +// Security Lists (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/securitylists.htm). +// **Important:** Oracle Cloud Infrastructure Compute service images automatically include firewall rules (for example, +// Linux iptables, Windows firewall). If there are issues with some type of access to an instance, +// make sure both the security lists associated with the instance's subnet and the instance's +// firewall rules are set correctly. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type SecurityList struct { + + // The OCID of the compartment containing the security list. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"true" json:"displayName"` + + // Rules for allowing egress IP packets. + EgressSecurityRules []EgressSecurityRule `mandatory:"true" json:"egressSecurityRules"` + + // The security list's Oracle Cloud ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // Rules for allowing ingress IP packets. + IngressSecurityRules []IngressSecurityRule `mandatory:"true" json:"ingressSecurityRules"` + + // The security list's current state. + LifecycleState SecurityListLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The date and time the security list was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The OCID of the VCN the security list belongs to. + VcnId *string `mandatory:"true" json:"vcnId"` +} + +func (m SecurityList) String() string { + return common.PointerString(m) +} + +// SecurityListLifecycleStateEnum Enum with underlying type: string +type SecurityListLifecycleStateEnum string + +// Set of constants representing the allowable values for SecurityListLifecycleState +const ( + SecurityListLifecycleStateProvisioning SecurityListLifecycleStateEnum = "PROVISIONING" + SecurityListLifecycleStateAvailable SecurityListLifecycleStateEnum = "AVAILABLE" + SecurityListLifecycleStateTerminating SecurityListLifecycleStateEnum = "TERMINATING" + SecurityListLifecycleStateTerminated SecurityListLifecycleStateEnum = "TERMINATED" +) + +var mappingSecurityListLifecycleState = map[string]SecurityListLifecycleStateEnum{ + "PROVISIONING": SecurityListLifecycleStateProvisioning, + "AVAILABLE": SecurityListLifecycleStateAvailable, + "TERMINATING": SecurityListLifecycleStateTerminating, + "TERMINATED": SecurityListLifecycleStateTerminated, +} + +// GetSecurityListLifecycleStateEnumValues Enumerates the set of values for SecurityListLifecycleState +func GetSecurityListLifecycleStateEnumValues() []SecurityListLifecycleStateEnum { + values := make([]SecurityListLifecycleStateEnum, 0) + for _, v := range mappingSecurityListLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/shape.go b/vendor/github.com/oracle/oci-go-sdk/core/shape.go new file mode 100644 index 0000000000..7cb572cff5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/shape.go @@ -0,0 +1,26 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Shape A compute instance shape that can be used in LaunchInstance. +// For more information, see Overview of the Compute Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Concepts/computeoverview.htm). +type Shape struct { + + // The name of the shape. You can enumerate all available shapes by calling + // ListShapes. + Shape *string `mandatory:"true" json:"shape"` +} + +func (m Shape) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/subnet.go b/vendor/github.com/oracle/oci-go-sdk/core/subnet.go new file mode 100644 index 0000000000..d765cefce5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/subnet.go @@ -0,0 +1,131 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Subnet A logical subdivision of a VCN. Each subnet exists in a single Availability Domain and +// consists of a contiguous range of IP addresses that do not overlap with +// other subnets in the VCN. Example: 172.16.1.0/24. For more information, see +// Overview of the Networking Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm) and +// VCNs and Subnets (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVCNs.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Subnet struct { + + // The subnet's Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The subnet's CIDR block. + // Example: `172.16.1.0/24` + CidrBlock *string `mandatory:"true" json:"cidrBlock"` + + // The OCID of the compartment containing the subnet. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The subnet's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The subnet's current state. + LifecycleState SubnetLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID of the route table the subnet is using. + RouteTableId *string `mandatory:"true" json:"routeTableId"` + + // The OCID of the VCN the subnet is in. + VcnId *string `mandatory:"true" json:"vcnId"` + + // The IP address of the virtual router. + // Example: `10.0.14.1` + VirtualRouterIp *string `mandatory:"true" json:"virtualRouterIp"` + + // The MAC address of the virtual router. + // Example: `00:00:17:B6:4D:DD` + VirtualRouterMac *string `mandatory:"true" json:"virtualRouterMac"` + + // The OCID of the set of DHCP options associated with the subnet. + DhcpOptionsId *string `mandatory:"false" json:"dhcpOptionsId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // A DNS label for the subnet, used in conjunction with the VNIC's hostname and + // VCN's DNS label to form a fully qualified domain name (FQDN) for each VNIC + // within this subnet (for example, `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Must be an alphanumeric string that begins with a letter and is unique within the VCN. + // The value cannot be changed. + // The absence of this parameter means the Internet and VCN Resolver + // will not resolve hostnames of instances in this subnet. + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `subnet123` + DnsLabel *string `mandatory:"false" json:"dnsLabel"` + + // Whether VNICs within this subnet can have public IP addresses. + // Defaults to false, which means VNICs created in this subnet will + // automatically be assigned public IP addresses unless specified + // otherwise during instance launch or VNIC creation (with the + // `assignPublicIp` flag in + // CreateVnicDetails). + // If `prohibitPublicIpOnVnic` is set to true, VNICs created in this + // subnet cannot have public IP addresses (that is, it's a private + // subnet). + // Example: `true` + ProhibitPublicIpOnVnic *bool `mandatory:"false" json:"prohibitPublicIpOnVnic"` + + // OCIDs for the security lists to use for VNICs in this subnet. + SecurityListIds []string `mandatory:"false" json:"securityListIds"` + + // The subnet's domain name, which consists of the subnet's DNS label, + // the VCN's DNS label, and the `oraclevcn.com` domain. + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `subnet123.vcn1.oraclevcn.com` + SubnetDomainName *string `mandatory:"false" json:"subnetDomainName"` + + // The date and time the subnet was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m Subnet) String() string { + return common.PointerString(m) +} + +// SubnetLifecycleStateEnum Enum with underlying type: string +type SubnetLifecycleStateEnum string + +// Set of constants representing the allowable values for SubnetLifecycleState +const ( + SubnetLifecycleStateProvisioning SubnetLifecycleStateEnum = "PROVISIONING" + SubnetLifecycleStateAvailable SubnetLifecycleStateEnum = "AVAILABLE" + SubnetLifecycleStateTerminating SubnetLifecycleStateEnum = "TERMINATING" + SubnetLifecycleStateTerminated SubnetLifecycleStateEnum = "TERMINATED" +) + +var mappingSubnetLifecycleState = map[string]SubnetLifecycleStateEnum{ + "PROVISIONING": SubnetLifecycleStateProvisioning, + "AVAILABLE": SubnetLifecycleStateAvailable, + "TERMINATING": SubnetLifecycleStateTerminating, + "TERMINATED": SubnetLifecycleStateTerminated, +} + +// GetSubnetLifecycleStateEnumValues Enumerates the set of values for SubnetLifecycleState +func GetSubnetLifecycleStateEnumValues() []SubnetLifecycleStateEnum { + values := make([]SubnetLifecycleStateEnum, 0) + for _, v := range mappingSubnetLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/tcp_options.go b/vendor/github.com/oracle/oci-go-sdk/core/tcp_options.go new file mode 100644 index 0000000000..4037afbe85 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/tcp_options.go @@ -0,0 +1,30 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// TcpOptions Optional object to specify ports for a TCP rule. If you specify TCP as the +// protocol but omit this object, then all ports are allowed. +type TcpOptions struct { + + // An inclusive range of allowed destination ports. Use the same number for the min and max + // to indicate a single port. Defaults to all ports if not specified. + DestinationPortRange *PortRange `mandatory:"false" json:"destinationPortRange"` + + // An inclusive range of allowed source ports. Use the same number for the min and max to + // indicate a single port. Defaults to all ports if not specified. + SourcePortRange *PortRange `mandatory:"false" json:"sourcePortRange"` +} + +func (m TcpOptions) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/terminate_instance_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/terminate_instance_request_response.go new file mode 100644 index 0000000000..085b4c5d8f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/terminate_instance_request_response.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// TerminateInstanceRequest wrapper for the TerminateInstance operation +type TerminateInstanceRequest struct { + + // The OCID of the instance. + InstanceId *string `mandatory:"true" contributesTo:"path" name:"instanceId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Specifies whether to delete or preserve the boot volume when terminating an instance. + // The default value is false. + PreserveBootVolume *bool `mandatory:"false" contributesTo:"query" name:"preserveBootVolume"` +} + +func (request TerminateInstanceRequest) String() string { + return common.PointerString(request) +} + +// TerminateInstanceResponse wrapper for the TerminateInstance operation +type TerminateInstanceResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response TerminateInstanceResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/tunnel_config.go b/vendor/github.com/oracle/oci-go-sdk/core/tunnel_config.go new file mode 100644 index 0000000000..fe12d0997a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/tunnel_config.go @@ -0,0 +1,33 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// TunnelConfig Specific connection details for an IPSec tunnel. +type TunnelConfig struct { + + // The IP address of Oracle's VPN headend. + // Example: `129.146.17.50` + IpAddress *string `mandatory:"true" json:"ipAddress"` + + // The shared secret of the IPSec tunnel. + // Example: `vFG2IF6TWq4UToUiLSRDoJEUs6j1c.p8G.dVQxiMfMO0yXMLi.lZTbYIWhGu4V8o` + SharedSecret *string `mandatory:"true" json:"sharedSecret"` + + // The date and time the IPSec connection was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m TunnelConfig) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/tunnel_status.go b/vendor/github.com/oracle/oci-go-sdk/core/tunnel_status.go new file mode 100644 index 0000000000..c2655abc80 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/tunnel_status.go @@ -0,0 +1,61 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// TunnelStatus Specific connection details for an IPSec tunnel. +type TunnelStatus struct { + + // The IP address of Oracle's VPN headend. + // Example: `129.146.17.50` + IpAddress *string `mandatory:"true" json:"ipAddress"` + + // The tunnel's current state. + LifecycleState TunnelStatusLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The date and time the IPSec connection was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // When the state of the tunnel last changed, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeStateModified *common.SDKTime `mandatory:"false" json:"timeStateModified"` +} + +func (m TunnelStatus) String() string { + return common.PointerString(m) +} + +// TunnelStatusLifecycleStateEnum Enum with underlying type: string +type TunnelStatusLifecycleStateEnum string + +// Set of constants representing the allowable values for TunnelStatusLifecycleState +const ( + TunnelStatusLifecycleStateUp TunnelStatusLifecycleStateEnum = "UP" + TunnelStatusLifecycleStateDown TunnelStatusLifecycleStateEnum = "DOWN" + TunnelStatusLifecycleStateDownForMaintenance TunnelStatusLifecycleStateEnum = "DOWN_FOR_MAINTENANCE" +) + +var mappingTunnelStatusLifecycleState = map[string]TunnelStatusLifecycleStateEnum{ + "UP": TunnelStatusLifecycleStateUp, + "DOWN": TunnelStatusLifecycleStateDown, + "DOWN_FOR_MAINTENANCE": TunnelStatusLifecycleStateDownForMaintenance, +} + +// GetTunnelStatusLifecycleStateEnumValues Enumerates the set of values for TunnelStatusLifecycleState +func GetTunnelStatusLifecycleStateEnumValues() []TunnelStatusLifecycleStateEnum { + values := make([]TunnelStatusLifecycleStateEnum, 0) + for _, v := range mappingTunnelStatusLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/udp_options.go b/vendor/github.com/oracle/oci-go-sdk/core/udp_options.go new file mode 100644 index 0000000000..c68886ee22 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/udp_options.go @@ -0,0 +1,30 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UdpOptions Optional object to specify ports for a UDP rule. If you specify UDP as the +// protocol but omit this object, then all ports are allowed. +type UdpOptions struct { + + // An inclusive range of allowed destination ports. Use the same number for the min and max + // to indicate a single port. Defaults to all ports if not specified. + DestinationPortRange *PortRange `mandatory:"false" json:"destinationPortRange"` + + // An inclusive range of allowed source ports. Use the same number for the min and max to + // indicate a single port. Defaults to all ports if not specified. + SourcePortRange *PortRange `mandatory:"false" json:"sourcePortRange"` +} + +func (m UdpOptions) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_boot_volume_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_boot_volume_details.go new file mode 100644 index 0000000000..ead6727c73 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_boot_volume_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateBootVolumeDetails The representation of UpdateBootVolumeDetails +type UpdateBootVolumeDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateBootVolumeDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_boot_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_boot_volume_request_response.go new file mode 100644 index 0000000000..08ea32ad4a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_boot_volume_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateBootVolumeRequest wrapper for the UpdateBootVolume operation +type UpdateBootVolumeRequest struct { + + // The OCID of the boot volume. + BootVolumeId *string `mandatory:"true" contributesTo:"path" name:"bootVolumeId"` + + // Update boot volume's display name. + UpdateBootVolumeDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateBootVolumeRequest) String() string { + return common.PointerString(request) +} + +// UpdateBootVolumeResponse wrapper for the UpdateBootVolume operation +type UpdateBootVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The BootVolume instance + BootVolume `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateBootVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_console_history_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_console_history_details.go new file mode 100644 index 0000000000..cfecb4ead4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_console_history_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateConsoleHistoryDetails The representation of UpdateConsoleHistoryDetails +type UpdateConsoleHistoryDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateConsoleHistoryDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_console_history_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_console_history_request_response.go new file mode 100644 index 0000000000..c9bc64732d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_console_history_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateConsoleHistoryRequest wrapper for the UpdateConsoleHistory operation +type UpdateConsoleHistoryRequest struct { + + // The OCID of the console history. + InstanceConsoleHistoryId *string `mandatory:"true" contributesTo:"path" name:"instanceConsoleHistoryId"` + + // Update instance fields + UpdateConsoleHistoryDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateConsoleHistoryRequest) String() string { + return common.PointerString(request) +} + +// UpdateConsoleHistoryResponse wrapper for the UpdateConsoleHistory operation +type UpdateConsoleHistoryResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The ConsoleHistory instance + ConsoleHistory `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateConsoleHistoryResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_cpe_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_cpe_details.go new file mode 100644 index 0000000000..bd0daa6ef6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_cpe_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateCpeDetails The representation of UpdateCpeDetails +type UpdateCpeDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateCpeDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_cpe_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_cpe_request_response.go new file mode 100644 index 0000000000..a871708348 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_cpe_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateCpeRequest wrapper for the UpdateCpe operation +type UpdateCpeRequest struct { + + // The OCID of the CPE. + CpeId *string `mandatory:"true" contributesTo:"path" name:"cpeId"` + + // Details object for updating a CPE. + UpdateCpeDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateCpeRequest) String() string { + return common.PointerString(request) +} + +// UpdateCpeResponse wrapper for the UpdateCpe operation +type UpdateCpeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Cpe instance + Cpe `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateCpeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_details.go new file mode 100644 index 0000000000..4cfa190045 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_details.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateCrossConnectDetails Update a CrossConnect +type UpdateCrossConnectDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // Set to true to activate the cross-connect. You activate it after the physical cabling + // is complete, and you've confirmed the cross-connect's light levels are good and your side + // of the interface is up. Activation indicates to Oracle that the physical connection is ready. + // Example: `true` + IsActive *bool `mandatory:"false" json:"isActive"` +} + +func (m UpdateCrossConnectDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_group_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_group_details.go new file mode 100644 index 0000000000..97a424d296 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_group_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateCrossConnectGroupDetails The representation of UpdateCrossConnectGroupDetails +type UpdateCrossConnectGroupDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateCrossConnectGroupDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_group_request_response.go new file mode 100644 index 0000000000..23164788c0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_group_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateCrossConnectGroupRequest wrapper for the UpdateCrossConnectGroup operation +type UpdateCrossConnectGroupRequest struct { + + // The OCID of the cross-connect group. + CrossConnectGroupId *string `mandatory:"true" contributesTo:"path" name:"crossConnectGroupId"` + + // Update CrossConnectGroup fields + UpdateCrossConnectGroupDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateCrossConnectGroupRequest) String() string { + return common.PointerString(request) +} + +// UpdateCrossConnectGroupResponse wrapper for the UpdateCrossConnectGroup operation +type UpdateCrossConnectGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CrossConnectGroup instance + CrossConnectGroup `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateCrossConnectGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_request_response.go new file mode 100644 index 0000000000..8af219a51d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_cross_connect_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateCrossConnectRequest wrapper for the UpdateCrossConnect operation +type UpdateCrossConnectRequest struct { + + // The OCID of the cross-connect. + CrossConnectId *string `mandatory:"true" contributesTo:"path" name:"crossConnectId"` + + // Update CrossConnect fields. + UpdateCrossConnectDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateCrossConnectRequest) String() string { + return common.PointerString(request) +} + +// UpdateCrossConnectResponse wrapper for the UpdateCrossConnect operation +type UpdateCrossConnectResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CrossConnect instance + CrossConnect `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateCrossConnectResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_dhcp_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_dhcp_details.go new file mode 100644 index 0000000000..b2e221a13d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_dhcp_details.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateDhcpDetails The representation of UpdateDhcpDetails +type UpdateDhcpDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + Options []DhcpOption `mandatory:"false" json:"options"` +} + +func (m UpdateDhcpDetails) String() string { + return common.PointerString(m) +} + +// UnmarshalJSON unmarshals from json +func (m *UpdateDhcpDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + DisplayName *string `json:"displayName"` + Options []dhcpoption `json:"options"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + m.DisplayName = model.DisplayName + m.Options = make([]DhcpOption, len(model.Options)) + for i, n := range model.Options { + nn, err := n.UnmarshalPolymorphicJSON(n.JsonData) + if err != nil { + return err + } + m.Options[i] = nn + } + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_dhcp_options_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_dhcp_options_request_response.go new file mode 100644 index 0000000000..c8b6e542d3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_dhcp_options_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateDhcpOptionsRequest wrapper for the UpdateDhcpOptions operation +type UpdateDhcpOptionsRequest struct { + + // The OCID for the set of DHCP options. + DhcpId *string `mandatory:"true" contributesTo:"path" name:"dhcpId"` + + // Request object for updating a set of DHCP options. + UpdateDhcpDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateDhcpOptionsRequest) String() string { + return common.PointerString(request) +} + +// UpdateDhcpOptionsResponse wrapper for the UpdateDhcpOptions operation +type UpdateDhcpOptionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DhcpOptions instance + DhcpOptions `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateDhcpOptionsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_drg_attachment_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_drg_attachment_details.go new file mode 100644 index 0000000000..876f22c9d5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_drg_attachment_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateDrgAttachmentDetails The representation of UpdateDrgAttachmentDetails +type UpdateDrgAttachmentDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateDrgAttachmentDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_drg_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_drg_attachment_request_response.go new file mode 100644 index 0000000000..c0580c97ca --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_drg_attachment_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateDrgAttachmentRequest wrapper for the UpdateDrgAttachment operation +type UpdateDrgAttachmentRequest struct { + + // The OCID of the DRG attachment. + DrgAttachmentId *string `mandatory:"true" contributesTo:"path" name:"drgAttachmentId"` + + // Details object for updating a `DrgAttachment`. + UpdateDrgAttachmentDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateDrgAttachmentRequest) String() string { + return common.PointerString(request) +} + +// UpdateDrgAttachmentResponse wrapper for the UpdateDrgAttachment operation +type UpdateDrgAttachmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DrgAttachment instance + DrgAttachment `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateDrgAttachmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_drg_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_drg_details.go new file mode 100644 index 0000000000..2e64240b5b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_drg_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateDrgDetails The representation of UpdateDrgDetails +type UpdateDrgDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateDrgDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_drg_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_drg_request_response.go new file mode 100644 index 0000000000..0aba53e121 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_drg_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateDrgRequest wrapper for the UpdateDrg operation +type UpdateDrgRequest struct { + + // The OCID of the DRG. + DrgId *string `mandatory:"true" contributesTo:"path" name:"drgId"` + + // Details object for updating a DRG. + UpdateDrgDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateDrgRequest) String() string { + return common.PointerString(request) +} + +// UpdateDrgResponse wrapper for the UpdateDrg operation +type UpdateDrgResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Drg instance + Drg `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateDrgResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_i_p_sec_connection_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_i_p_sec_connection_request_response.go new file mode 100644 index 0000000000..ad809bea84 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_i_p_sec_connection_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateIPSecConnectionRequest wrapper for the UpdateIPSecConnection operation +type UpdateIPSecConnectionRequest struct { + + // The OCID of the IPSec connection. + IpscId *string `mandatory:"true" contributesTo:"path" name:"ipscId"` + + // Details object for updating a IPSec connection. + UpdateIpSecConnectionDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateIPSecConnectionRequest) String() string { + return common.PointerString(request) +} + +// UpdateIPSecConnectionResponse wrapper for the UpdateIPSecConnection operation +type UpdateIPSecConnectionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IpSecConnection instance + IpSecConnection `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateIPSecConnectionResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_image_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_image_details.go new file mode 100644 index 0000000000..f3c35d5faf --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_image_details.go @@ -0,0 +1,26 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateImageDetails The representation of UpdateImageDetails +type UpdateImageDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + // Example: `My custom Oracle Linux image` + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateImageDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_image_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_image_request_response.go new file mode 100644 index 0000000000..6757b1d1a9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_image_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateImageRequest wrapper for the UpdateImage operation +type UpdateImageRequest struct { + + // The OCID of the image. + ImageId *string `mandatory:"true" contributesTo:"path" name:"imageId"` + + // Updates the image display name field. Avoid entering confidential information. + UpdateImageDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateImageRequest) String() string { + return common.PointerString(request) +} + +// UpdateImageResponse wrapper for the UpdateImage operation +type UpdateImageResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Image instance + Image `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateImageResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_instance_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_instance_details.go new file mode 100644 index 0000000000..e18c8c402c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_instance_details.go @@ -0,0 +1,26 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateInstanceDetails The representation of UpdateInstanceDetails +type UpdateInstanceDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + // Example: `My bare metal instance` + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateInstanceDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_instance_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_instance_request_response.go new file mode 100644 index 0000000000..3705804cd8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_instance_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateInstanceRequest wrapper for the UpdateInstance operation +type UpdateInstanceRequest struct { + + // The OCID of the instance. + InstanceId *string `mandatory:"true" contributesTo:"path" name:"instanceId"` + + // Update instance fields + UpdateInstanceDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateInstanceRequest) String() string { + return common.PointerString(request) +} + +// UpdateInstanceResponse wrapper for the UpdateInstance operation +type UpdateInstanceResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Instance instance + Instance `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateInstanceResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_internet_gateway_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_internet_gateway_details.go new file mode 100644 index 0000000000..9410eeef1f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_internet_gateway_details.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateInternetGatewayDetails The representation of UpdateInternetGatewayDetails +type UpdateInternetGatewayDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // Whether the gateway is enabled. + IsEnabled *bool `mandatory:"false" json:"isEnabled"` +} + +func (m UpdateInternetGatewayDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_internet_gateway_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_internet_gateway_request_response.go new file mode 100644 index 0000000000..a81ca3093f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_internet_gateway_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateInternetGatewayRequest wrapper for the UpdateInternetGateway operation +type UpdateInternetGatewayRequest struct { + + // The OCID of the Internet Gateway. + IgId *string `mandatory:"true" contributesTo:"path" name:"igId"` + + // Details for updating the Internet Gateway. + UpdateInternetGatewayDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateInternetGatewayRequest) String() string { + return common.PointerString(request) +} + +// UpdateInternetGatewayResponse wrapper for the UpdateInternetGateway operation +type UpdateInternetGatewayResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The InternetGateway instance + InternetGateway `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateInternetGatewayResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_ip_sec_connection_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_ip_sec_connection_details.go new file mode 100644 index 0000000000..b6834690b0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_ip_sec_connection_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateIpSecConnectionDetails The representation of UpdateIpSecConnectionDetails +type UpdateIpSecConnectionDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateIpSecConnectionDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_local_peering_gateway_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_local_peering_gateway_details.go new file mode 100644 index 0000000000..7b9d100838 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_local_peering_gateway_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateLocalPeeringGatewayDetails The representation of UpdateLocalPeeringGatewayDetails +type UpdateLocalPeeringGatewayDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid + // entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateLocalPeeringGatewayDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_local_peering_gateway_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_local_peering_gateway_request_response.go new file mode 100644 index 0000000000..093c486387 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_local_peering_gateway_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateLocalPeeringGatewayRequest wrapper for the UpdateLocalPeeringGateway operation +type UpdateLocalPeeringGatewayRequest struct { + + // The OCID of the local peering gateway. + LocalPeeringGatewayId *string `mandatory:"true" contributesTo:"path" name:"localPeeringGatewayId"` + + // Details object for updating a local peering gateway. + UpdateLocalPeeringGatewayDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateLocalPeeringGatewayRequest) String() string { + return common.PointerString(request) +} + +// UpdateLocalPeeringGatewayResponse wrapper for the UpdateLocalPeeringGateway operation +type UpdateLocalPeeringGatewayResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The LocalPeeringGateway instance + LocalPeeringGateway `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateLocalPeeringGatewayResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_private_ip_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_private_ip_details.go new file mode 100644 index 0000000000..96c7a2a747 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_private_ip_details.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdatePrivateIpDetails The representation of UpdatePrivateIpDetails +type UpdatePrivateIpDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. Avoid + // entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The hostname for the private IP. Used for DNS. The value + // is the hostname portion of the private IP's fully qualified domain name (FQDN) + // (for example, `bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Must be unique across all VNICs in the subnet and comply with + // RFC 952 (https://tools.ietf.org/html/rfc952) and + // RFC 1123 (https://tools.ietf.org/html/rfc1123). + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `bminstance-1` + HostnameLabel *string `mandatory:"false" json:"hostnameLabel"` + + // The OCID of the VNIC to reassign the private IP to. The VNIC must + // be in the same subnet as the current VNIC. + VnicId *string `mandatory:"false" json:"vnicId"` +} + +func (m UpdatePrivateIpDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_private_ip_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_private_ip_request_response.go new file mode 100644 index 0000000000..ae74cf5c7d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_private_ip_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdatePrivateIpRequest wrapper for the UpdatePrivateIp operation +type UpdatePrivateIpRequest struct { + + // The private IP's OCID. + PrivateIpId *string `mandatory:"true" contributesTo:"path" name:"privateIpId"` + + // Private IP details. + UpdatePrivateIpDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdatePrivateIpRequest) String() string { + return common.PointerString(request) +} + +// UpdatePrivateIpResponse wrapper for the UpdatePrivateIp operation +type UpdatePrivateIpResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The PrivateIp instance + PrivateIp `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdatePrivateIpResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_route_table_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_route_table_details.go new file mode 100644 index 0000000000..547a1b2b9b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_route_table_details.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateRouteTableDetails The representation of UpdateRouteTableDetails +type UpdateRouteTableDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The collection of rules used for routing destination IPs to network devices. + RouteRules []RouteRule `mandatory:"false" json:"routeRules"` +} + +func (m UpdateRouteTableDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_route_table_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_route_table_request_response.go new file mode 100644 index 0000000000..5323576a9e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_route_table_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateRouteTableRequest wrapper for the UpdateRouteTable operation +type UpdateRouteTableRequest struct { + + // The OCID of the route table. + RtId *string `mandatory:"true" contributesTo:"path" name:"rtId"` + + // Details object for updating a route table. + UpdateRouteTableDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateRouteTableRequest) String() string { + return common.PointerString(request) +} + +// UpdateRouteTableResponse wrapper for the UpdateRouteTable operation +type UpdateRouteTableResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The RouteTable instance + RouteTable `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateRouteTableResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_security_list_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_security_list_details.go new file mode 100644 index 0000000000..d23a3f75c7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_security_list_details.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateSecurityListDetails The representation of UpdateSecurityListDetails +type UpdateSecurityListDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // Rules for allowing egress IP packets. + EgressSecurityRules []EgressSecurityRule `mandatory:"false" json:"egressSecurityRules"` + + // Rules for allowing ingress IP packets. + IngressSecurityRules []IngressSecurityRule `mandatory:"false" json:"ingressSecurityRules"` +} + +func (m UpdateSecurityListDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_security_list_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_security_list_request_response.go new file mode 100644 index 0000000000..d9e7b468dc --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_security_list_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateSecurityListRequest wrapper for the UpdateSecurityList operation +type UpdateSecurityListRequest struct { + + // The OCID of the security list. + SecurityListId *string `mandatory:"true" contributesTo:"path" name:"securityListId"` + + // Updated details for the security list. + UpdateSecurityListDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateSecurityListRequest) String() string { + return common.PointerString(request) +} + +// UpdateSecurityListResponse wrapper for the UpdateSecurityList operation +type UpdateSecurityListResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The SecurityList instance + SecurityList `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateSecurityListResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_subnet_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_subnet_details.go new file mode 100644 index 0000000000..e15eaa0134 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_subnet_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateSubnetDetails The representation of UpdateSubnetDetails +type UpdateSubnetDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateSubnetDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_subnet_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_subnet_request_response.go new file mode 100644 index 0000000000..1dec9a727b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_subnet_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateSubnetRequest wrapper for the UpdateSubnet operation +type UpdateSubnetRequest struct { + + // The OCID of the subnet. + SubnetId *string `mandatory:"true" contributesTo:"path" name:"subnetId"` + + // Details object for updating a subnet. + UpdateSubnetDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateSubnetRequest) String() string { + return common.PointerString(request) +} + +// UpdateSubnetResponse wrapper for the UpdateSubnet operation +type UpdateSubnetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Subnet instance + Subnet `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateSubnetResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_vcn_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_vcn_details.go new file mode 100644 index 0000000000..e4dca15cd6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_vcn_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateVcnDetails The representation of UpdateVcnDetails +type UpdateVcnDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateVcnDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_vcn_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_vcn_request_response.go new file mode 100644 index 0000000000..37e483eb05 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_vcn_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateVcnRequest wrapper for the UpdateVcn operation +type UpdateVcnRequest struct { + + // The OCID of the VCN. + VcnId *string `mandatory:"true" contributesTo:"path" name:"vcnId"` + + // Details object for updating a VCN. + UpdateVcnDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateVcnRequest) String() string { + return common.PointerString(request) +} + +// UpdateVcnResponse wrapper for the UpdateVcn operation +type UpdateVcnResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Vcn instance + Vcn `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateVcnResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_virtual_circuit_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_virtual_circuit_details.go new file mode 100644 index 0000000000..cbfaf178f2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_virtual_circuit_details.go @@ -0,0 +1,90 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateVirtualCircuitDetails The representation of UpdateVirtualCircuitDetails +type UpdateVirtualCircuitDetails struct { + + // The provisioned data rate of the connection. To get a list of the + // available bandwidth levels (that is, shapes), see + // ListFastConnectProviderVirtualCircuitBandwidthShapes. + // To be updated only by the customer who owns the virtual circuit. + BandwidthShapeName *string `mandatory:"false" json:"bandwidthShapeName"` + + // An array of mappings, each containing properties for a cross-connect or + // cross-connect group associated with this virtual circuit. + // The customer and provider can update different properties in the mapping + // depending on the situation. See the description of the + // CrossConnectMapping. + CrossConnectMappings []CrossConnectMapping `mandatory:"false" json:"crossConnectMappings"` + + // The BGP ASN of the network at the other end of the BGP + // session from Oracle. + // If the BGP session is from the customer's edge router to Oracle, the + // required value is the customer's ASN, and it can be updated only + // by the customer. + // If the BGP session is from the provider's edge router to Oracle, the + // required value is the provider's ASN, and it can be updated only + // by the provider. + CustomerBgpAsn *int `mandatory:"false" json:"customerBgpAsn"` + + // A user-friendly name. Does not have to be unique. + // Avoid entering confidential information. + // To be updated only by the customer who owns the virtual circuit. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The OCID of the Drg + // that this private virtual circuit uses. + // To be updated only by the customer who owns the virtual circuit. + GatewayId *string `mandatory:"false" json:"gatewayId"` + + // The provider's state in relation to this virtual circuit. Relevant only + // if the customer is using FastConnect via a provider. ACTIVE + // means the provider has provisioned the virtual circuit from their + // end. INACTIVE means the provider has not yet provisioned the virtual + // circuit, or has de-provisioned it. + // To be updated only by the provider. + ProviderState UpdateVirtualCircuitDetailsProviderStateEnum `mandatory:"false" json:"providerState,omitempty"` + + // Provider-supplied reference information about this virtual circuit. + // Relevant only if the customer is using FastConnect via a provider. + // To be updated only by the provider. + ReferenceComment *string `mandatory:"false" json:"referenceComment"` +} + +func (m UpdateVirtualCircuitDetails) String() string { + return common.PointerString(m) +} + +// UpdateVirtualCircuitDetailsProviderStateEnum Enum with underlying type: string +type UpdateVirtualCircuitDetailsProviderStateEnum string + +// Set of constants representing the allowable values for UpdateVirtualCircuitDetailsProviderState +const ( + UpdateVirtualCircuitDetailsProviderStateActive UpdateVirtualCircuitDetailsProviderStateEnum = "ACTIVE" + UpdateVirtualCircuitDetailsProviderStateInactive UpdateVirtualCircuitDetailsProviderStateEnum = "INACTIVE" +) + +var mappingUpdateVirtualCircuitDetailsProviderState = map[string]UpdateVirtualCircuitDetailsProviderStateEnum{ + "ACTIVE": UpdateVirtualCircuitDetailsProviderStateActive, + "INACTIVE": UpdateVirtualCircuitDetailsProviderStateInactive, +} + +// GetUpdateVirtualCircuitDetailsProviderStateEnumValues Enumerates the set of values for UpdateVirtualCircuitDetailsProviderState +func GetUpdateVirtualCircuitDetailsProviderStateEnumValues() []UpdateVirtualCircuitDetailsProviderStateEnum { + values := make([]UpdateVirtualCircuitDetailsProviderStateEnum, 0) + for _, v := range mappingUpdateVirtualCircuitDetailsProviderState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_virtual_circuit_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_virtual_circuit_request_response.go new file mode 100644 index 0000000000..7f2a8df151 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_virtual_circuit_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateVirtualCircuitRequest wrapper for the UpdateVirtualCircuit operation +type UpdateVirtualCircuitRequest struct { + + // The OCID of the virtual circuit. + VirtualCircuitId *string `mandatory:"true" contributesTo:"path" name:"virtualCircuitId"` + + // Update VirtualCircuit fields. + UpdateVirtualCircuitDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateVirtualCircuitRequest) String() string { + return common.PointerString(request) +} + +// UpdateVirtualCircuitResponse wrapper for the UpdateVirtualCircuit operation +type UpdateVirtualCircuitResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VirtualCircuit instance + VirtualCircuit `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateVirtualCircuitResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_vnic_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_vnic_details.go new file mode 100644 index 0000000000..6eb74fde76 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_vnic_details.go @@ -0,0 +1,45 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateVnicDetails The representation of UpdateVnicDetails +type UpdateVnicDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname + // portion of the primary private IP's fully qualified domain name (FQDN) + // (for example, `bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Must be unique across all VNICs in the subnet and comply with + // RFC 952 (https://tools.ietf.org/html/rfc952) and + // RFC 1123 (https://tools.ietf.org/html/rfc1123). + // The value appears in the Vnic object and also the + // PrivateIp object returned by + // ListPrivateIps and + // GetPrivateIp. + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + HostnameLabel *string `mandatory:"false" json:"hostnameLabel"` + + // Whether the source/destination check is disabled on the VNIC. + // Defaults to `false`, which means the check is performed. For information + // about why you would skip the source/destination check, see + // Using a Private IP as a Route Target (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm#privateip). + // Example: `true` + SkipSourceDestCheck *bool `mandatory:"false" json:"skipSourceDestCheck"` +} + +func (m UpdateVnicDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_vnic_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_vnic_request_response.go new file mode 100644 index 0000000000..9bacd4eb52 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_vnic_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateVnicRequest wrapper for the UpdateVnic operation +type UpdateVnicRequest struct { + + // The OCID of the VNIC. + VnicId *string `mandatory:"true" contributesTo:"path" name:"vnicId"` + + // Details object for updating a VNIC. + UpdateVnicDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateVnicRequest) String() string { + return common.PointerString(request) +} + +// UpdateVnicResponse wrapper for the UpdateVnic operation +type UpdateVnicResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Vnic instance + Vnic `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateVnicResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_volume_backup_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_volume_backup_details.go new file mode 100644 index 0000000000..05be76e2b3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_volume_backup_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateVolumeBackupDetails The representation of UpdateVolumeBackupDetails +type UpdateVolumeBackupDetails struct { + + // A friendly user-specified name for the volume backup. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateVolumeBackupDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_volume_backup_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_volume_backup_request_response.go new file mode 100644 index 0000000000..e98d05109d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_volume_backup_request_response.go @@ -0,0 +1,45 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateVolumeBackupRequest wrapper for the UpdateVolumeBackup operation +type UpdateVolumeBackupRequest struct { + + // The OCID of the volume backup. + VolumeBackupId *string `mandatory:"true" contributesTo:"path" name:"volumeBackupId"` + + // Update volume backup fields + UpdateVolumeBackupDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateVolumeBackupRequest) String() string { + return common.PointerString(request) +} + +// UpdateVolumeBackupResponse wrapper for the UpdateVolumeBackup operation +type UpdateVolumeBackupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The VolumeBackup instance + VolumeBackup `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateVolumeBackupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_volume_details.go b/vendor/github.com/oracle/oci-go-sdk/core/update_volume_details.go new file mode 100644 index 0000000000..e0b642bd76 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_volume_details.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateVolumeDetails The representation of UpdateVolumeDetails +type UpdateVolumeDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateVolumeDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/update_volume_request_response.go b/vendor/github.com/oracle/oci-go-sdk/core/update_volume_request_response.go new file mode 100644 index 0000000000..b8b044f976 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/update_volume_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateVolumeRequest wrapper for the UpdateVolume operation +type UpdateVolumeRequest struct { + + // The OCID of the volume. + VolumeId *string `mandatory:"true" contributesTo:"path" name:"volumeId"` + + // Update volume's display name. Avoid entering confidential information. + UpdateVolumeDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateVolumeRequest) String() string { + return common.PointerString(request) +} + +// UpdateVolumeResponse wrapper for the UpdateVolume operation +type UpdateVolumeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Volume instance + Volume `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateVolumeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/vcn.go b/vendor/github.com/oracle/oci-go-sdk/core/vcn.go new file mode 100644 index 0000000000..8077a531d2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/vcn.go @@ -0,0 +1,101 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Vcn A Virtual Cloud Network (VCN). For more information, see +// Overview of the Networking Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Vcn struct { + + // The CIDR IP address block of the VCN. + // Example: `172.16.0.0/16` + CidrBlock *string `mandatory:"true" json:"cidrBlock"` + + // The OCID of the compartment containing the VCN. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The VCN's Oracle ID (OCID). + Id *string `mandatory:"true" json:"id"` + + // The VCN's current state. + LifecycleState VcnLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID for the VCN's default set of DHCP options. + DefaultDhcpOptionsId *string `mandatory:"false" json:"defaultDhcpOptionsId"` + + // The OCID for the VCN's default route table. + DefaultRouteTableId *string `mandatory:"false" json:"defaultRouteTableId"` + + // The OCID for the VCN's default security list. + DefaultSecurityListId *string `mandatory:"false" json:"defaultSecurityListId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // A DNS label for the VCN, used in conjunction with the VNIC's hostname and + // subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC + // within this subnet (for example, `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Must be an alphanumeric string that begins with a letter. + // The value cannot be changed. + // The absence of this parameter means the Internet and VCN Resolver will + // not work for this VCN. + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `vcn1` + DnsLabel *string `mandatory:"false" json:"dnsLabel"` + + // The date and time the VCN was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The VCN's domain name, which consists of the VCN's DNS label, and the + // `oraclevcn.com` domain. + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `vcn1.oraclevcn.com` + VcnDomainName *string `mandatory:"false" json:"vcnDomainName"` +} + +func (m Vcn) String() string { + return common.PointerString(m) +} + +// VcnLifecycleStateEnum Enum with underlying type: string +type VcnLifecycleStateEnum string + +// Set of constants representing the allowable values for VcnLifecycleState +const ( + VcnLifecycleStateProvisioning VcnLifecycleStateEnum = "PROVISIONING" + VcnLifecycleStateAvailable VcnLifecycleStateEnum = "AVAILABLE" + VcnLifecycleStateTerminating VcnLifecycleStateEnum = "TERMINATING" + VcnLifecycleStateTerminated VcnLifecycleStateEnum = "TERMINATED" +) + +var mappingVcnLifecycleState = map[string]VcnLifecycleStateEnum{ + "PROVISIONING": VcnLifecycleStateProvisioning, + "AVAILABLE": VcnLifecycleStateAvailable, + "TERMINATING": VcnLifecycleStateTerminating, + "TERMINATED": VcnLifecycleStateTerminated, +} + +// GetVcnLifecycleStateEnumValues Enumerates the set of values for VcnLifecycleState +func GetVcnLifecycleStateEnumValues() []VcnLifecycleStateEnum { + values := make([]VcnLifecycleStateEnum, 0) + for _, v := range mappingVcnLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/virtual_circuit.go b/vendor/github.com/oracle/oci-go-sdk/core/virtual_circuit.go new file mode 100644 index 0000000000..492c84bf43 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/virtual_circuit.go @@ -0,0 +1,273 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// VirtualCircuit For use with Oracle Cloud Infrastructure FastConnect. +// A virtual circuit is an isolated network path that runs over one or more physical +// network connections to provide a single, logical connection between the edge router +// on the customer's existing network and Oracle Cloud Infrastructure. *Private* +// virtual circuits support private peering, and *public* virtual circuits support +// public peering. For more information, see FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +// Each virtual circuit is made up of information shared between a customer, Oracle, +// and a provider (if the customer is using FastConnect via a provider). Who fills in +// a given property of a virtual circuit depends on whether the BGP session related to +// that virtual circuit goes from the customer's edge router to Oracle, or from the provider's +// edge router to Oracle. Also, in the case where the customer is using a provider, values +// for some of the properties may not be present immediately, but may get filled in as the +// provider and Oracle each do their part to provision the virtual circuit. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type VirtualCircuit struct { + + // The provisioned data rate of the connection. + BandwidthShapeName *string `mandatory:"false" json:"bandwidthShapeName"` + + // BGP management option. + BgpManagement VirtualCircuitBgpManagementEnum `mandatory:"false" json:"bgpManagement,omitempty"` + + // The state of the BGP session associated with the virtual circuit. + BgpSessionState VirtualCircuitBgpSessionStateEnum `mandatory:"false" json:"bgpSessionState,omitempty"` + + // The OCID of the compartment containing the virtual circuit. + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // An array of mappings, each containing properties for a + // cross-connect or cross-connect group that is associated with this + // virtual circuit. + CrossConnectMappings []CrossConnectMapping `mandatory:"false" json:"crossConnectMappings"` + + // The BGP ASN of the network at the other end of the BGP + // session from Oracle. If the session is between the customer's + // edge router and Oracle, the value is the customer's ASN. If the BGP + // session is between the provider's edge router and Oracle, the value + // is the provider's ASN. + CustomerBgpAsn *int `mandatory:"false" json:"customerBgpAsn"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The OCID of the customer's Drg + // that this virtual circuit uses. Applicable only to private virtual circuits. + GatewayId *string `mandatory:"false" json:"gatewayId"` + + // The virtual circuit's Oracle ID (OCID). + Id *string `mandatory:"false" json:"id"` + + // The virtual circuit's current state. For information about + // the different states, see + // FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). + LifecycleState VirtualCircuitLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The Oracle BGP ASN. + OracleBgpAsn *int `mandatory:"false" json:"oracleBgpAsn"` + + // Deprecated. Instead use `providerServiceId`. + ProviderName *string `mandatory:"false" json:"providerName"` + + // The OCID of the service offered by the provider (if the customer is connecting via a provider). + ProviderServiceId *string `mandatory:"false" json:"providerServiceId"` + + // Deprecated. Instead use `providerServiceId`. + ProviderServiceName *string `mandatory:"false" json:"providerServiceName"` + + // The provider's state in relation to this virtual circuit (if the + // customer is connecting via a provider). ACTIVE means + // the provider has provisioned the virtual circuit from their end. + // INACTIVE means the provider has not yet provisioned the virtual + // circuit, or has de-provisioned it. + ProviderState VirtualCircuitProviderStateEnum `mandatory:"false" json:"providerState,omitempty"` + + // For a public virtual circuit. The public IP prefixes (CIDRs) the customer wants to + // advertise across the connection. Each prefix must be /24 or less specific. + PublicPrefixes []string `mandatory:"false" json:"publicPrefixes"` + + // Provider-supplied reference information about this virtual circuit + // (if the customer is connecting via a provider). + ReferenceComment *string `mandatory:"false" json:"referenceComment"` + + // The Oracle Cloud Infrastructure region where this virtual + // circuit is located. + Region *string `mandatory:"false" json:"region"` + + // Provider service type. + ServiceType VirtualCircuitServiceTypeEnum `mandatory:"false" json:"serviceType,omitempty"` + + // The date and time the virtual circuit was created, + // in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // Whether the virtual circuit supports private or public peering. For more information, + // see FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). + Type VirtualCircuitTypeEnum `mandatory:"false" json:"type,omitempty"` +} + +func (m VirtualCircuit) String() string { + return common.PointerString(m) +} + +// VirtualCircuitBgpManagementEnum Enum with underlying type: string +type VirtualCircuitBgpManagementEnum string + +// Set of constants representing the allowable values for VirtualCircuitBgpManagement +const ( + VirtualCircuitBgpManagementCustomerManaged VirtualCircuitBgpManagementEnum = "CUSTOMER_MANAGED" + VirtualCircuitBgpManagementProviderManaged VirtualCircuitBgpManagementEnum = "PROVIDER_MANAGED" + VirtualCircuitBgpManagementOracleManaged VirtualCircuitBgpManagementEnum = "ORACLE_MANAGED" +) + +var mappingVirtualCircuitBgpManagement = map[string]VirtualCircuitBgpManagementEnum{ + "CUSTOMER_MANAGED": VirtualCircuitBgpManagementCustomerManaged, + "PROVIDER_MANAGED": VirtualCircuitBgpManagementProviderManaged, + "ORACLE_MANAGED": VirtualCircuitBgpManagementOracleManaged, +} + +// GetVirtualCircuitBgpManagementEnumValues Enumerates the set of values for VirtualCircuitBgpManagement +func GetVirtualCircuitBgpManagementEnumValues() []VirtualCircuitBgpManagementEnum { + values := make([]VirtualCircuitBgpManagementEnum, 0) + for _, v := range mappingVirtualCircuitBgpManagement { + values = append(values, v) + } + return values +} + +// VirtualCircuitBgpSessionStateEnum Enum with underlying type: string +type VirtualCircuitBgpSessionStateEnum string + +// Set of constants representing the allowable values for VirtualCircuitBgpSessionState +const ( + VirtualCircuitBgpSessionStateUp VirtualCircuitBgpSessionStateEnum = "UP" + VirtualCircuitBgpSessionStateDown VirtualCircuitBgpSessionStateEnum = "DOWN" +) + +var mappingVirtualCircuitBgpSessionState = map[string]VirtualCircuitBgpSessionStateEnum{ + "UP": VirtualCircuitBgpSessionStateUp, + "DOWN": VirtualCircuitBgpSessionStateDown, +} + +// GetVirtualCircuitBgpSessionStateEnumValues Enumerates the set of values for VirtualCircuitBgpSessionState +func GetVirtualCircuitBgpSessionStateEnumValues() []VirtualCircuitBgpSessionStateEnum { + values := make([]VirtualCircuitBgpSessionStateEnum, 0) + for _, v := range mappingVirtualCircuitBgpSessionState { + values = append(values, v) + } + return values +} + +// VirtualCircuitLifecycleStateEnum Enum with underlying type: string +type VirtualCircuitLifecycleStateEnum string + +// Set of constants representing the allowable values for VirtualCircuitLifecycleState +const ( + VirtualCircuitLifecycleStatePendingProvider VirtualCircuitLifecycleStateEnum = "PENDING_PROVIDER" + VirtualCircuitLifecycleStateVerifying VirtualCircuitLifecycleStateEnum = "VERIFYING" + VirtualCircuitLifecycleStateProvisioning VirtualCircuitLifecycleStateEnum = "PROVISIONING" + VirtualCircuitLifecycleStateProvisioned VirtualCircuitLifecycleStateEnum = "PROVISIONED" + VirtualCircuitLifecycleStateFailed VirtualCircuitLifecycleStateEnum = "FAILED" + VirtualCircuitLifecycleStateInactive VirtualCircuitLifecycleStateEnum = "INACTIVE" + VirtualCircuitLifecycleStateTerminating VirtualCircuitLifecycleStateEnum = "TERMINATING" + VirtualCircuitLifecycleStateTerminated VirtualCircuitLifecycleStateEnum = "TERMINATED" +) + +var mappingVirtualCircuitLifecycleState = map[string]VirtualCircuitLifecycleStateEnum{ + "PENDING_PROVIDER": VirtualCircuitLifecycleStatePendingProvider, + "VERIFYING": VirtualCircuitLifecycleStateVerifying, + "PROVISIONING": VirtualCircuitLifecycleStateProvisioning, + "PROVISIONED": VirtualCircuitLifecycleStateProvisioned, + "FAILED": VirtualCircuitLifecycleStateFailed, + "INACTIVE": VirtualCircuitLifecycleStateInactive, + "TERMINATING": VirtualCircuitLifecycleStateTerminating, + "TERMINATED": VirtualCircuitLifecycleStateTerminated, +} + +// GetVirtualCircuitLifecycleStateEnumValues Enumerates the set of values for VirtualCircuitLifecycleState +func GetVirtualCircuitLifecycleStateEnumValues() []VirtualCircuitLifecycleStateEnum { + values := make([]VirtualCircuitLifecycleStateEnum, 0) + for _, v := range mappingVirtualCircuitLifecycleState { + values = append(values, v) + } + return values +} + +// VirtualCircuitProviderStateEnum Enum with underlying type: string +type VirtualCircuitProviderStateEnum string + +// Set of constants representing the allowable values for VirtualCircuitProviderState +const ( + VirtualCircuitProviderStateActive VirtualCircuitProviderStateEnum = "ACTIVE" + VirtualCircuitProviderStateInactive VirtualCircuitProviderStateEnum = "INACTIVE" +) + +var mappingVirtualCircuitProviderState = map[string]VirtualCircuitProviderStateEnum{ + "ACTIVE": VirtualCircuitProviderStateActive, + "INACTIVE": VirtualCircuitProviderStateInactive, +} + +// GetVirtualCircuitProviderStateEnumValues Enumerates the set of values for VirtualCircuitProviderState +func GetVirtualCircuitProviderStateEnumValues() []VirtualCircuitProviderStateEnum { + values := make([]VirtualCircuitProviderStateEnum, 0) + for _, v := range mappingVirtualCircuitProviderState { + values = append(values, v) + } + return values +} + +// VirtualCircuitServiceTypeEnum Enum with underlying type: string +type VirtualCircuitServiceTypeEnum string + +// Set of constants representing the allowable values for VirtualCircuitServiceType +const ( + VirtualCircuitServiceTypeColocated VirtualCircuitServiceTypeEnum = "COLOCATED" + VirtualCircuitServiceTypeLayer2 VirtualCircuitServiceTypeEnum = "LAYER2" + VirtualCircuitServiceTypeLayer3 VirtualCircuitServiceTypeEnum = "LAYER3" +) + +var mappingVirtualCircuitServiceType = map[string]VirtualCircuitServiceTypeEnum{ + "COLOCATED": VirtualCircuitServiceTypeColocated, + "LAYER2": VirtualCircuitServiceTypeLayer2, + "LAYER3": VirtualCircuitServiceTypeLayer3, +} + +// GetVirtualCircuitServiceTypeEnumValues Enumerates the set of values for VirtualCircuitServiceType +func GetVirtualCircuitServiceTypeEnumValues() []VirtualCircuitServiceTypeEnum { + values := make([]VirtualCircuitServiceTypeEnum, 0) + for _, v := range mappingVirtualCircuitServiceType { + values = append(values, v) + } + return values +} + +// VirtualCircuitTypeEnum Enum with underlying type: string +type VirtualCircuitTypeEnum string + +// Set of constants representing the allowable values for VirtualCircuitType +const ( + VirtualCircuitTypePublic VirtualCircuitTypeEnum = "PUBLIC" + VirtualCircuitTypePrivate VirtualCircuitTypeEnum = "PRIVATE" +) + +var mappingVirtualCircuitType = map[string]VirtualCircuitTypeEnum{ + "PUBLIC": VirtualCircuitTypePublic, + "PRIVATE": VirtualCircuitTypePrivate, +} + +// GetVirtualCircuitTypeEnumValues Enumerates the set of values for VirtualCircuitType +func GetVirtualCircuitTypeEnumValues() []VirtualCircuitTypeEnum { + values := make([]VirtualCircuitTypeEnum, 0) + for _, v := range mappingVirtualCircuitType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/virtual_circuit_bandwidth_shape.go b/vendor/github.com/oracle/oci-go-sdk/core/virtual_circuit_bandwidth_shape.go new file mode 100644 index 0000000000..e237448d52 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/virtual_circuit_bandwidth_shape.go @@ -0,0 +1,29 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// VirtualCircuitBandwidthShape An individual bandwidth level for virtual circuits. +type VirtualCircuitBandwidthShape struct { + + // The name of the bandwidth shape. + // Example: `10 Gbps` + Name *string `mandatory:"true" json:"name"` + + // The bandwidth in Mbps. + // Example: `10000` + BandwidthInMbps *int `mandatory:"false" json:"bandwidthInMbps"` +} + +func (m VirtualCircuitBandwidthShape) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/virtual_circuit_public_prefix.go b/vendor/github.com/oracle/oci-go-sdk/core/virtual_circuit_public_prefix.go new file mode 100644 index 0000000000..62c1f41f3e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/virtual_circuit_public_prefix.go @@ -0,0 +1,58 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// VirtualCircuitPublicPrefix A public IP prefix and its details. With a public virtual circuit, the customer +// specifies the customer-owned public IP prefixes to advertise across the connection. +// For more information, see FastConnect Overview (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/fastconnect.htm). +type VirtualCircuitPublicPrefix struct { + + // Publix IP prefix (CIDR) that the customer specified. + CidrBlock *string `mandatory:"true" json:"cidrBlock"` + + // Oracle must verify that the customer owns the public IP prefix before traffic + // for that prefix can flow across the virtual circuit. Verification can take a + // few business days. `IN_PROGRESS` means Oracle is verifying the prefix. `COMPLETED` + // means verification succeeded. `FAILED` means verification failed and traffic for + // this prefix will not flow across the connection. + VerificationState VirtualCircuitPublicPrefixVerificationStateEnum `mandatory:"true" json:"verificationState"` +} + +func (m VirtualCircuitPublicPrefix) String() string { + return common.PointerString(m) +} + +// VirtualCircuitPublicPrefixVerificationStateEnum Enum with underlying type: string +type VirtualCircuitPublicPrefixVerificationStateEnum string + +// Set of constants representing the allowable values for VirtualCircuitPublicPrefixVerificationState +const ( + VirtualCircuitPublicPrefixVerificationStateInProgress VirtualCircuitPublicPrefixVerificationStateEnum = "IN_PROGRESS" + VirtualCircuitPublicPrefixVerificationStateCompleted VirtualCircuitPublicPrefixVerificationStateEnum = "COMPLETED" + VirtualCircuitPublicPrefixVerificationStateFailed VirtualCircuitPublicPrefixVerificationStateEnum = "FAILED" +) + +var mappingVirtualCircuitPublicPrefixVerificationState = map[string]VirtualCircuitPublicPrefixVerificationStateEnum{ + "IN_PROGRESS": VirtualCircuitPublicPrefixVerificationStateInProgress, + "COMPLETED": VirtualCircuitPublicPrefixVerificationStateCompleted, + "FAILED": VirtualCircuitPublicPrefixVerificationStateFailed, +} + +// GetVirtualCircuitPublicPrefixVerificationStateEnumValues Enumerates the set of values for VirtualCircuitPublicPrefixVerificationState +func GetVirtualCircuitPublicPrefixVerificationStateEnumValues() []VirtualCircuitPublicPrefixVerificationStateEnum { + values := make([]VirtualCircuitPublicPrefixVerificationStateEnum, 0) + for _, v := range mappingVirtualCircuitPublicPrefixVerificationState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/vnic.go b/vendor/github.com/oracle/oci-go-sdk/core/vnic.go new file mode 100644 index 0000000000..d7eb9d0531 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/vnic.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Vnic A virtual network interface card. Each VNIC resides in a subnet in a VCN. +// An instance attaches to a VNIC to obtain a network connection into the VCN +// through that subnet. Each instance has a *primary VNIC* that is automatically +// created and attached during launch. You can add *secondary VNICs* to an +// instance after it's launched. For more information, see +// Virtual Network Interface Cards (VNICs) (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVNICs.htm). +// Each VNIC has a *primary private IP* that is automatically assigned during launch. +// You can add *secondary private IPs* to a VNIC after it's created. For more +// information, see CreatePrivateIp and +// IP Addresses (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPaddresses.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Vnic struct { + + // The VNIC's Availability Domain. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment containing the VNIC. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the VNIC. + Id *string `mandatory:"true" json:"id"` + + // The current state of the VNIC. + LifecycleState VnicLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The private IP address of the primary `privateIp` object on the VNIC. + // The address is within the CIDR of the VNIC's subnet. + // Example: `10.0.3.3` + PrivateIp *string `mandatory:"true" json:"privateIp"` + + // The OCID of the subnet the VNIC is in. + SubnetId *string `mandatory:"true" json:"subnetId"` + + // The date and time the VNIC was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // A user-friendly name. Does not have to be unique. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The hostname for the VNIC's primary private IP. Used for DNS. The value is the hostname + // portion of the primary private IP's fully qualified domain name (FQDN) + // (for example, `bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). + // Must be unique across all VNICs in the subnet and comply with + // RFC 952 (https://tools.ietf.org/html/rfc952) and + // RFC 1123 (https://tools.ietf.org/html/rfc1123). + // For more information, see + // DNS in Your Virtual Cloud Network (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm). + // Example: `bminstance-1` + HostnameLabel *string `mandatory:"false" json:"hostnameLabel"` + + // Whether the VNIC is the primary VNIC (the VNIC that is automatically created + // and attached during instance launch). + IsPrimary *bool `mandatory:"false" json:"isPrimary"` + + // The MAC address of the VNIC. + // Example: `00:00:17:B6:4D:DD` + MacAddress *string `mandatory:"false" json:"macAddress"` + + // The public IP address of the VNIC, if one is assigned. + PublicIp *string `mandatory:"false" json:"publicIp"` + + // Whether the source/destination check is disabled on the VNIC. + // Defaults to `false`, which means the check is performed. For information + // about why you would skip the source/destination check, see + // Using a Private IP as a Route Target (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingroutetables.htm#privateip). + // Example: `true` + SkipSourceDestCheck *bool `mandatory:"false" json:"skipSourceDestCheck"` +} + +func (m Vnic) String() string { + return common.PointerString(m) +} + +// VnicLifecycleStateEnum Enum with underlying type: string +type VnicLifecycleStateEnum string + +// Set of constants representing the allowable values for VnicLifecycleState +const ( + VnicLifecycleStateProvisioning VnicLifecycleStateEnum = "PROVISIONING" + VnicLifecycleStateAvailable VnicLifecycleStateEnum = "AVAILABLE" + VnicLifecycleStateTerminating VnicLifecycleStateEnum = "TERMINATING" + VnicLifecycleStateTerminated VnicLifecycleStateEnum = "TERMINATED" +) + +var mappingVnicLifecycleState = map[string]VnicLifecycleStateEnum{ + "PROVISIONING": VnicLifecycleStateProvisioning, + "AVAILABLE": VnicLifecycleStateAvailable, + "TERMINATING": VnicLifecycleStateTerminating, + "TERMINATED": VnicLifecycleStateTerminated, +} + +// GetVnicLifecycleStateEnumValues Enumerates the set of values for VnicLifecycleState +func GetVnicLifecycleStateEnumValues() []VnicLifecycleStateEnum { + values := make([]VnicLifecycleStateEnum, 0) + for _, v := range mappingVnicLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/vnic_attachment.go b/vendor/github.com/oracle/oci-go-sdk/core/vnic_attachment.go new file mode 100644 index 0000000000..f08db683ff --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/vnic_attachment.go @@ -0,0 +1,92 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// VnicAttachment Represents an attachment between a VNIC and an instance. For more information, see +// Virtual Network Interface Cards (VNICs) (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVNICs.htm). +type VnicAttachment struct { + + // The Availability Domain of the instance. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment the VNIC attachment is in, which is the same + // compartment the instance is in. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the VNIC attachment. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the instance. + InstanceId *string `mandatory:"true" json:"instanceId"` + + // The current state of the VNIC attachment. + LifecycleState VnicAttachmentLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID of the VNIC's subnet. + SubnetId *string `mandatory:"true" json:"subnetId"` + + // The date and time the VNIC attachment was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // A user-friendly name. Does not have to be unique. + // Avoid entering confidential information. + DisplayName *string `mandatory:"false" json:"displayName"` + + // Which physical network interface card (NIC) the VNIC uses. + // Certain bare metal instance shapes have two active physical NICs (0 and 1). If + // you add a secondary VNIC to one of these instances, you can specify which NIC + // the VNIC will use. For more information, see + // Virtual Network Interface Cards (VNICs) (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingVNICs.htm). + NicIndex *int `mandatory:"false" json:"nicIndex"` + + // The Oracle-assigned VLAN tag of the attached VNIC. Available after the + // attachment process is complete. + // Example: `0` + VlanTag *int `mandatory:"false" json:"vlanTag"` + + // The OCID of the VNIC. Available after the attachment process is complete. + VnicId *string `mandatory:"false" json:"vnicId"` +} + +func (m VnicAttachment) String() string { + return common.PointerString(m) +} + +// VnicAttachmentLifecycleStateEnum Enum with underlying type: string +type VnicAttachmentLifecycleStateEnum string + +// Set of constants representing the allowable values for VnicAttachmentLifecycleState +const ( + VnicAttachmentLifecycleStateAttaching VnicAttachmentLifecycleStateEnum = "ATTACHING" + VnicAttachmentLifecycleStateAttached VnicAttachmentLifecycleStateEnum = "ATTACHED" + VnicAttachmentLifecycleStateDetaching VnicAttachmentLifecycleStateEnum = "DETACHING" + VnicAttachmentLifecycleStateDetached VnicAttachmentLifecycleStateEnum = "DETACHED" +) + +var mappingVnicAttachmentLifecycleState = map[string]VnicAttachmentLifecycleStateEnum{ + "ATTACHING": VnicAttachmentLifecycleStateAttaching, + "ATTACHED": VnicAttachmentLifecycleStateAttached, + "DETACHING": VnicAttachmentLifecycleStateDetaching, + "DETACHED": VnicAttachmentLifecycleStateDetached, +} + +// GetVnicAttachmentLifecycleStateEnumValues Enumerates the set of values for VnicAttachmentLifecycleState +func GetVnicAttachmentLifecycleStateEnumValues() []VnicAttachmentLifecycleStateEnum { + values := make([]VnicAttachmentLifecycleStateEnum, 0) + for _, v := range mappingVnicAttachmentLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/volume.go b/vendor/github.com/oracle/oci-go-sdk/core/volume.go new file mode 100644 index 0000000000..85c7394c53 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/volume.go @@ -0,0 +1,127 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// Volume A detachable block volume device that allows you to dynamically expand +// the storage capacity of an instance. For more information, see +// Overview of Cloud Volume Storage (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Volume struct { + + // The Availability Domain of the volume. + // Example: `Uocm:PHX-AD-1` + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment that contains the volume. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"true" json:"displayName"` + + // The OCID of the volume. + Id *string `mandatory:"true" json:"id"` + + // The current state of a volume. + LifecycleState VolumeLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The size of the volume in MBs. This field is deprecated. Use sizeInGBs instead. + SizeInMBs *int `mandatory:"true" json:"sizeInMBs"` + + // The date and time the volume was created. Format defined by RFC3339. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // Specifies whether the cloned volume's data has finished copying from the source volume or backup. + IsHydrated *bool `mandatory:"false" json:"isHydrated"` + + // The size of the volume in GBs. + SizeInGBs *int `mandatory:"false" json:"sizeInGBs"` + + // The volume source, either an existing volume in the same Availability Domain or a volume backup. + // If null, an empty volume is created. + SourceDetails VolumeSourceDetails `mandatory:"false" json:"sourceDetails"` +} + +func (m Volume) String() string { + return common.PointerString(m) +} + +// UnmarshalJSON unmarshals from json +func (m *Volume) UnmarshalJSON(data []byte) (e error) { + model := struct { + IsHydrated *bool `json:"isHydrated"` + SizeInGBs *int `json:"sizeInGBs"` + SourceDetails volumesourcedetails `json:"sourceDetails"` + AvailabilityDomain *string `json:"availabilityDomain"` + CompartmentId *string `json:"compartmentId"` + DisplayName *string `json:"displayName"` + Id *string `json:"id"` + LifecycleState VolumeLifecycleStateEnum `json:"lifecycleState"` + SizeInMBs *int `json:"sizeInMBs"` + TimeCreated *common.SDKTime `json:"timeCreated"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + m.IsHydrated = model.IsHydrated + m.SizeInGBs = model.SizeInGBs + nn, e := model.SourceDetails.UnmarshalPolymorphicJSON(model.SourceDetails.JsonData) + if e != nil { + return + } + m.SourceDetails = nn + m.AvailabilityDomain = model.AvailabilityDomain + m.CompartmentId = model.CompartmentId + m.DisplayName = model.DisplayName + m.Id = model.Id + m.LifecycleState = model.LifecycleState + m.SizeInMBs = model.SizeInMBs + m.TimeCreated = model.TimeCreated + return +} + +// VolumeLifecycleStateEnum Enum with underlying type: string +type VolumeLifecycleStateEnum string + +// Set of constants representing the allowable values for VolumeLifecycleState +const ( + VolumeLifecycleStateProvisioning VolumeLifecycleStateEnum = "PROVISIONING" + VolumeLifecycleStateRestoring VolumeLifecycleStateEnum = "RESTORING" + VolumeLifecycleStateAvailable VolumeLifecycleStateEnum = "AVAILABLE" + VolumeLifecycleStateTerminating VolumeLifecycleStateEnum = "TERMINATING" + VolumeLifecycleStateTerminated VolumeLifecycleStateEnum = "TERMINATED" + VolumeLifecycleStateFaulty VolumeLifecycleStateEnum = "FAULTY" +) + +var mappingVolumeLifecycleState = map[string]VolumeLifecycleStateEnum{ + "PROVISIONING": VolumeLifecycleStateProvisioning, + "RESTORING": VolumeLifecycleStateRestoring, + "AVAILABLE": VolumeLifecycleStateAvailable, + "TERMINATING": VolumeLifecycleStateTerminating, + "TERMINATED": VolumeLifecycleStateTerminated, + "FAULTY": VolumeLifecycleStateFaulty, +} + +// GetVolumeLifecycleStateEnumValues Enumerates the set of values for VolumeLifecycleState +func GetVolumeLifecycleStateEnumValues() []VolumeLifecycleStateEnum { + values := make([]VolumeLifecycleStateEnum, 0) + for _, v := range mappingVolumeLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/volume_attachment.go b/vendor/github.com/oracle/oci-go-sdk/core/volume_attachment.go new file mode 100644 index 0000000000..d8942c4e9f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/volume_attachment.go @@ -0,0 +1,171 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// VolumeAttachment A base object for all types of attachments between a storage volume and an instance. +// For specific details about iSCSI attachments, see +// IScsiVolumeAttachment. +// For general information about volume attachments, see +// Overview of Block Volume Storage (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/overview.htm). +type VolumeAttachment interface { + + // The Availability Domain of an instance. + // Example: `Uocm:PHX-AD-1` + GetAvailabilityDomain() *string + + // The OCID of the compartment. + GetCompartmentId() *string + + // The OCID of the volume attachment. + GetId() *string + + // The OCID of the instance the volume is attached to. + GetInstanceId() *string + + // The current state of the volume attachment. + GetLifecycleState() VolumeAttachmentLifecycleStateEnum + + // The date and time the volume was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + GetTimeCreated() *common.SDKTime + + // The OCID of the volume. + GetVolumeId() *string + + // A user-friendly name. Does not have to be unique, and it cannot be changed. + // Avoid entering confidential information. + // Example: `My volume attachment` + GetDisplayName() *string +} + +type volumeattachment struct { + JsonData []byte + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + CompartmentId *string `mandatory:"true" json:"compartmentId"` + Id *string `mandatory:"true" json:"id"` + InstanceId *string `mandatory:"true" json:"instanceId"` + LifecycleState VolumeAttachmentLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + VolumeId *string `mandatory:"true" json:"volumeId"` + DisplayName *string `mandatory:"false" json:"displayName"` + AttachmentType string `json:"attachmentType"` +} + +// UnmarshalJSON unmarshals json +func (m *volumeattachment) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalervolumeattachment volumeattachment + s := struct { + Model Unmarshalervolumeattachment + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.AvailabilityDomain = s.Model.AvailabilityDomain + m.CompartmentId = s.Model.CompartmentId + m.Id = s.Model.Id + m.InstanceId = s.Model.InstanceId + m.LifecycleState = s.Model.LifecycleState + m.TimeCreated = s.Model.TimeCreated + m.VolumeId = s.Model.VolumeId + m.DisplayName = s.Model.DisplayName + m.AttachmentType = s.Model.AttachmentType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *volumeattachment) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.AttachmentType { + case "iscsi": + mm := IScsiVolumeAttachment{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +//GetAvailabilityDomain returns AvailabilityDomain +func (m volumeattachment) GetAvailabilityDomain() *string { + return m.AvailabilityDomain +} + +//GetCompartmentId returns CompartmentId +func (m volumeattachment) GetCompartmentId() *string { + return m.CompartmentId +} + +//GetId returns Id +func (m volumeattachment) GetId() *string { + return m.Id +} + +//GetInstanceId returns InstanceId +func (m volumeattachment) GetInstanceId() *string { + return m.InstanceId +} + +//GetLifecycleState returns LifecycleState +func (m volumeattachment) GetLifecycleState() VolumeAttachmentLifecycleStateEnum { + return m.LifecycleState +} + +//GetTimeCreated returns TimeCreated +func (m volumeattachment) GetTimeCreated() *common.SDKTime { + return m.TimeCreated +} + +//GetVolumeId returns VolumeId +func (m volumeattachment) GetVolumeId() *string { + return m.VolumeId +} + +//GetDisplayName returns DisplayName +func (m volumeattachment) GetDisplayName() *string { + return m.DisplayName +} + +func (m volumeattachment) String() string { + return common.PointerString(m) +} + +// VolumeAttachmentLifecycleStateEnum Enum with underlying type: string +type VolumeAttachmentLifecycleStateEnum string + +// Set of constants representing the allowable values for VolumeAttachmentLifecycleState +const ( + VolumeAttachmentLifecycleStateAttaching VolumeAttachmentLifecycleStateEnum = "ATTACHING" + VolumeAttachmentLifecycleStateAttached VolumeAttachmentLifecycleStateEnum = "ATTACHED" + VolumeAttachmentLifecycleStateDetaching VolumeAttachmentLifecycleStateEnum = "DETACHING" + VolumeAttachmentLifecycleStateDetached VolumeAttachmentLifecycleStateEnum = "DETACHED" +) + +var mappingVolumeAttachmentLifecycleState = map[string]VolumeAttachmentLifecycleStateEnum{ + "ATTACHING": VolumeAttachmentLifecycleStateAttaching, + "ATTACHED": VolumeAttachmentLifecycleStateAttached, + "DETACHING": VolumeAttachmentLifecycleStateDetaching, + "DETACHED": VolumeAttachmentLifecycleStateDetached, +} + +// GetVolumeAttachmentLifecycleStateEnumValues Enumerates the set of values for VolumeAttachmentLifecycleState +func GetVolumeAttachmentLifecycleStateEnumValues() []VolumeAttachmentLifecycleStateEnum { + values := make([]VolumeAttachmentLifecycleStateEnum, 0) + for _, v := range mappingVolumeAttachmentLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/volume_backup.go b/vendor/github.com/oracle/oci-go-sdk/core/volume_backup.go new file mode 100644 index 0000000000..6fd52b8787 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/volume_backup.go @@ -0,0 +1,96 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// VolumeBackup A point-in-time copy of a volume that can then be used to create a new block volume +// or recover a block volume. For more information, see +// Overview of Cloud Volume Storage (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type VolumeBackup struct { + + // The OCID of the compartment that contains the volume backup. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name for the volume backup. Does not have to be unique and it's changeable. + // Avoid entering confidential information. + DisplayName *string `mandatory:"true" json:"displayName"` + + // The OCID of the volume backup. + Id *string `mandatory:"true" json:"id"` + + // The current state of a volume backup. + LifecycleState VolumeBackupLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The date and time the volume backup was created. This is the time the actual point-in-time image + // of the volume data was taken. Format defined by RFC3339. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The size of the volume, in GBs. + SizeInGBs *int `mandatory:"false" json:"sizeInGBs"` + + // The size of the volume in MBs. The value must be a multiple of 1024. + // This field is deprecated. Please use sizeInGBs. + SizeInMBs *int `mandatory:"false" json:"sizeInMBs"` + + // The date and time the request to create the volume backup was received. Format defined by RFC3339. + TimeRequestReceived *common.SDKTime `mandatory:"false" json:"timeRequestReceived"` + + // The size used by the backup, in GBs. It is typically smaller than sizeInGBs, depending on the space + // consumed on the volume and whether the backup is full or incremental. + UniqueSizeInGBs *int `mandatory:"false" json:"uniqueSizeInGBs"` + + // The size used by the backup, in MBs. It is typically smaller than sizeInMBs, depending on the space + // consumed on the volume and whether the backup is full or incremental. + // This field is deprecated. Please use uniqueSizeInGBs. + UniqueSizeInMbs *int `mandatory:"false" json:"uniqueSizeInMbs"` + + // The OCID of the volume. + VolumeId *string `mandatory:"false" json:"volumeId"` +} + +func (m VolumeBackup) String() string { + return common.PointerString(m) +} + +// VolumeBackupLifecycleStateEnum Enum with underlying type: string +type VolumeBackupLifecycleStateEnum string + +// Set of constants representing the allowable values for VolumeBackupLifecycleState +const ( + VolumeBackupLifecycleStateCreating VolumeBackupLifecycleStateEnum = "CREATING" + VolumeBackupLifecycleStateAvailable VolumeBackupLifecycleStateEnum = "AVAILABLE" + VolumeBackupLifecycleStateTerminating VolumeBackupLifecycleStateEnum = "TERMINATING" + VolumeBackupLifecycleStateTerminated VolumeBackupLifecycleStateEnum = "TERMINATED" + VolumeBackupLifecycleStateFaulty VolumeBackupLifecycleStateEnum = "FAULTY" + VolumeBackupLifecycleStateRequestReceived VolumeBackupLifecycleStateEnum = "REQUEST_RECEIVED" +) + +var mappingVolumeBackupLifecycleState = map[string]VolumeBackupLifecycleStateEnum{ + "CREATING": VolumeBackupLifecycleStateCreating, + "AVAILABLE": VolumeBackupLifecycleStateAvailable, + "TERMINATING": VolumeBackupLifecycleStateTerminating, + "TERMINATED": VolumeBackupLifecycleStateTerminated, + "FAULTY": VolumeBackupLifecycleStateFaulty, + "REQUEST_RECEIVED": VolumeBackupLifecycleStateRequestReceived, +} + +// GetVolumeBackupLifecycleStateEnumValues Enumerates the set of values for VolumeBackupLifecycleState +func GetVolumeBackupLifecycleStateEnumValues() []VolumeBackupLifecycleStateEnum { + values := make([]VolumeBackupLifecycleStateEnum, 0) + for _, v := range mappingVolumeBackupLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/volume_source_details.go b/vendor/github.com/oracle/oci-go-sdk/core/volume_source_details.go new file mode 100644 index 0000000000..336c21e8ba --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/volume_source_details.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// VolumeSourceDetails The representation of VolumeSourceDetails +type VolumeSourceDetails interface { +} + +type volumesourcedetails struct { + JsonData []byte + Type string `json:"type"` +} + +// UnmarshalJSON unmarshals json +func (m *volumesourcedetails) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalervolumesourcedetails volumesourcedetails + s := struct { + Model Unmarshalervolumesourcedetails + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.Type = s.Model.Type + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *volumesourcedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.Type { + case "volume": + mm := VolumeSourceFromVolumeDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + case "volumeBackup": + mm := VolumeSourceFromVolumeBackupDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +func (m volumesourcedetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/volume_source_from_volume_backup_details.go b/vendor/github.com/oracle/oci-go-sdk/core/volume_source_from_volume_backup_details.go new file mode 100644 index 0000000000..5c6d57af3a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/volume_source_from_volume_backup_details.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// VolumeSourceFromVolumeBackupDetails Specifies the volume backup. +type VolumeSourceFromVolumeBackupDetails struct { + + // The OCID of the volume backup. + Id *string `mandatory:"true" json:"id"` +} + +func (m VolumeSourceFromVolumeBackupDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m VolumeSourceFromVolumeBackupDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeVolumeSourceFromVolumeBackupDetails VolumeSourceFromVolumeBackupDetails + s := struct { + DiscriminatorParam string `json:"type"` + MarshalTypeVolumeSourceFromVolumeBackupDetails + }{ + "volumeBackup", + (MarshalTypeVolumeSourceFromVolumeBackupDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/core/volume_source_from_volume_details.go b/vendor/github.com/oracle/oci-go-sdk/core/volume_source_from_volume_details.go new file mode 100644 index 0000000000..bb1ed162a1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/core/volume_source_from_volume_details.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Core Services API +// +// APIs for Networking Service, Compute Service, and Block Volume Service. +// + +package core + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// VolumeSourceFromVolumeDetails Specifies the source volume. +type VolumeSourceFromVolumeDetails struct { + + // The OCID of the volume. + Id *string `mandatory:"true" json:"id"` +} + +func (m VolumeSourceFromVolumeDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m VolumeSourceFromVolumeDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeVolumeSourceFromVolumeDetails VolumeSourceFromVolumeDetails + s := struct { + DiscriminatorParam string `json:"type"` + MarshalTypeVolumeSourceFromVolumeDetails + }{ + "volume", + (MarshalTypeVolumeSourceFromVolumeDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/backup.go b/vendor/github.com/oracle/oci-go-sdk/database/backup.go new file mode 100644 index 0000000000..f898387ef3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/backup.go @@ -0,0 +1,106 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Backup A database backup +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Backup struct { + + // The name of the Availability Domain that the backup is located in. + AvailabilityDomain *string `mandatory:"false" json:"availabilityDomain"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // The OCID of the database. + DatabaseId *string `mandatory:"false" json:"databaseId"` + + // The user-friendly name for the backup. It does not have to be unique. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The OCID of the backup. + Id *string `mandatory:"false" json:"id"` + + // Additional information about the current lifecycleState. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The current state of the backup. + LifecycleState BackupLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The date and time the backup was completed. + TimeEnded *common.SDKTime `mandatory:"false" json:"timeEnded"` + + // The date and time the backup starts. + TimeStarted *common.SDKTime `mandatory:"false" json:"timeStarted"` + + // The type of backup. + Type BackupTypeEnum `mandatory:"false" json:"type,omitempty"` +} + +func (m Backup) String() string { + return common.PointerString(m) +} + +// BackupLifecycleStateEnum Enum with underlying type: string +type BackupLifecycleStateEnum string + +// Set of constants representing the allowable values for BackupLifecycleState +const ( + BackupLifecycleStateCreating BackupLifecycleStateEnum = "CREATING" + BackupLifecycleStateActive BackupLifecycleStateEnum = "ACTIVE" + BackupLifecycleStateDeleting BackupLifecycleStateEnum = "DELETING" + BackupLifecycleStateDeleted BackupLifecycleStateEnum = "DELETED" + BackupLifecycleStateFailed BackupLifecycleStateEnum = "FAILED" + BackupLifecycleStateRestoring BackupLifecycleStateEnum = "RESTORING" +) + +var mappingBackupLifecycleState = map[string]BackupLifecycleStateEnum{ + "CREATING": BackupLifecycleStateCreating, + "ACTIVE": BackupLifecycleStateActive, + "DELETING": BackupLifecycleStateDeleting, + "DELETED": BackupLifecycleStateDeleted, + "FAILED": BackupLifecycleStateFailed, + "RESTORING": BackupLifecycleStateRestoring, +} + +// GetBackupLifecycleStateEnumValues Enumerates the set of values for BackupLifecycleState +func GetBackupLifecycleStateEnumValues() []BackupLifecycleStateEnum { + values := make([]BackupLifecycleStateEnum, 0) + for _, v := range mappingBackupLifecycleState { + values = append(values, v) + } + return values +} + +// BackupTypeEnum Enum with underlying type: string +type BackupTypeEnum string + +// Set of constants representing the allowable values for BackupType +const ( + BackupTypeIncremental BackupTypeEnum = "INCREMENTAL" + BackupTypeFull BackupTypeEnum = "FULL" +) + +var mappingBackupType = map[string]BackupTypeEnum{ + "INCREMENTAL": BackupTypeIncremental, + "FULL": BackupTypeFull, +} + +// GetBackupTypeEnumValues Enumerates the set of values for BackupType +func GetBackupTypeEnumValues() []BackupTypeEnum { + values := make([]BackupTypeEnum, 0) + for _, v := range mappingBackupType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/backup_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/backup_summary.go new file mode 100644 index 0000000000..5e12d1c60e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/backup_summary.go @@ -0,0 +1,106 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BackupSummary A database backup +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type BackupSummary struct { + + // The name of the Availability Domain that the backup is located in. + AvailabilityDomain *string `mandatory:"false" json:"availabilityDomain"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // The OCID of the database. + DatabaseId *string `mandatory:"false" json:"databaseId"` + + // The user-friendly name for the backup. It does not have to be unique. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The OCID of the backup. + Id *string `mandatory:"false" json:"id"` + + // Additional information about the current lifecycleState. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The current state of the backup. + LifecycleState BackupSummaryLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The date and time the backup was completed. + TimeEnded *common.SDKTime `mandatory:"false" json:"timeEnded"` + + // The date and time the backup starts. + TimeStarted *common.SDKTime `mandatory:"false" json:"timeStarted"` + + // The type of backup. + Type BackupSummaryTypeEnum `mandatory:"false" json:"type,omitempty"` +} + +func (m BackupSummary) String() string { + return common.PointerString(m) +} + +// BackupSummaryLifecycleStateEnum Enum with underlying type: string +type BackupSummaryLifecycleStateEnum string + +// Set of constants representing the allowable values for BackupSummaryLifecycleState +const ( + BackupSummaryLifecycleStateCreating BackupSummaryLifecycleStateEnum = "CREATING" + BackupSummaryLifecycleStateActive BackupSummaryLifecycleStateEnum = "ACTIVE" + BackupSummaryLifecycleStateDeleting BackupSummaryLifecycleStateEnum = "DELETING" + BackupSummaryLifecycleStateDeleted BackupSummaryLifecycleStateEnum = "DELETED" + BackupSummaryLifecycleStateFailed BackupSummaryLifecycleStateEnum = "FAILED" + BackupSummaryLifecycleStateRestoring BackupSummaryLifecycleStateEnum = "RESTORING" +) + +var mappingBackupSummaryLifecycleState = map[string]BackupSummaryLifecycleStateEnum{ + "CREATING": BackupSummaryLifecycleStateCreating, + "ACTIVE": BackupSummaryLifecycleStateActive, + "DELETING": BackupSummaryLifecycleStateDeleting, + "DELETED": BackupSummaryLifecycleStateDeleted, + "FAILED": BackupSummaryLifecycleStateFailed, + "RESTORING": BackupSummaryLifecycleStateRestoring, +} + +// GetBackupSummaryLifecycleStateEnumValues Enumerates the set of values for BackupSummaryLifecycleState +func GetBackupSummaryLifecycleStateEnumValues() []BackupSummaryLifecycleStateEnum { + values := make([]BackupSummaryLifecycleStateEnum, 0) + for _, v := range mappingBackupSummaryLifecycleState { + values = append(values, v) + } + return values +} + +// BackupSummaryTypeEnum Enum with underlying type: string +type BackupSummaryTypeEnum string + +// Set of constants representing the allowable values for BackupSummaryType +const ( + BackupSummaryTypeIncremental BackupSummaryTypeEnum = "INCREMENTAL" + BackupSummaryTypeFull BackupSummaryTypeEnum = "FULL" +) + +var mappingBackupSummaryType = map[string]BackupSummaryTypeEnum{ + "INCREMENTAL": BackupSummaryTypeIncremental, + "FULL": BackupSummaryTypeFull, +} + +// GetBackupSummaryTypeEnumValues Enumerates the set of values for BackupSummaryType +func GetBackupSummaryTypeEnumValues() []BackupSummaryTypeEnum { + values := make([]BackupSummaryTypeEnum, 0) + for _, v := range mappingBackupSummaryType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_backup_details.go b/vendor/github.com/oracle/oci-go-sdk/database/create_backup_details.go new file mode 100644 index 0000000000..6faa74c499 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_backup_details.go @@ -0,0 +1,27 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateBackupDetails The representation of CreateBackupDetails +type CreateBackupDetails struct { + + // The OCID of the database. + DatabaseId *string `mandatory:"true" json:"databaseId"` + + // The user-friendly name for the backup. It does not have to be unique. + DisplayName *string `mandatory:"true" json:"displayName"` +} + +func (m CreateBackupDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_backup_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/create_backup_request_response.go new file mode 100644 index 0000000000..9cd01036e2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_backup_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateBackupRequest wrapper for the CreateBackup operation +type CreateBackupRequest struct { + + // Request to create a new database backup. + CreateBackupDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateBackupRequest) String() string { + return common.PointerString(request) +} + +// CreateBackupResponse wrapper for the CreateBackup operation +type CreateBackupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Backup instance + Backup `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateBackupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_data_guard_association_details.go b/vendor/github.com/oracle/oci-go-sdk/database/create_data_guard_association_details.go new file mode 100644 index 0000000000..dc92eb6545 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_data_guard_association_details.go @@ -0,0 +1,158 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDataGuardAssociationDetails The configuration details for creating a Data Guard association between databases. +// **NOTE:** +// "ExistingDbSystem" is the only supported `creationType` value. Therefore, all +// CreateDataGuardAssociation +// requests must include the `peerDbSystemId` parameter found in the +// CreateDataGuardAssociationToExistingDbSystemDetails +// object. +type CreateDataGuardAssociationDetails interface { + + // A strong password for the `SYS`, `SYSTEM`, and `PDB Admin` users to apply during standby creation. + // The password must contain no fewer than nine characters and include: + // * At least two uppercase characters. + // * At least two lowercase characters. + // * At least two numeric characters. + // * At least two special characters. Valid special characters include "_", "#", and "-" only. + // **The password MUST be the same as the primary admin password.** + GetDatabaseAdminPassword() *string + + // The protection mode to set up between the primary and standby databases. For more information, see + // Oracle Data Guard Protection Modes (http://docs.oracle.com/database/122/SBYDB/oracle-data-guard-protection-modes.htm#SBYDB02000) + // in the Oracle Data Guard documentation. + // **IMPORTANT** - The only protection mode currently supported by the Database Service is MAXIMUM_PERFORMANCE. + GetProtectionMode() CreateDataGuardAssociationDetailsProtectionModeEnum + + // The redo transport type to use for this Data Guard association. Valid values depend on the specified `protectionMode`: + // * MAXIMUM_AVAILABILITY - SYNC or FASTSYNC + // * MAXIMUM_PERFORMANCE - ASYNC + // * MAXIMUM_PROTECTION - SYNC + // For more information, see + // Redo Transport Services (http://docs.oracle.com/database/122/SBYDB/oracle-data-guard-redo-transport-services.htm#SBYDB00400) + // in the Oracle Data Guard documentation. + // **IMPORTANT** - The only transport type currently supported by the Database Service is ASYNC. + GetTransportType() CreateDataGuardAssociationDetailsTransportTypeEnum +} + +type createdataguardassociationdetails struct { + JsonData []byte + DatabaseAdminPassword *string `mandatory:"true" json:"databaseAdminPassword"` + ProtectionMode CreateDataGuardAssociationDetailsProtectionModeEnum `mandatory:"true" json:"protectionMode"` + TransportType CreateDataGuardAssociationDetailsTransportTypeEnum `mandatory:"true" json:"transportType"` + CreationType string `json:"creationType"` +} + +// UnmarshalJSON unmarshals json +func (m *createdataguardassociationdetails) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalercreatedataguardassociationdetails createdataguardassociationdetails + s := struct { + Model Unmarshalercreatedataguardassociationdetails + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.DatabaseAdminPassword = s.Model.DatabaseAdminPassword + m.ProtectionMode = s.Model.ProtectionMode + m.TransportType = s.Model.TransportType + m.CreationType = s.Model.CreationType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *createdataguardassociationdetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.CreationType { + case "ExistingDbSystem": + mm := CreateDataGuardAssociationToExistingDbSystemDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +//GetDatabaseAdminPassword returns DatabaseAdminPassword +func (m createdataguardassociationdetails) GetDatabaseAdminPassword() *string { + return m.DatabaseAdminPassword +} + +//GetProtectionMode returns ProtectionMode +func (m createdataguardassociationdetails) GetProtectionMode() CreateDataGuardAssociationDetailsProtectionModeEnum { + return m.ProtectionMode +} + +//GetTransportType returns TransportType +func (m createdataguardassociationdetails) GetTransportType() CreateDataGuardAssociationDetailsTransportTypeEnum { + return m.TransportType +} + +func (m createdataguardassociationdetails) String() string { + return common.PointerString(m) +} + +// CreateDataGuardAssociationDetailsProtectionModeEnum Enum with underlying type: string +type CreateDataGuardAssociationDetailsProtectionModeEnum string + +// Set of constants representing the allowable values for CreateDataGuardAssociationDetailsProtectionMode +const ( + CreateDataGuardAssociationDetailsProtectionModeAvailability CreateDataGuardAssociationDetailsProtectionModeEnum = "MAXIMUM_AVAILABILITY" + CreateDataGuardAssociationDetailsProtectionModePerformance CreateDataGuardAssociationDetailsProtectionModeEnum = "MAXIMUM_PERFORMANCE" + CreateDataGuardAssociationDetailsProtectionModeProtection CreateDataGuardAssociationDetailsProtectionModeEnum = "MAXIMUM_PROTECTION" +) + +var mappingCreateDataGuardAssociationDetailsProtectionMode = map[string]CreateDataGuardAssociationDetailsProtectionModeEnum{ + "MAXIMUM_AVAILABILITY": CreateDataGuardAssociationDetailsProtectionModeAvailability, + "MAXIMUM_PERFORMANCE": CreateDataGuardAssociationDetailsProtectionModePerformance, + "MAXIMUM_PROTECTION": CreateDataGuardAssociationDetailsProtectionModeProtection, +} + +// GetCreateDataGuardAssociationDetailsProtectionModeEnumValues Enumerates the set of values for CreateDataGuardAssociationDetailsProtectionMode +func GetCreateDataGuardAssociationDetailsProtectionModeEnumValues() []CreateDataGuardAssociationDetailsProtectionModeEnum { + values := make([]CreateDataGuardAssociationDetailsProtectionModeEnum, 0) + for _, v := range mappingCreateDataGuardAssociationDetailsProtectionMode { + values = append(values, v) + } + return values +} + +// CreateDataGuardAssociationDetailsTransportTypeEnum Enum with underlying type: string +type CreateDataGuardAssociationDetailsTransportTypeEnum string + +// Set of constants representing the allowable values for CreateDataGuardAssociationDetailsTransportType +const ( + CreateDataGuardAssociationDetailsTransportTypeSync CreateDataGuardAssociationDetailsTransportTypeEnum = "SYNC" + CreateDataGuardAssociationDetailsTransportTypeAsync CreateDataGuardAssociationDetailsTransportTypeEnum = "ASYNC" + CreateDataGuardAssociationDetailsTransportTypeFastsync CreateDataGuardAssociationDetailsTransportTypeEnum = "FASTSYNC" +) + +var mappingCreateDataGuardAssociationDetailsTransportType = map[string]CreateDataGuardAssociationDetailsTransportTypeEnum{ + "SYNC": CreateDataGuardAssociationDetailsTransportTypeSync, + "ASYNC": CreateDataGuardAssociationDetailsTransportTypeAsync, + "FASTSYNC": CreateDataGuardAssociationDetailsTransportTypeFastsync, +} + +// GetCreateDataGuardAssociationDetailsTransportTypeEnumValues Enumerates the set of values for CreateDataGuardAssociationDetailsTransportType +func GetCreateDataGuardAssociationDetailsTransportTypeEnumValues() []CreateDataGuardAssociationDetailsTransportTypeEnum { + values := make([]CreateDataGuardAssociationDetailsTransportTypeEnum, 0) + for _, v := range mappingCreateDataGuardAssociationDetailsTransportType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_data_guard_association_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/create_data_guard_association_request_response.go new file mode 100644 index 0000000000..b65888e013 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_data_guard_association_request_response.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateDataGuardAssociationRequest wrapper for the CreateDataGuardAssociation operation +type CreateDataGuardAssociationRequest struct { + + // The database OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DatabaseId *string `mandatory:"true" contributesTo:"path" name:"databaseId"` + + // A request to create a Data Guard association. + CreateDataGuardAssociationDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateDataGuardAssociationRequest) String() string { + return common.PointerString(request) +} + +// CreateDataGuardAssociationResponse wrapper for the CreateDataGuardAssociation operation +type CreateDataGuardAssociationResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DataGuardAssociation instance + DataGuardAssociation `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateDataGuardAssociationResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_data_guard_association_to_existing_db_system_details.go b/vendor/github.com/oracle/oci-go-sdk/database/create_data_guard_association_to_existing_db_system_details.go new file mode 100644 index 0000000000..0badd6d504 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_data_guard_association_to_existing_db_system_details.go @@ -0,0 +1,79 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDataGuardAssociationToExistingDbSystemDetails The configuration details for creating a Data Guard association to an existing database. +type CreateDataGuardAssociationToExistingDbSystemDetails struct { + + // A strong password for the `SYS`, `SYSTEM`, and `PDB Admin` users to apply during standby creation. + // The password must contain no fewer than nine characters and include: + // * At least two uppercase characters. + // * At least two lowercase characters. + // * At least two numeric characters. + // * At least two special characters. Valid special characters include "_", "#", and "-" only. + // **The password MUST be the same as the primary admin password.** + DatabaseAdminPassword *string `mandatory:"true" json:"databaseAdminPassword"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the DB System to create the standby database on. + PeerDbSystemId *string `mandatory:"false" json:"peerDbSystemId"` + + // The protection mode to set up between the primary and standby databases. For more information, see + // Oracle Data Guard Protection Modes (http://docs.oracle.com/database/122/SBYDB/oracle-data-guard-protection-modes.htm#SBYDB02000) + // in the Oracle Data Guard documentation. + // **IMPORTANT** - The only protection mode currently supported by the Database Service is MAXIMUM_PERFORMANCE. + ProtectionMode CreateDataGuardAssociationDetailsProtectionModeEnum `mandatory:"true" json:"protectionMode"` + + // The redo transport type to use for this Data Guard association. Valid values depend on the specified `protectionMode`: + // * MAXIMUM_AVAILABILITY - SYNC or FASTSYNC + // * MAXIMUM_PERFORMANCE - ASYNC + // * MAXIMUM_PROTECTION - SYNC + // For more information, see + // Redo Transport Services (http://docs.oracle.com/database/122/SBYDB/oracle-data-guard-redo-transport-services.htm#SBYDB00400) + // in the Oracle Data Guard documentation. + // **IMPORTANT** - The only transport type currently supported by the Database Service is ASYNC. + TransportType CreateDataGuardAssociationDetailsTransportTypeEnum `mandatory:"true" json:"transportType"` +} + +//GetDatabaseAdminPassword returns DatabaseAdminPassword +func (m CreateDataGuardAssociationToExistingDbSystemDetails) GetDatabaseAdminPassword() *string { + return m.DatabaseAdminPassword +} + +//GetProtectionMode returns ProtectionMode +func (m CreateDataGuardAssociationToExistingDbSystemDetails) GetProtectionMode() CreateDataGuardAssociationDetailsProtectionModeEnum { + return m.ProtectionMode +} + +//GetTransportType returns TransportType +func (m CreateDataGuardAssociationToExistingDbSystemDetails) GetTransportType() CreateDataGuardAssociationDetailsTransportTypeEnum { + return m.TransportType +} + +func (m CreateDataGuardAssociationToExistingDbSystemDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m CreateDataGuardAssociationToExistingDbSystemDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCreateDataGuardAssociationToExistingDbSystemDetails CreateDataGuardAssociationToExistingDbSystemDetails + s := struct { + DiscriminatorParam string `json:"creationType"` + MarshalTypeCreateDataGuardAssociationToExistingDbSystemDetails + }{ + "ExistingDbSystem", + (MarshalTypeCreateDataGuardAssociationToExistingDbSystemDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_database_details.go b/vendor/github.com/oracle/oci-go-sdk/database/create_database_details.go new file mode 100644 index 0000000000..0565459d57 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_database_details.go @@ -0,0 +1,66 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDatabaseDetails The representation of CreateDatabaseDetails +type CreateDatabaseDetails struct { + + // A strong password for SYS, SYSTEM, and PDB Admin. The password must be at least nine characters and contain at least two uppercase, two lowercase, two numbers, and two special characters. The special characters must be _, \#, or -. + AdminPassword *string `mandatory:"true" json:"adminPassword"` + + // The database name. It must begin with an alphabetic character and can contain a maximum of eight alphanumeric characters. Special characters are not permitted. + DbName *string `mandatory:"true" json:"dbName"` + + // The character set for the database. The default is AL32UTF8. Allowed values are: + // AL32UTF8, AR8ADOS710, AR8ADOS720, AR8APTEC715, AR8ARABICMACS, AR8ASMO8X, AR8ISO8859P6, AR8MSWIN1256, AR8MUSSAD768, AR8NAFITHA711, AR8NAFITHA721, AR8SAKHR706, AR8SAKHR707, AZ8ISO8859P9E, BG8MSWIN, BG8PC437S, BLT8CP921, BLT8ISO8859P13, BLT8MSWIN1257, BLT8PC775, BN8BSCII, CDN8PC863, CEL8ISO8859P14, CL8ISO8859P5, CL8ISOIR111, CL8KOI8R, CL8KOI8U, CL8MACCYRILLICS, CL8MSWIN1251, EE8ISO8859P2, EE8MACCES, EE8MACCROATIANS, EE8MSWIN1250, EE8PC852, EL8DEC, EL8ISO8859P7, EL8MACGREEKS, EL8MSWIN1253, EL8PC437S, EL8PC851, EL8PC869, ET8MSWIN923, HU8ABMOD, HU8CWI2, IN8ISCII, IS8PC861, IW8ISO8859P8, IW8MACHEBREWS, IW8MSWIN1255, IW8PC1507, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE, JA16VMS, KO16KSCCS, KO16MSWIN949, LA8ISO6937, LA8PASSPORT, LT8MSWIN921, LT8PC772, LT8PC774, LV8PC1117, LV8PC8LR, LV8RST104090, N8PC865, NE8ISO8859P10, NEE8ISO8859P4, RU8BESTA, RU8PC855, RU8PC866, SE8ISO8859P3, TH8MACTHAIS, TH8TISASCII, TR8DEC, TR8MACTURKISHS, TR8MSWIN1254, TR8PC857, US7ASCII, US8PC437, UTF8, VN8MSWIN1258, VN8VN3, WE8DEC, WE8DG, WE8ISO8859P15, WE8ISO8859P9, WE8MACROMAN8S, WE8MSWIN1252, WE8NCR4970, WE8NEXTSTEP, WE8PC850, WE8PC858, WE8PC860, WE8ROMAN8, ZHS16CGB231280, ZHS16GBK, ZHT16BIG5, ZHT16CCDC, ZHT16DBT, ZHT16HKSCS, ZHT16MSWIN950, ZHT32EUC, ZHT32SOPS, ZHT32TRIS + CharacterSet *string `mandatory:"false" json:"characterSet"` + + DbBackupConfig *DbBackupConfig `mandatory:"false" json:"dbBackupConfig"` + + // Database workload type. + DbWorkload CreateDatabaseDetailsDbWorkloadEnum `mandatory:"false" json:"dbWorkload,omitempty"` + + // National character set for the database. The default is AL16UTF16. Allowed values are: + // AL16UTF16 or UTF8. + NcharacterSet *string `mandatory:"false" json:"ncharacterSet"` + + // Pluggable database name. It must begin with an alphabetic character and can contain a maximum of eight alphanumeric characters. Special characters are not permitted. Pluggable database should not be same as database name. + PdbName *string `mandatory:"false" json:"pdbName"` +} + +func (m CreateDatabaseDetails) String() string { + return common.PointerString(m) +} + +// CreateDatabaseDetailsDbWorkloadEnum Enum with underlying type: string +type CreateDatabaseDetailsDbWorkloadEnum string + +// Set of constants representing the allowable values for CreateDatabaseDetailsDbWorkload +const ( + CreateDatabaseDetailsDbWorkloadOltp CreateDatabaseDetailsDbWorkloadEnum = "OLTP" + CreateDatabaseDetailsDbWorkloadDss CreateDatabaseDetailsDbWorkloadEnum = "DSS" +) + +var mappingCreateDatabaseDetailsDbWorkload = map[string]CreateDatabaseDetailsDbWorkloadEnum{ + "OLTP": CreateDatabaseDetailsDbWorkloadOltp, + "DSS": CreateDatabaseDetailsDbWorkloadDss, +} + +// GetCreateDatabaseDetailsDbWorkloadEnumValues Enumerates the set of values for CreateDatabaseDetailsDbWorkload +func GetCreateDatabaseDetailsDbWorkloadEnumValues() []CreateDatabaseDetailsDbWorkloadEnum { + values := make([]CreateDatabaseDetailsDbWorkloadEnum, 0) + for _, v := range mappingCreateDatabaseDetailsDbWorkload { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_database_from_backup_details.go b/vendor/github.com/oracle/oci-go-sdk/database/create_database_from_backup_details.go new file mode 100644 index 0000000000..9c25aadc46 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_database_from_backup_details.go @@ -0,0 +1,30 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDatabaseFromBackupDetails The representation of CreateDatabaseFromBackupDetails +type CreateDatabaseFromBackupDetails struct { + + // A strong password for SYS, SYSTEM, PDB Admin and TDE Wallet. The password must be at least nine characters and contain at least two uppercase, two lowercase, two numbers, and two special characters. The special characters must be _, \#, or -. + AdminPassword *string `mandatory:"true" json:"adminPassword"` + + // The backup OCID. + BackupId *string `mandatory:"true" json:"backupId"` + + // The password to open the TDE wallet. + BackupTDEPassword *string `mandatory:"true" json:"backupTDEPassword"` +} + +func (m CreateDatabaseFromBackupDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_details.go b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_details.go new file mode 100644 index 0000000000..93eb4c9280 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_details.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDbHomeDetails The representation of CreateDbHomeDetails +type CreateDbHomeDetails struct { + Database *CreateDatabaseDetails `mandatory:"true" json:"database"` + + // A valid Oracle database version. To get a list of supported versions, use the ListDbVersions operation. + DbVersion *string `mandatory:"true" json:"dbVersion"` + + // The user-provided name of the database home. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m CreateDbHomeDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_request_response.go new file mode 100644 index 0000000000..6df0ab66c6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateDbHomeRequest wrapper for the CreateDbHome operation +type CreateDbHomeRequest struct { + + // Request to create a new DB Home. + CreateDbHomeWithDbSystemIdBase `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateDbHomeRequest) String() string { + return common.PointerString(request) +} + +// CreateDbHomeResponse wrapper for the CreateDbHome operation +type CreateDbHomeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DbHome instance + DbHome `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateDbHomeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_with_db_system_id_base.go b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_with_db_system_id_base.go new file mode 100644 index 0000000000..670c00026d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_with_db_system_id_base.go @@ -0,0 +1,80 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDbHomeWithDbSystemIdBase The representation of CreateDbHomeWithDbSystemIdBase +type CreateDbHomeWithDbSystemIdBase interface { + + // The OCID of the DB System. + GetDbSystemId() *string + + // The user-provided name of the database home. + GetDisplayName() *string +} + +type createdbhomewithdbsystemidbase struct { + JsonData []byte + DbSystemId *string `mandatory:"true" json:"dbSystemId"` + DisplayName *string `mandatory:"false" json:"displayName"` + Source string `json:"source"` +} + +// UnmarshalJSON unmarshals json +func (m *createdbhomewithdbsystemidbase) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalercreatedbhomewithdbsystemidbase createdbhomewithdbsystemidbase + s := struct { + Model Unmarshalercreatedbhomewithdbsystemidbase + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.DbSystemId = s.Model.DbSystemId + m.DisplayName = s.Model.DisplayName + m.Source = s.Model.Source + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *createdbhomewithdbsystemidbase) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.Source { + case "DB_BACKUP": + mm := CreateDbHomeWithDbSystemIdFromBackupDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + case "NONE": + mm := CreateDbHomeWithDbSystemIdDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +//GetDbSystemId returns DbSystemId +func (m createdbhomewithdbsystemidbase) GetDbSystemId() *string { + return m.DbSystemId +} + +//GetDisplayName returns DisplayName +func (m createdbhomewithdbsystemidbase) GetDisplayName() *string { + return m.DisplayName +} + +func (m createdbhomewithdbsystemidbase) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_with_db_system_id_details.go b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_with_db_system_id_details.go new file mode 100644 index 0000000000..92795f7650 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_with_db_system_id_details.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDbHomeWithDbSystemIdDetails The representation of CreateDbHomeWithDbSystemIdDetails +type CreateDbHomeWithDbSystemIdDetails struct { + + // The OCID of the DB System. + DbSystemId *string `mandatory:"true" json:"dbSystemId"` + + Database *CreateDatabaseDetails `mandatory:"true" json:"database"` + + // A valid Oracle database version. To get a list of supported versions, use the ListDbVersions operation. + DbVersion *string `mandatory:"true" json:"dbVersion"` + + // The user-provided name of the database home. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +//GetDbSystemId returns DbSystemId +func (m CreateDbHomeWithDbSystemIdDetails) GetDbSystemId() *string { + return m.DbSystemId +} + +//GetDisplayName returns DisplayName +func (m CreateDbHomeWithDbSystemIdDetails) GetDisplayName() *string { + return m.DisplayName +} + +func (m CreateDbHomeWithDbSystemIdDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m CreateDbHomeWithDbSystemIdDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCreateDbHomeWithDbSystemIdDetails CreateDbHomeWithDbSystemIdDetails + s := struct { + DiscriminatorParam string `json:"source"` + MarshalTypeCreateDbHomeWithDbSystemIdDetails + }{ + "NONE", + (MarshalTypeCreateDbHomeWithDbSystemIdDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_with_db_system_id_from_backup_details.go b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_with_db_system_id_from_backup_details.go new file mode 100644 index 0000000000..98f9fc3051 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/create_db_home_with_db_system_id_from_backup_details.go @@ -0,0 +1,54 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateDbHomeWithDbSystemIdFromBackupDetails The representation of CreateDbHomeWithDbSystemIdFromBackupDetails +type CreateDbHomeWithDbSystemIdFromBackupDetails struct { + + // The OCID of the DB System. + DbSystemId *string `mandatory:"true" json:"dbSystemId"` + + Database *CreateDatabaseFromBackupDetails `mandatory:"true" json:"database"` + + // The user-provided name of the database home. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +//GetDbSystemId returns DbSystemId +func (m CreateDbHomeWithDbSystemIdFromBackupDetails) GetDbSystemId() *string { + return m.DbSystemId +} + +//GetDisplayName returns DisplayName +func (m CreateDbHomeWithDbSystemIdFromBackupDetails) GetDisplayName() *string { + return m.DisplayName +} + +func (m CreateDbHomeWithDbSystemIdFromBackupDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m CreateDbHomeWithDbSystemIdFromBackupDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCreateDbHomeWithDbSystemIdFromBackupDetails CreateDbHomeWithDbSystemIdFromBackupDetails + s := struct { + DiscriminatorParam string `json:"source"` + MarshalTypeCreateDbHomeWithDbSystemIdFromBackupDetails + }{ + "DB_BACKUP", + (MarshalTypeCreateDbHomeWithDbSystemIdFromBackupDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/data_guard_association.go b/vendor/github.com/oracle/oci-go-sdk/database/data_guard_association.go new file mode 100644 index 0000000000..d572feb421 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/data_guard_association.go @@ -0,0 +1,211 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DataGuardAssociation The properties that define a Data Guard association. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an +// administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +// For information about endpoints and signing API requests, see +// About the API (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm). For information about available SDKs and tools, see +// SDKS and Other Tools (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdks.htm). +type DataGuardAssociation struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the reporting database. + DatabaseId *string `mandatory:"true" json:"databaseId"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the Data Guard association. + Id *string `mandatory:"true" json:"id"` + + // The current state of the Data Guard association. + LifecycleState DataGuardAssociationLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the DB System containing the associated + // peer database. + PeerDbSystemId *string `mandatory:"true" json:"peerDbSystemId"` + + // The role of the peer database in this Data Guard association. + PeerRole DataGuardAssociationPeerRoleEnum `mandatory:"true" json:"peerRole"` + + // The protection mode of this Data Guard association. For more information, see + // Oracle Data Guard Protection Modes (http://docs.oracle.com/database/122/SBYDB/oracle-data-guard-protection-modes.htm#SBYDB02000) + // in the Oracle Data Guard documentation. + ProtectionMode DataGuardAssociationProtectionModeEnum `mandatory:"true" json:"protectionMode"` + + // The role of the reporting database in this Data Guard association. + Role DataGuardAssociationRoleEnum `mandatory:"true" json:"role"` + + // The lag time between updates to the primary database and application of the redo data on the standby database, + // as computed by the reporting database. + // Example: `9 seconds` + ApplyLag *string `mandatory:"false" json:"applyLag"` + + // The rate at which redo logs are synced between the associated databases. + // Example: `180 Mb per second` + ApplyRate *string `mandatory:"false" json:"applyRate"` + + // Additional information about the current lifecycleState, if available. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the peer database's Data Guard association. + PeerDataGuardAssociationId *string `mandatory:"false" json:"peerDataGuardAssociationId"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the associated peer database. + PeerDatabaseId *string `mandatory:"false" json:"peerDatabaseId"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the database home containing the associated peer database. + PeerDbHomeId *string `mandatory:"false" json:"peerDbHomeId"` + + // The date and time the Data Guard Association was created. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The redo transport type used by this Data Guard association. For more information, see + // Redo Transport Services (http://docs.oracle.com/database/122/SBYDB/oracle-data-guard-redo-transport-services.htm#SBYDB00400) + // in the Oracle Data Guard documentation. + TransportType DataGuardAssociationTransportTypeEnum `mandatory:"false" json:"transportType,omitempty"` +} + +func (m DataGuardAssociation) String() string { + return common.PointerString(m) +} + +// DataGuardAssociationLifecycleStateEnum Enum with underlying type: string +type DataGuardAssociationLifecycleStateEnum string + +// Set of constants representing the allowable values for DataGuardAssociationLifecycleState +const ( + DataGuardAssociationLifecycleStateProvisioning DataGuardAssociationLifecycleStateEnum = "PROVISIONING" + DataGuardAssociationLifecycleStateAvailable DataGuardAssociationLifecycleStateEnum = "AVAILABLE" + DataGuardAssociationLifecycleStateUpdating DataGuardAssociationLifecycleStateEnum = "UPDATING" + DataGuardAssociationLifecycleStateTerminating DataGuardAssociationLifecycleStateEnum = "TERMINATING" + DataGuardAssociationLifecycleStateTerminated DataGuardAssociationLifecycleStateEnum = "TERMINATED" + DataGuardAssociationLifecycleStateFailed DataGuardAssociationLifecycleStateEnum = "FAILED" +) + +var mappingDataGuardAssociationLifecycleState = map[string]DataGuardAssociationLifecycleStateEnum{ + "PROVISIONING": DataGuardAssociationLifecycleStateProvisioning, + "AVAILABLE": DataGuardAssociationLifecycleStateAvailable, + "UPDATING": DataGuardAssociationLifecycleStateUpdating, + "TERMINATING": DataGuardAssociationLifecycleStateTerminating, + "TERMINATED": DataGuardAssociationLifecycleStateTerminated, + "FAILED": DataGuardAssociationLifecycleStateFailed, +} + +// GetDataGuardAssociationLifecycleStateEnumValues Enumerates the set of values for DataGuardAssociationLifecycleState +func GetDataGuardAssociationLifecycleStateEnumValues() []DataGuardAssociationLifecycleStateEnum { + values := make([]DataGuardAssociationLifecycleStateEnum, 0) + for _, v := range mappingDataGuardAssociationLifecycleState { + values = append(values, v) + } + return values +} + +// DataGuardAssociationPeerRoleEnum Enum with underlying type: string +type DataGuardAssociationPeerRoleEnum string + +// Set of constants representing the allowable values for DataGuardAssociationPeerRole +const ( + DataGuardAssociationPeerRolePrimary DataGuardAssociationPeerRoleEnum = "PRIMARY" + DataGuardAssociationPeerRoleStandby DataGuardAssociationPeerRoleEnum = "STANDBY" + DataGuardAssociationPeerRoleDisabledStandby DataGuardAssociationPeerRoleEnum = "DISABLED_STANDBY" +) + +var mappingDataGuardAssociationPeerRole = map[string]DataGuardAssociationPeerRoleEnum{ + "PRIMARY": DataGuardAssociationPeerRolePrimary, + "STANDBY": DataGuardAssociationPeerRoleStandby, + "DISABLED_STANDBY": DataGuardAssociationPeerRoleDisabledStandby, +} + +// GetDataGuardAssociationPeerRoleEnumValues Enumerates the set of values for DataGuardAssociationPeerRole +func GetDataGuardAssociationPeerRoleEnumValues() []DataGuardAssociationPeerRoleEnum { + values := make([]DataGuardAssociationPeerRoleEnum, 0) + for _, v := range mappingDataGuardAssociationPeerRole { + values = append(values, v) + } + return values +} + +// DataGuardAssociationProtectionModeEnum Enum with underlying type: string +type DataGuardAssociationProtectionModeEnum string + +// Set of constants representing the allowable values for DataGuardAssociationProtectionMode +const ( + DataGuardAssociationProtectionModeAvailability DataGuardAssociationProtectionModeEnum = "MAXIMUM_AVAILABILITY" + DataGuardAssociationProtectionModePerformance DataGuardAssociationProtectionModeEnum = "MAXIMUM_PERFORMANCE" + DataGuardAssociationProtectionModeProtection DataGuardAssociationProtectionModeEnum = "MAXIMUM_PROTECTION" +) + +var mappingDataGuardAssociationProtectionMode = map[string]DataGuardAssociationProtectionModeEnum{ + "MAXIMUM_AVAILABILITY": DataGuardAssociationProtectionModeAvailability, + "MAXIMUM_PERFORMANCE": DataGuardAssociationProtectionModePerformance, + "MAXIMUM_PROTECTION": DataGuardAssociationProtectionModeProtection, +} + +// GetDataGuardAssociationProtectionModeEnumValues Enumerates the set of values for DataGuardAssociationProtectionMode +func GetDataGuardAssociationProtectionModeEnumValues() []DataGuardAssociationProtectionModeEnum { + values := make([]DataGuardAssociationProtectionModeEnum, 0) + for _, v := range mappingDataGuardAssociationProtectionMode { + values = append(values, v) + } + return values +} + +// DataGuardAssociationRoleEnum Enum with underlying type: string +type DataGuardAssociationRoleEnum string + +// Set of constants representing the allowable values for DataGuardAssociationRole +const ( + DataGuardAssociationRolePrimary DataGuardAssociationRoleEnum = "PRIMARY" + DataGuardAssociationRoleStandby DataGuardAssociationRoleEnum = "STANDBY" + DataGuardAssociationRoleDisabledStandby DataGuardAssociationRoleEnum = "DISABLED_STANDBY" +) + +var mappingDataGuardAssociationRole = map[string]DataGuardAssociationRoleEnum{ + "PRIMARY": DataGuardAssociationRolePrimary, + "STANDBY": DataGuardAssociationRoleStandby, + "DISABLED_STANDBY": DataGuardAssociationRoleDisabledStandby, +} + +// GetDataGuardAssociationRoleEnumValues Enumerates the set of values for DataGuardAssociationRole +func GetDataGuardAssociationRoleEnumValues() []DataGuardAssociationRoleEnum { + values := make([]DataGuardAssociationRoleEnum, 0) + for _, v := range mappingDataGuardAssociationRole { + values = append(values, v) + } + return values +} + +// DataGuardAssociationTransportTypeEnum Enum with underlying type: string +type DataGuardAssociationTransportTypeEnum string + +// Set of constants representing the allowable values for DataGuardAssociationTransportType +const ( + DataGuardAssociationTransportTypeSync DataGuardAssociationTransportTypeEnum = "SYNC" + DataGuardAssociationTransportTypeAsync DataGuardAssociationTransportTypeEnum = "ASYNC" + DataGuardAssociationTransportTypeFastsync DataGuardAssociationTransportTypeEnum = "FASTSYNC" +) + +var mappingDataGuardAssociationTransportType = map[string]DataGuardAssociationTransportTypeEnum{ + "SYNC": DataGuardAssociationTransportTypeSync, + "ASYNC": DataGuardAssociationTransportTypeAsync, + "FASTSYNC": DataGuardAssociationTransportTypeFastsync, +} + +// GetDataGuardAssociationTransportTypeEnumValues Enumerates the set of values for DataGuardAssociationTransportType +func GetDataGuardAssociationTransportTypeEnumValues() []DataGuardAssociationTransportTypeEnum { + values := make([]DataGuardAssociationTransportTypeEnum, 0) + for _, v := range mappingDataGuardAssociationTransportType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/data_guard_association_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/data_guard_association_summary.go new file mode 100644 index 0000000000..ebfc69c621 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/data_guard_association_summary.go @@ -0,0 +1,211 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DataGuardAssociationSummary The properties that define a Data Guard association. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an +// administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +// For information about endpoints and signing API requests, see +// About the API (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm). For information about available SDKs and tools, see +// SDKS and Other Tools (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdks.htm). +type DataGuardAssociationSummary struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the reporting database. + DatabaseId *string `mandatory:"true" json:"databaseId"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the Data Guard association. + Id *string `mandatory:"true" json:"id"` + + // The current state of the Data Guard association. + LifecycleState DataGuardAssociationSummaryLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the DB System containing the associated + // peer database. + PeerDbSystemId *string `mandatory:"true" json:"peerDbSystemId"` + + // The role of the peer database in this Data Guard association. + PeerRole DataGuardAssociationSummaryPeerRoleEnum `mandatory:"true" json:"peerRole"` + + // The protection mode of this Data Guard association. For more information, see + // Oracle Data Guard Protection Modes (http://docs.oracle.com/database/122/SBYDB/oracle-data-guard-protection-modes.htm#SBYDB02000) + // in the Oracle Data Guard documentation. + ProtectionMode DataGuardAssociationSummaryProtectionModeEnum `mandatory:"true" json:"protectionMode"` + + // The role of the reporting database in this Data Guard association. + Role DataGuardAssociationSummaryRoleEnum `mandatory:"true" json:"role"` + + // The lag time between updates to the primary database and application of the redo data on the standby database, + // as computed by the reporting database. + // Example: `9 seconds` + ApplyLag *string `mandatory:"false" json:"applyLag"` + + // The rate at which redo logs are synced between the associated databases. + // Example: `180 Mb per second` + ApplyRate *string `mandatory:"false" json:"applyRate"` + + // Additional information about the current lifecycleState, if available. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the peer database's Data Guard association. + PeerDataGuardAssociationId *string `mandatory:"false" json:"peerDataGuardAssociationId"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the associated peer database. + PeerDatabaseId *string `mandatory:"false" json:"peerDatabaseId"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the database home containing the associated peer database. + PeerDbHomeId *string `mandatory:"false" json:"peerDbHomeId"` + + // The date and time the Data Guard Association was created. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The redo transport type used by this Data Guard association. For more information, see + // Redo Transport Services (http://docs.oracle.com/database/122/SBYDB/oracle-data-guard-redo-transport-services.htm#SBYDB00400) + // in the Oracle Data Guard documentation. + TransportType DataGuardAssociationSummaryTransportTypeEnum `mandatory:"false" json:"transportType,omitempty"` +} + +func (m DataGuardAssociationSummary) String() string { + return common.PointerString(m) +} + +// DataGuardAssociationSummaryLifecycleStateEnum Enum with underlying type: string +type DataGuardAssociationSummaryLifecycleStateEnum string + +// Set of constants representing the allowable values for DataGuardAssociationSummaryLifecycleState +const ( + DataGuardAssociationSummaryLifecycleStateProvisioning DataGuardAssociationSummaryLifecycleStateEnum = "PROVISIONING" + DataGuardAssociationSummaryLifecycleStateAvailable DataGuardAssociationSummaryLifecycleStateEnum = "AVAILABLE" + DataGuardAssociationSummaryLifecycleStateUpdating DataGuardAssociationSummaryLifecycleStateEnum = "UPDATING" + DataGuardAssociationSummaryLifecycleStateTerminating DataGuardAssociationSummaryLifecycleStateEnum = "TERMINATING" + DataGuardAssociationSummaryLifecycleStateTerminated DataGuardAssociationSummaryLifecycleStateEnum = "TERMINATED" + DataGuardAssociationSummaryLifecycleStateFailed DataGuardAssociationSummaryLifecycleStateEnum = "FAILED" +) + +var mappingDataGuardAssociationSummaryLifecycleState = map[string]DataGuardAssociationSummaryLifecycleStateEnum{ + "PROVISIONING": DataGuardAssociationSummaryLifecycleStateProvisioning, + "AVAILABLE": DataGuardAssociationSummaryLifecycleStateAvailable, + "UPDATING": DataGuardAssociationSummaryLifecycleStateUpdating, + "TERMINATING": DataGuardAssociationSummaryLifecycleStateTerminating, + "TERMINATED": DataGuardAssociationSummaryLifecycleStateTerminated, + "FAILED": DataGuardAssociationSummaryLifecycleStateFailed, +} + +// GetDataGuardAssociationSummaryLifecycleStateEnumValues Enumerates the set of values for DataGuardAssociationSummaryLifecycleState +func GetDataGuardAssociationSummaryLifecycleStateEnumValues() []DataGuardAssociationSummaryLifecycleStateEnum { + values := make([]DataGuardAssociationSummaryLifecycleStateEnum, 0) + for _, v := range mappingDataGuardAssociationSummaryLifecycleState { + values = append(values, v) + } + return values +} + +// DataGuardAssociationSummaryPeerRoleEnum Enum with underlying type: string +type DataGuardAssociationSummaryPeerRoleEnum string + +// Set of constants representing the allowable values for DataGuardAssociationSummaryPeerRole +const ( + DataGuardAssociationSummaryPeerRolePrimary DataGuardAssociationSummaryPeerRoleEnum = "PRIMARY" + DataGuardAssociationSummaryPeerRoleStandby DataGuardAssociationSummaryPeerRoleEnum = "STANDBY" + DataGuardAssociationSummaryPeerRoleDisabledStandby DataGuardAssociationSummaryPeerRoleEnum = "DISABLED_STANDBY" +) + +var mappingDataGuardAssociationSummaryPeerRole = map[string]DataGuardAssociationSummaryPeerRoleEnum{ + "PRIMARY": DataGuardAssociationSummaryPeerRolePrimary, + "STANDBY": DataGuardAssociationSummaryPeerRoleStandby, + "DISABLED_STANDBY": DataGuardAssociationSummaryPeerRoleDisabledStandby, +} + +// GetDataGuardAssociationSummaryPeerRoleEnumValues Enumerates the set of values for DataGuardAssociationSummaryPeerRole +func GetDataGuardAssociationSummaryPeerRoleEnumValues() []DataGuardAssociationSummaryPeerRoleEnum { + values := make([]DataGuardAssociationSummaryPeerRoleEnum, 0) + for _, v := range mappingDataGuardAssociationSummaryPeerRole { + values = append(values, v) + } + return values +} + +// DataGuardAssociationSummaryProtectionModeEnum Enum with underlying type: string +type DataGuardAssociationSummaryProtectionModeEnum string + +// Set of constants representing the allowable values for DataGuardAssociationSummaryProtectionMode +const ( + DataGuardAssociationSummaryProtectionModeAvailability DataGuardAssociationSummaryProtectionModeEnum = "MAXIMUM_AVAILABILITY" + DataGuardAssociationSummaryProtectionModePerformance DataGuardAssociationSummaryProtectionModeEnum = "MAXIMUM_PERFORMANCE" + DataGuardAssociationSummaryProtectionModeProtection DataGuardAssociationSummaryProtectionModeEnum = "MAXIMUM_PROTECTION" +) + +var mappingDataGuardAssociationSummaryProtectionMode = map[string]DataGuardAssociationSummaryProtectionModeEnum{ + "MAXIMUM_AVAILABILITY": DataGuardAssociationSummaryProtectionModeAvailability, + "MAXIMUM_PERFORMANCE": DataGuardAssociationSummaryProtectionModePerformance, + "MAXIMUM_PROTECTION": DataGuardAssociationSummaryProtectionModeProtection, +} + +// GetDataGuardAssociationSummaryProtectionModeEnumValues Enumerates the set of values for DataGuardAssociationSummaryProtectionMode +func GetDataGuardAssociationSummaryProtectionModeEnumValues() []DataGuardAssociationSummaryProtectionModeEnum { + values := make([]DataGuardAssociationSummaryProtectionModeEnum, 0) + for _, v := range mappingDataGuardAssociationSummaryProtectionMode { + values = append(values, v) + } + return values +} + +// DataGuardAssociationSummaryRoleEnum Enum with underlying type: string +type DataGuardAssociationSummaryRoleEnum string + +// Set of constants representing the allowable values for DataGuardAssociationSummaryRole +const ( + DataGuardAssociationSummaryRolePrimary DataGuardAssociationSummaryRoleEnum = "PRIMARY" + DataGuardAssociationSummaryRoleStandby DataGuardAssociationSummaryRoleEnum = "STANDBY" + DataGuardAssociationSummaryRoleDisabledStandby DataGuardAssociationSummaryRoleEnum = "DISABLED_STANDBY" +) + +var mappingDataGuardAssociationSummaryRole = map[string]DataGuardAssociationSummaryRoleEnum{ + "PRIMARY": DataGuardAssociationSummaryRolePrimary, + "STANDBY": DataGuardAssociationSummaryRoleStandby, + "DISABLED_STANDBY": DataGuardAssociationSummaryRoleDisabledStandby, +} + +// GetDataGuardAssociationSummaryRoleEnumValues Enumerates the set of values for DataGuardAssociationSummaryRole +func GetDataGuardAssociationSummaryRoleEnumValues() []DataGuardAssociationSummaryRoleEnum { + values := make([]DataGuardAssociationSummaryRoleEnum, 0) + for _, v := range mappingDataGuardAssociationSummaryRole { + values = append(values, v) + } + return values +} + +// DataGuardAssociationSummaryTransportTypeEnum Enum with underlying type: string +type DataGuardAssociationSummaryTransportTypeEnum string + +// Set of constants representing the allowable values for DataGuardAssociationSummaryTransportType +const ( + DataGuardAssociationSummaryTransportTypeSync DataGuardAssociationSummaryTransportTypeEnum = "SYNC" + DataGuardAssociationSummaryTransportTypeAsync DataGuardAssociationSummaryTransportTypeEnum = "ASYNC" + DataGuardAssociationSummaryTransportTypeFastsync DataGuardAssociationSummaryTransportTypeEnum = "FASTSYNC" +) + +var mappingDataGuardAssociationSummaryTransportType = map[string]DataGuardAssociationSummaryTransportTypeEnum{ + "SYNC": DataGuardAssociationSummaryTransportTypeSync, + "ASYNC": DataGuardAssociationSummaryTransportTypeAsync, + "FASTSYNC": DataGuardAssociationSummaryTransportTypeFastsync, +} + +// GetDataGuardAssociationSummaryTransportTypeEnumValues Enumerates the set of values for DataGuardAssociationSummaryTransportType +func GetDataGuardAssociationSummaryTransportTypeEnumValues() []DataGuardAssociationSummaryTransportTypeEnum { + values := make([]DataGuardAssociationSummaryTransportTypeEnum, 0) + for _, v := range mappingDataGuardAssociationSummaryTransportType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/database.go b/vendor/github.com/oracle/oci-go-sdk/database/database.go new file mode 100644 index 0000000000..be33ef1a88 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/database.go @@ -0,0 +1,95 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Database An Oracle database on a DB System. For more information, see Managing Oracle Databases (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Database struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The database name. + DbName *string `mandatory:"true" json:"dbName"` + + // A system-generated name for the database to ensure uniqueness within an Oracle Data Guard group (a primary database and its standby databases). The unique name cannot be changed. + DbUniqueName *string `mandatory:"true" json:"dbUniqueName"` + + // The OCID of the database. + Id *string `mandatory:"true" json:"id"` + + // The current state of the database. + LifecycleState DatabaseLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The character set for the database. + CharacterSet *string `mandatory:"false" json:"characterSet"` + + DbBackupConfig *DbBackupConfig `mandatory:"false" json:"dbBackupConfig"` + + // The OCID of the database home. + DbHomeId *string `mandatory:"false" json:"dbHomeId"` + + // Database workload type. + DbWorkload *string `mandatory:"false" json:"dbWorkload"` + + // Additional information about the current lifecycleState. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The national character set for the database. + NcharacterSet *string `mandatory:"false" json:"ncharacterSet"` + + // Pluggable database name. It must begin with an alphabetic character and can contain a maximum of eight alphanumeric characters. Special characters are not permitted. Pluggable database should not be same as database name. + PdbName *string `mandatory:"false" json:"pdbName"` + + // The date and time the database was created. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m Database) String() string { + return common.PointerString(m) +} + +// DatabaseLifecycleStateEnum Enum with underlying type: string +type DatabaseLifecycleStateEnum string + +// Set of constants representing the allowable values for DatabaseLifecycleState +const ( + DatabaseLifecycleStateProvisioning DatabaseLifecycleStateEnum = "PROVISIONING" + DatabaseLifecycleStateAvailable DatabaseLifecycleStateEnum = "AVAILABLE" + DatabaseLifecycleStateUpdating DatabaseLifecycleStateEnum = "UPDATING" + DatabaseLifecycleStateBackupInProgress DatabaseLifecycleStateEnum = "BACKUP_IN_PROGRESS" + DatabaseLifecycleStateTerminating DatabaseLifecycleStateEnum = "TERMINATING" + DatabaseLifecycleStateTerminated DatabaseLifecycleStateEnum = "TERMINATED" + DatabaseLifecycleStateRestoreFailed DatabaseLifecycleStateEnum = "RESTORE_FAILED" + DatabaseLifecycleStateFailed DatabaseLifecycleStateEnum = "FAILED" +) + +var mappingDatabaseLifecycleState = map[string]DatabaseLifecycleStateEnum{ + "PROVISIONING": DatabaseLifecycleStateProvisioning, + "AVAILABLE": DatabaseLifecycleStateAvailable, + "UPDATING": DatabaseLifecycleStateUpdating, + "BACKUP_IN_PROGRESS": DatabaseLifecycleStateBackupInProgress, + "TERMINATING": DatabaseLifecycleStateTerminating, + "TERMINATED": DatabaseLifecycleStateTerminated, + "RESTORE_FAILED": DatabaseLifecycleStateRestoreFailed, + "FAILED": DatabaseLifecycleStateFailed, +} + +// GetDatabaseLifecycleStateEnumValues Enumerates the set of values for DatabaseLifecycleState +func GetDatabaseLifecycleStateEnumValues() []DatabaseLifecycleStateEnum { + values := make([]DatabaseLifecycleStateEnum, 0) + for _, v := range mappingDatabaseLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/database_client.go b/vendor/github.com/oracle/oci-go-sdk/database/database_client.go new file mode 100644 index 0000000000..d666cc5f0a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/database_client.go @@ -0,0 +1,753 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +//DatabaseClient a client for Database +type DatabaseClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewDatabaseClientWithConfigurationProvider Creates a new default Database client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewDatabaseClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client DatabaseClient, err error) { + baseClient, err := common.NewClientWithConfig(configProvider) + if err != nil { + return + } + + client = DatabaseClient{BaseClient: baseClient} + client.BasePath = "20160918" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *DatabaseClient) SetRegion(region string) { + client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "database", region) +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *DatabaseClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.config = &configProvider + client.SetRegion(region) + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *DatabaseClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// CreateBackup Creates a new backup in the specified database based on the request parameters you provide. If you previously used RMAN or dbcli to configure backups and then you switch to using the Console or the API for backups, a new backup configuration is created and associated with your database. This means that you can no longer rely on your previously configured unmanaged backups to work. +func (client DatabaseClient) CreateBackup(ctx context.Context, request CreateBackupRequest) (response CreateBackupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/backups", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateDataGuardAssociation Creates a new Data Guard association. A Data Guard association represents the replication relationship between the +// specified database and a peer database. For more information, see Using Oracle Data Guard (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Tasks/usingdataguard.htm). +// All Oracle Cloud Infrastructure resources, including Data Guard associations, get an Oracle-assigned, unique ID +// called an Oracle Cloud Identifier (OCID). When you create a resource, you can find its OCID in the response. +// You can also retrieve a resource's OCID by using a List API operation on that resource type, or by viewing the +// resource in the Console. Fore more information, see +// Resource Identifiers (http://localhost:8000/Content/General/Concepts/identifiers.htm). +func (client DatabaseClient) CreateDataGuardAssociation(ctx context.Context, request CreateDataGuardAssociationRequest) (response CreateDataGuardAssociationResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/databases/{databaseId}/dataGuardAssociations", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateDbHome Creates a new DB Home in the specified DB System based on the request parameters you provide. +func (client DatabaseClient) CreateDbHome(ctx context.Context, request CreateDbHomeRequest) (response CreateDbHomeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/dbHomes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DbNodeAction Performs an action, such as one of the power actions (start, stop, softreset, or reset), on the specified DB Node. +// **start** - power on +// **stop** - power off +// **softreset** - ACPI shutdown and power on +// **reset** - power off and power on +// Note that the **stop** state has no effect on the resources you consume. +// Billing continues for DB Nodes that you stop, and related resources continue +// to apply against any relevant quotas. You must terminate the DB System +// (TerminateDbSystem) +// to remove its resources from billing and quotas. +func (client DatabaseClient) DbNodeAction(ctx context.Context, request DbNodeActionRequest) (response DbNodeActionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/dbNodes/{dbNodeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteBackup Deletes a full backup. You cannot delete automatic backups using this API. +func (client DatabaseClient) DeleteBackup(ctx context.Context, request DeleteBackupRequest) (response DeleteBackupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/backups/{backupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteDbHome Deletes a DB Home. The DB Home and its database data are local to the DB System and will be lost when it is deleted. Oracle recommends that you back up any data in the DB System prior to deleting it. +func (client DatabaseClient) DeleteDbHome(ctx context.Context, request DeleteDbHomeRequest) (response DeleteDbHomeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/dbHomes/{dbHomeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// FailoverDataGuardAssociation Performs a failover to transition the standby database identified by the `databaseId` parameter into the +// specified Data Guard association's primary role after the existing primary database fails or becomes unreachable. +// A failover might result in data loss depending on the protection mode in effect at the time of the primary +// database failure. +func (client DatabaseClient) FailoverDataGuardAssociation(ctx context.Context, request FailoverDataGuardAssociationRequest) (response FailoverDataGuardAssociationResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/databases/{databaseId}/dataGuardAssociations/{dataGuardAssociationId}/actions/failover", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetBackup Gets information about the specified backup. +func (client DatabaseClient) GetBackup(ctx context.Context, request GetBackupRequest) (response GetBackupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/backups/{backupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDataGuardAssociation Gets the specified Data Guard association's configuration information. +func (client DatabaseClient) GetDataGuardAssociation(ctx context.Context, request GetDataGuardAssociationRequest) (response GetDataGuardAssociationResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/databases/{databaseId}/dataGuardAssociations/{dataGuardAssociationId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDatabase Gets information about a specific database. +func (client DatabaseClient) GetDatabase(ctx context.Context, request GetDatabaseRequest) (response GetDatabaseResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/databases/{databaseId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDbHome Gets information about the specified database home. +func (client DatabaseClient) GetDbHome(ctx context.Context, request GetDbHomeRequest) (response GetDbHomeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbHomes/{dbHomeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDbHomePatch Gets information about a specified patch package. +func (client DatabaseClient) GetDbHomePatch(ctx context.Context, request GetDbHomePatchRequest) (response GetDbHomePatchResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbHomes/{dbHomeId}/patches/{patchId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDbHomePatchHistoryEntry Gets the patch history details for the specified patchHistoryEntryId +func (client DatabaseClient) GetDbHomePatchHistoryEntry(ctx context.Context, request GetDbHomePatchHistoryEntryRequest) (response GetDbHomePatchHistoryEntryResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbHomes/{dbHomeId}/patchHistoryEntries/{patchHistoryEntryId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDbNode Gets information about the specified database node. +func (client DatabaseClient) GetDbNode(ctx context.Context, request GetDbNodeRequest) (response GetDbNodeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbNodes/{dbNodeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDbSystem Gets information about the specified DB System. +func (client DatabaseClient) GetDbSystem(ctx context.Context, request GetDbSystemRequest) (response GetDbSystemResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbSystems/{dbSystemId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDbSystemPatch Gets information about a specified patch package. +func (client DatabaseClient) GetDbSystemPatch(ctx context.Context, request GetDbSystemPatchRequest) (response GetDbSystemPatchResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbSystems/{dbSystemId}/patches/{patchId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetDbSystemPatchHistoryEntry Gets the patch history details for the specified patchHistoryEntryId. +func (client DatabaseClient) GetDbSystemPatchHistoryEntry(ctx context.Context, request GetDbSystemPatchHistoryEntryRequest) (response GetDbSystemPatchHistoryEntryResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbSystems/{dbSystemId}/patchHistoryEntries/{patchHistoryEntryId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// LaunchDbSystem Launches a new DB System in the specified compartment and Availability Domain. You'll specify a single Oracle +// Database Edition that applies to all the databases on that DB System. The selected edition cannot be changed. +// An initial database is created on the DB System based on the request parameters you provide and some default +// options. For more information, +// see Default Options for the Initial Database (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Tasks/launchingDB.htm#Default_Options_for_the_Initial_Database). +// The DB System will include a command line interface (CLI) that you can use to create additional databases and +// manage existing databases. For more information, see the +// Oracle Database CLI Reference (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/References/odacli.htm#Oracle_Database_CLI_Reference). +func (client DatabaseClient) LaunchDbSystem(ctx context.Context, request LaunchDbSystemRequest) (response LaunchDbSystemResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/dbSystems", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListBackups Gets a list of backups based on the databaseId or compartmentId specified. Either one of the query parameters must be provided. +func (client DatabaseClient) ListBackups(ctx context.Context, request ListBackupsRequest) (response ListBackupsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/backups", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDataGuardAssociations Lists all Data Guard associations for the specified database. +func (client DatabaseClient) ListDataGuardAssociations(ctx context.Context, request ListDataGuardAssociationsRequest) (response ListDataGuardAssociationsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/databases/{databaseId}/dataGuardAssociations", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDatabases Gets a list of the databases in the specified database home. +func (client DatabaseClient) ListDatabases(ctx context.Context, request ListDatabasesRequest) (response ListDatabasesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/databases", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDbHomePatchHistoryEntries Gets history of the actions taken for patches for the specified database home. +func (client DatabaseClient) ListDbHomePatchHistoryEntries(ctx context.Context, request ListDbHomePatchHistoryEntriesRequest) (response ListDbHomePatchHistoryEntriesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbHomes/{dbHomeId}/patchHistoryEntries", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDbHomePatches Lists patches applicable to the requested database home. +func (client DatabaseClient) ListDbHomePatches(ctx context.Context, request ListDbHomePatchesRequest) (response ListDbHomePatchesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbHomes/{dbHomeId}/patches", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDbHomes Gets a list of database homes in the specified DB System and compartment. A database home is a directory where Oracle database software is installed. +func (client DatabaseClient) ListDbHomes(ctx context.Context, request ListDbHomesRequest) (response ListDbHomesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbHomes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDbNodes Gets a list of database nodes in the specified DB System and compartment. A database node is a server running database software. +func (client DatabaseClient) ListDbNodes(ctx context.Context, request ListDbNodesRequest) (response ListDbNodesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbNodes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDbSystemPatchHistoryEntries Gets the history of the patch actions performed on the specified DB System. +func (client DatabaseClient) ListDbSystemPatchHistoryEntries(ctx context.Context, request ListDbSystemPatchHistoryEntriesRequest) (response ListDbSystemPatchHistoryEntriesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbSystems/{dbSystemId}/patchHistoryEntries", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDbSystemPatches Lists the patches applicable to the requested DB System. +func (client DatabaseClient) ListDbSystemPatches(ctx context.Context, request ListDbSystemPatchesRequest) (response ListDbSystemPatchesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbSystems/{dbSystemId}/patches", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDbSystemShapes Gets a list of the shapes that can be used to launch a new DB System. The shape determines resources to allocate to the DB system - CPU cores and memory for VM shapes; CPU cores, memory and storage for non-VM (or bare metal) shapes. +func (client DatabaseClient) ListDbSystemShapes(ctx context.Context, request ListDbSystemShapesRequest) (response ListDbSystemShapesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbSystemShapes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDbSystems Gets a list of the DB Systems in the specified compartment. +// +func (client DatabaseClient) ListDbSystems(ctx context.Context, request ListDbSystemsRequest) (response ListDbSystemsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbSystems", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListDbVersions Gets a list of supported Oracle database versions. +func (client DatabaseClient) ListDbVersions(ctx context.Context, request ListDbVersionsRequest) (response ListDbVersionsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/dbVersions", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ReinstateDataGuardAssociation Reinstates the database identified by the `databaseId` parameter into the standby role in a Data Guard association. +func (client DatabaseClient) ReinstateDataGuardAssociation(ctx context.Context, request ReinstateDataGuardAssociationRequest) (response ReinstateDataGuardAssociationResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/databases/{databaseId}/dataGuardAssociations/{dataGuardAssociationId}/actions/reinstate", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// RestoreDatabase Restore a Database based on the request parameters you provide. +func (client DatabaseClient) RestoreDatabase(ctx context.Context, request RestoreDatabaseRequest) (response RestoreDatabaseResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/databases/{databaseId}/actions/restore", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// SwitchoverDataGuardAssociation Performs a switchover to transition the primary database of a Data Guard association into a standby role. The +// standby database associated with the `dataGuardAssociationId` assumes the primary database role. +// A switchover guarantees no data loss. +func (client DatabaseClient) SwitchoverDataGuardAssociation(ctx context.Context, request SwitchoverDataGuardAssociationRequest) (response SwitchoverDataGuardAssociationResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/databases/{databaseId}/dataGuardAssociations/{dataGuardAssociationId}/actions/switchover", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// TerminateDbSystem Terminates a DB System and permanently deletes it and any databases running on it, and any storage volumes attached to it. The database data is local to the DB System and will be lost when the system is terminated. Oracle recommends that you back up any data in the DB System prior to terminating it. +func (client DatabaseClient) TerminateDbSystem(ctx context.Context, request TerminateDbSystemRequest) (response TerminateDbSystemResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/dbSystems/{dbSystemId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateDatabase Update a Database based on the request parameters you provide. +func (client DatabaseClient) UpdateDatabase(ctx context.Context, request UpdateDatabaseRequest) (response UpdateDatabaseResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/databases/{databaseId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateDbHome Patches the specified dbHome. +func (client DatabaseClient) UpdateDbHome(ctx context.Context, request UpdateDbHomeRequest) (response UpdateDbHomeResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/dbHomes/{dbHomeId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateDbSystem Updates the properties of a DB System, such as the CPU core count. +func (client DatabaseClient) UpdateDbSystem(ctx context.Context, request UpdateDbSystemRequest) (response UpdateDbSystemResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/dbSystems/{dbSystemId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/database_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/database_summary.go new file mode 100644 index 0000000000..6191d850fd --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/database_summary.go @@ -0,0 +1,95 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DatabaseSummary An Oracle database on a DB System. For more information, see Managing Oracle Databases (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type DatabaseSummary struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The database name. + DbName *string `mandatory:"true" json:"dbName"` + + // A system-generated name for the database to ensure uniqueness within an Oracle Data Guard group (a primary database and its standby databases). The unique name cannot be changed. + DbUniqueName *string `mandatory:"true" json:"dbUniqueName"` + + // The OCID of the database. + Id *string `mandatory:"true" json:"id"` + + // The current state of the database. + LifecycleState DatabaseSummaryLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The character set for the database. + CharacterSet *string `mandatory:"false" json:"characterSet"` + + DbBackupConfig *DbBackupConfig `mandatory:"false" json:"dbBackupConfig"` + + // The OCID of the database home. + DbHomeId *string `mandatory:"false" json:"dbHomeId"` + + // Database workload type. + DbWorkload *string `mandatory:"false" json:"dbWorkload"` + + // Additional information about the current lifecycleState. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The national character set for the database. + NcharacterSet *string `mandatory:"false" json:"ncharacterSet"` + + // Pluggable database name. It must begin with an alphabetic character and can contain a maximum of eight alphanumeric characters. Special characters are not permitted. Pluggable database should not be same as database name. + PdbName *string `mandatory:"false" json:"pdbName"` + + // The date and time the database was created. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m DatabaseSummary) String() string { + return common.PointerString(m) +} + +// DatabaseSummaryLifecycleStateEnum Enum with underlying type: string +type DatabaseSummaryLifecycleStateEnum string + +// Set of constants representing the allowable values for DatabaseSummaryLifecycleState +const ( + DatabaseSummaryLifecycleStateProvisioning DatabaseSummaryLifecycleStateEnum = "PROVISIONING" + DatabaseSummaryLifecycleStateAvailable DatabaseSummaryLifecycleStateEnum = "AVAILABLE" + DatabaseSummaryLifecycleStateUpdating DatabaseSummaryLifecycleStateEnum = "UPDATING" + DatabaseSummaryLifecycleStateBackupInProgress DatabaseSummaryLifecycleStateEnum = "BACKUP_IN_PROGRESS" + DatabaseSummaryLifecycleStateTerminating DatabaseSummaryLifecycleStateEnum = "TERMINATING" + DatabaseSummaryLifecycleStateTerminated DatabaseSummaryLifecycleStateEnum = "TERMINATED" + DatabaseSummaryLifecycleStateRestoreFailed DatabaseSummaryLifecycleStateEnum = "RESTORE_FAILED" + DatabaseSummaryLifecycleStateFailed DatabaseSummaryLifecycleStateEnum = "FAILED" +) + +var mappingDatabaseSummaryLifecycleState = map[string]DatabaseSummaryLifecycleStateEnum{ + "PROVISIONING": DatabaseSummaryLifecycleStateProvisioning, + "AVAILABLE": DatabaseSummaryLifecycleStateAvailable, + "UPDATING": DatabaseSummaryLifecycleStateUpdating, + "BACKUP_IN_PROGRESS": DatabaseSummaryLifecycleStateBackupInProgress, + "TERMINATING": DatabaseSummaryLifecycleStateTerminating, + "TERMINATED": DatabaseSummaryLifecycleStateTerminated, + "RESTORE_FAILED": DatabaseSummaryLifecycleStateRestoreFailed, + "FAILED": DatabaseSummaryLifecycleStateFailed, +} + +// GetDatabaseSummaryLifecycleStateEnumValues Enumerates the set of values for DatabaseSummaryLifecycleState +func GetDatabaseSummaryLifecycleStateEnumValues() []DatabaseSummaryLifecycleStateEnum { + values := make([]DatabaseSummaryLifecycleStateEnum, 0) + for _, v := range mappingDatabaseSummaryLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_backup_config.go b/vendor/github.com/oracle/oci-go-sdk/database/db_backup_config.go new file mode 100644 index 0000000000..193a4a81c1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_backup_config.go @@ -0,0 +1,25 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DbBackupConfig Backup Options +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type DbBackupConfig struct { + + // If set to true, configures automatic backups. If you previously used RMAN or dbcli to configure backups and then you switch to using the Console or the API for backups, a new backup configuration is created and associated with your database. This means that you can no longer rely on your previously configured unmanaged backups to work. + AutoBackupEnabled *bool `mandatory:"false" json:"autoBackupEnabled"` +} + +func (m DbBackupConfig) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_home.go b/vendor/github.com/oracle/oci-go-sdk/database/db_home.go new file mode 100644 index 0000000000..dc768b7cc3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_home.go @@ -0,0 +1,82 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DbHome A directory where Oracle database software is installed. Each DB System can have multiple database homes, +// and each database home can have multiple databases within it. All the databases within a single database home +// must be the same database version, but different database homes can run different versions. For more information, +// see Managing Oracle Databases (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an +// administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type DbHome struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The Oracle database version. + DbVersion *string `mandatory:"true" json:"dbVersion"` + + // The user-provided name for the database home. It does not need to be unique. + DisplayName *string `mandatory:"true" json:"displayName"` + + // The OCID of the database home. + Id *string `mandatory:"true" json:"id"` + + // The current state of the database home. + LifecycleState DbHomeLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID of the DB System. + DbSystemId *string `mandatory:"false" json:"dbSystemId"` + + // The OCID of the last patch history. This is updated as soon as a patch operation is started. + LastPatchHistoryEntryId *string `mandatory:"false" json:"lastPatchHistoryEntryId"` + + // The date and time the database home was created. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m DbHome) String() string { + return common.PointerString(m) +} + +// DbHomeLifecycleStateEnum Enum with underlying type: string +type DbHomeLifecycleStateEnum string + +// Set of constants representing the allowable values for DbHomeLifecycleState +const ( + DbHomeLifecycleStateProvisioning DbHomeLifecycleStateEnum = "PROVISIONING" + DbHomeLifecycleStateAvailable DbHomeLifecycleStateEnum = "AVAILABLE" + DbHomeLifecycleStateUpdating DbHomeLifecycleStateEnum = "UPDATING" + DbHomeLifecycleStateTerminating DbHomeLifecycleStateEnum = "TERMINATING" + DbHomeLifecycleStateTerminated DbHomeLifecycleStateEnum = "TERMINATED" + DbHomeLifecycleStateFailed DbHomeLifecycleStateEnum = "FAILED" +) + +var mappingDbHomeLifecycleState = map[string]DbHomeLifecycleStateEnum{ + "PROVISIONING": DbHomeLifecycleStateProvisioning, + "AVAILABLE": DbHomeLifecycleStateAvailable, + "UPDATING": DbHomeLifecycleStateUpdating, + "TERMINATING": DbHomeLifecycleStateTerminating, + "TERMINATED": DbHomeLifecycleStateTerminated, + "FAILED": DbHomeLifecycleStateFailed, +} + +// GetDbHomeLifecycleStateEnumValues Enumerates the set of values for DbHomeLifecycleState +func GetDbHomeLifecycleStateEnumValues() []DbHomeLifecycleStateEnum { + values := make([]DbHomeLifecycleStateEnum, 0) + for _, v := range mappingDbHomeLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_home_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/db_home_summary.go new file mode 100644 index 0000000000..b71dec8368 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_home_summary.go @@ -0,0 +1,82 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DbHomeSummary A directory where Oracle database software is installed. Each DB System can have multiple database homes, +// and each database home can have multiple databases within it. All the databases within a single database home +// must be the same database version, but different database homes can run different versions. For more information, +// see Managing Oracle Databases (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an +// administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type DbHomeSummary struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The Oracle database version. + DbVersion *string `mandatory:"true" json:"dbVersion"` + + // The user-provided name for the database home. It does not need to be unique. + DisplayName *string `mandatory:"true" json:"displayName"` + + // The OCID of the database home. + Id *string `mandatory:"true" json:"id"` + + // The current state of the database home. + LifecycleState DbHomeSummaryLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID of the DB System. + DbSystemId *string `mandatory:"false" json:"dbSystemId"` + + // The OCID of the last patch history. This is updated as soon as a patch operation is started. + LastPatchHistoryEntryId *string `mandatory:"false" json:"lastPatchHistoryEntryId"` + + // The date and time the database home was created. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m DbHomeSummary) String() string { + return common.PointerString(m) +} + +// DbHomeSummaryLifecycleStateEnum Enum with underlying type: string +type DbHomeSummaryLifecycleStateEnum string + +// Set of constants representing the allowable values for DbHomeSummaryLifecycleState +const ( + DbHomeSummaryLifecycleStateProvisioning DbHomeSummaryLifecycleStateEnum = "PROVISIONING" + DbHomeSummaryLifecycleStateAvailable DbHomeSummaryLifecycleStateEnum = "AVAILABLE" + DbHomeSummaryLifecycleStateUpdating DbHomeSummaryLifecycleStateEnum = "UPDATING" + DbHomeSummaryLifecycleStateTerminating DbHomeSummaryLifecycleStateEnum = "TERMINATING" + DbHomeSummaryLifecycleStateTerminated DbHomeSummaryLifecycleStateEnum = "TERMINATED" + DbHomeSummaryLifecycleStateFailed DbHomeSummaryLifecycleStateEnum = "FAILED" +) + +var mappingDbHomeSummaryLifecycleState = map[string]DbHomeSummaryLifecycleStateEnum{ + "PROVISIONING": DbHomeSummaryLifecycleStateProvisioning, + "AVAILABLE": DbHomeSummaryLifecycleStateAvailable, + "UPDATING": DbHomeSummaryLifecycleStateUpdating, + "TERMINATING": DbHomeSummaryLifecycleStateTerminating, + "TERMINATED": DbHomeSummaryLifecycleStateTerminated, + "FAILED": DbHomeSummaryLifecycleStateFailed, +} + +// GetDbHomeSummaryLifecycleStateEnumValues Enumerates the set of values for DbHomeSummaryLifecycleState +func GetDbHomeSummaryLifecycleStateEnumValues() []DbHomeSummaryLifecycleStateEnum { + values := make([]DbHomeSummaryLifecycleStateEnum, 0) + for _, v := range mappingDbHomeSummaryLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_node.go b/vendor/github.com/oracle/oci-go-sdk/database/db_node.go new file mode 100644 index 0000000000..3e052d092e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_node.go @@ -0,0 +1,83 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DbNode A server where Oracle database software is running. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type DbNode struct { + + // The OCID of the DB System. + DbSystemId *string `mandatory:"true" json:"dbSystemId"` + + // The OCID of the DB Node. + Id *string `mandatory:"true" json:"id"` + + // The current state of the database node. + LifecycleState DbNodeLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The date and time that the DB Node was created. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The OCID of the VNIC. + VnicId *string `mandatory:"true" json:"vnicId"` + + // The OCID of the backup VNIC. + BackupVnicId *string `mandatory:"false" json:"backupVnicId"` + + // The host name for the DB Node. + Hostname *string `mandatory:"false" json:"hostname"` + + // Storage size, in GBs, of the software volume that is allocated to the DB system. This is applicable only for VM-based DBs. + SoftwareStorageSizeInGB *int `mandatory:"false" json:"softwareStorageSizeInGB"` +} + +func (m DbNode) String() string { + return common.PointerString(m) +} + +// DbNodeLifecycleStateEnum Enum with underlying type: string +type DbNodeLifecycleStateEnum string + +// Set of constants representing the allowable values for DbNodeLifecycleState +const ( + DbNodeLifecycleStateProvisioning DbNodeLifecycleStateEnum = "PROVISIONING" + DbNodeLifecycleStateAvailable DbNodeLifecycleStateEnum = "AVAILABLE" + DbNodeLifecycleStateUpdating DbNodeLifecycleStateEnum = "UPDATING" + DbNodeLifecycleStateStopping DbNodeLifecycleStateEnum = "STOPPING" + DbNodeLifecycleStateStopped DbNodeLifecycleStateEnum = "STOPPED" + DbNodeLifecycleStateStarting DbNodeLifecycleStateEnum = "STARTING" + DbNodeLifecycleStateTerminating DbNodeLifecycleStateEnum = "TERMINATING" + DbNodeLifecycleStateTerminated DbNodeLifecycleStateEnum = "TERMINATED" + DbNodeLifecycleStateFailed DbNodeLifecycleStateEnum = "FAILED" +) + +var mappingDbNodeLifecycleState = map[string]DbNodeLifecycleStateEnum{ + "PROVISIONING": DbNodeLifecycleStateProvisioning, + "AVAILABLE": DbNodeLifecycleStateAvailable, + "UPDATING": DbNodeLifecycleStateUpdating, + "STOPPING": DbNodeLifecycleStateStopping, + "STOPPED": DbNodeLifecycleStateStopped, + "STARTING": DbNodeLifecycleStateStarting, + "TERMINATING": DbNodeLifecycleStateTerminating, + "TERMINATED": DbNodeLifecycleStateTerminated, + "FAILED": DbNodeLifecycleStateFailed, +} + +// GetDbNodeLifecycleStateEnumValues Enumerates the set of values for DbNodeLifecycleState +func GetDbNodeLifecycleStateEnumValues() []DbNodeLifecycleStateEnum { + values := make([]DbNodeLifecycleStateEnum, 0) + for _, v := range mappingDbNodeLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_node_action_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/db_node_action_request_response.go new file mode 100644 index 0000000000..208e504897 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_node_action_request_response.go @@ -0,0 +1,83 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DbNodeActionRequest wrapper for the DbNodeAction operation +type DbNodeActionRequest struct { + + // The database node OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbNodeId *string `mandatory:"true" contributesTo:"path" name:"dbNodeId"` + + // The action to perform on the DB Node. + Action DbNodeActionActionEnum `mandatory:"true" contributesTo:"query" name:"action" omitEmpty:"true"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DbNodeActionRequest) String() string { + return common.PointerString(request) +} + +// DbNodeActionResponse wrapper for the DbNodeAction operation +type DbNodeActionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DbNode instance + DbNode `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DbNodeActionResponse) String() string { + return common.PointerString(response) +} + +// DbNodeActionActionEnum Enum with underlying type: string +type DbNodeActionActionEnum string + +// Set of constants representing the allowable values for DbNodeActionAction +const ( + DbNodeActionActionStop DbNodeActionActionEnum = "STOP" + DbNodeActionActionStart DbNodeActionActionEnum = "START" + DbNodeActionActionSoftreset DbNodeActionActionEnum = "SOFTRESET" + DbNodeActionActionReset DbNodeActionActionEnum = "RESET" +) + +var mappingDbNodeActionAction = map[string]DbNodeActionActionEnum{ + "STOP": DbNodeActionActionStop, + "START": DbNodeActionActionStart, + "SOFTRESET": DbNodeActionActionSoftreset, + "RESET": DbNodeActionActionReset, +} + +// GetDbNodeActionActionEnumValues Enumerates the set of values for DbNodeActionAction +func GetDbNodeActionActionEnumValues() []DbNodeActionActionEnum { + values := make([]DbNodeActionActionEnum, 0) + for _, v := range mappingDbNodeActionAction { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_node_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/db_node_summary.go new file mode 100644 index 0000000000..47e4ea0dc2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_node_summary.go @@ -0,0 +1,83 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DbNodeSummary A server where Oracle database software is running. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type DbNodeSummary struct { + + // The OCID of the DB System. + DbSystemId *string `mandatory:"true" json:"dbSystemId"` + + // The OCID of the DB Node. + Id *string `mandatory:"true" json:"id"` + + // The current state of the database node. + LifecycleState DbNodeSummaryLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The date and time that the DB Node was created. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The OCID of the VNIC. + VnicId *string `mandatory:"true" json:"vnicId"` + + // The OCID of the backup VNIC. + BackupVnicId *string `mandatory:"false" json:"backupVnicId"` + + // The host name for the DB Node. + Hostname *string `mandatory:"false" json:"hostname"` + + // Storage size, in GBs, of the software volume that is allocated to the DB system. This is applicable only for VM-based DBs. + SoftwareStorageSizeInGB *int `mandatory:"false" json:"softwareStorageSizeInGB"` +} + +func (m DbNodeSummary) String() string { + return common.PointerString(m) +} + +// DbNodeSummaryLifecycleStateEnum Enum with underlying type: string +type DbNodeSummaryLifecycleStateEnum string + +// Set of constants representing the allowable values for DbNodeSummaryLifecycleState +const ( + DbNodeSummaryLifecycleStateProvisioning DbNodeSummaryLifecycleStateEnum = "PROVISIONING" + DbNodeSummaryLifecycleStateAvailable DbNodeSummaryLifecycleStateEnum = "AVAILABLE" + DbNodeSummaryLifecycleStateUpdating DbNodeSummaryLifecycleStateEnum = "UPDATING" + DbNodeSummaryLifecycleStateStopping DbNodeSummaryLifecycleStateEnum = "STOPPING" + DbNodeSummaryLifecycleStateStopped DbNodeSummaryLifecycleStateEnum = "STOPPED" + DbNodeSummaryLifecycleStateStarting DbNodeSummaryLifecycleStateEnum = "STARTING" + DbNodeSummaryLifecycleStateTerminating DbNodeSummaryLifecycleStateEnum = "TERMINATING" + DbNodeSummaryLifecycleStateTerminated DbNodeSummaryLifecycleStateEnum = "TERMINATED" + DbNodeSummaryLifecycleStateFailed DbNodeSummaryLifecycleStateEnum = "FAILED" +) + +var mappingDbNodeSummaryLifecycleState = map[string]DbNodeSummaryLifecycleStateEnum{ + "PROVISIONING": DbNodeSummaryLifecycleStateProvisioning, + "AVAILABLE": DbNodeSummaryLifecycleStateAvailable, + "UPDATING": DbNodeSummaryLifecycleStateUpdating, + "STOPPING": DbNodeSummaryLifecycleStateStopping, + "STOPPED": DbNodeSummaryLifecycleStateStopped, + "STARTING": DbNodeSummaryLifecycleStateStarting, + "TERMINATING": DbNodeSummaryLifecycleStateTerminating, + "TERMINATED": DbNodeSummaryLifecycleStateTerminated, + "FAILED": DbNodeSummaryLifecycleStateFailed, +} + +// GetDbNodeSummaryLifecycleStateEnumValues Enumerates the set of values for DbNodeSummaryLifecycleState +func GetDbNodeSummaryLifecycleStateEnumValues() []DbNodeSummaryLifecycleStateEnum { + values := make([]DbNodeSummaryLifecycleStateEnum, 0) + for _, v := range mappingDbNodeSummaryLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_system.go b/vendor/github.com/oracle/oci-go-sdk/database/db_system.go new file mode 100644 index 0000000000..04085ad176 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_system.go @@ -0,0 +1,236 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DbSystem The Database Service supports several types of DB Systems, ranging in size, price, and performance. For details about each type of system, see: +// - Exadata DB Systems (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/exaoverview.htm) +// - Bare Metal or VM DB Systems (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm) +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +// +// For information about access control and compartments, see +// Overview of the Identity Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// For information about Availability Domains, see +// Regions and Availability Domains (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). +// To get a list of Availability Domains, use the `ListAvailabilityDomains` operation +// in the Identity Service API. +type DbSystem struct { + + // The name of the Availability Domain that the DB System is located in. + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The number of CPU cores enabled on the DB System. + CpuCoreCount *int `mandatory:"true" json:"cpuCoreCount"` + + // The Oracle Database Edition that applies to all the databases on the DB System. + DatabaseEdition DbSystemDatabaseEditionEnum `mandatory:"true" json:"databaseEdition"` + + // The user-friendly name for the DB System. It does not have to be unique. + DisplayName *string `mandatory:"true" json:"displayName"` + + // The domain name for the DB System. + Domain *string `mandatory:"true" json:"domain"` + + // The host name for the DB Node. + Hostname *string `mandatory:"true" json:"hostname"` + + // The OCID of the DB System. + Id *string `mandatory:"true" json:"id"` + + // The current state of the DB System. + LifecycleState DbSystemLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The shape of the DB System. The shape determines resources to allocate to the DB system - CPU cores and memory for VM shapes; CPU cores, memory and storage for non-VM (or bare metal) shapes. + Shape *string `mandatory:"true" json:"shape"` + + // The public key portion of one or more key pairs used for SSH access to the DB System. + SshPublicKeys []string `mandatory:"true" json:"sshPublicKeys"` + + // The OCID of the subnet the DB System is associated with. + // **Subnet Restrictions:** + // - For single node and 2-node (RAC) DB Systems, do not use a subnet that overlaps with 192.168.16.16/28 + // - For Exadata and VM-based RAC DB Systems, do not use a subnet that overlaps with 192.168.128.0/20 + // These subnets are used by the Oracle Clusterware private interconnect on the database instance. + // Specifying an overlapping subnet will cause the private interconnect to malfunction. + // This restriction applies to both the client subnet and backup subnet. + SubnetId *string `mandatory:"true" json:"subnetId"` + + // The OCID of the backup network subnet the DB System is associated with. Applicable only to Exadata. + // **Subnet Restriction:** See above subnetId's 'Subnet Restriction'. + // to malfunction. + BackupSubnetId *string `mandatory:"false" json:"backupSubnetId"` + + // Cluster name for Exadata and 2-node RAC DB Systems. The cluster name must begin with an an alphabetic character, and may contain hyphens (-). Underscores (_) are not permitted. The cluster name can be no longer than 11 characters and is not case sensitive. + ClusterName *string `mandatory:"false" json:"clusterName"` + + // The percentage assigned to DATA storage (user data and database files). + // The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). Accepted values are 40 and 80. + DataStoragePercentage *int `mandatory:"false" json:"dataStoragePercentage"` + + // Data storage size, in GBs, that is currently available to the DB system. This is applicable only for VM-based DBs. + DataStorageSizeInGBs *int `mandatory:"false" json:"dataStorageSizeInGBs"` + + // The type of redundancy configured for the DB System. + // Normal is 2-way redundancy. + // High is 3-way redundancy. + DiskRedundancy DbSystemDiskRedundancyEnum `mandatory:"false" json:"diskRedundancy,omitempty"` + + // The OCID of the last patch history. This is updated as soon as a patch operation is started. + LastPatchHistoryEntryId *string `mandatory:"false" json:"lastPatchHistoryEntryId"` + + // The Oracle license model that applies to all the databases on the DB System. The default is LICENSE_INCLUDED. + LicenseModel DbSystemLicenseModelEnum `mandatory:"false" json:"licenseModel,omitempty"` + + // Additional information about the current lifecycleState. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The port number configured for the listener on the DB System. + ListenerPort *int `mandatory:"false" json:"listenerPort"` + + // Number of nodes in this DB system. For RAC DBs, this will be greater than 1. + NodeCount *int `mandatory:"false" json:"nodeCount"` + + // RECO/REDO storage size, in GBs, that is currently allocated to the DB system. This is applicable only for VM-based DBs. + RecoStorageSizeInGB *int `mandatory:"false" json:"recoStorageSizeInGB"` + + // The OCID of the DNS record for the SCAN IP addresses that are associated with the DB System. + ScanDnsRecordId *string `mandatory:"false" json:"scanDnsRecordId"` + + // The OCID of the Single Client Access Name (SCAN) IP addresses associated with the DB System. + // SCAN IP addresses are typically used for load balancing and are not assigned to any interface. + // Clusterware directs the requests to the appropriate nodes in the cluster. + // - For a single-node DB System, this list is empty. + ScanIpIds []string `mandatory:"false" json:"scanIpIds"` + + // The date and time the DB System was created. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The version of the DB System. + Version *string `mandatory:"false" json:"version"` + + // The OCID of the virtual IP (VIP) addresses associated with the DB System. + // The Cluster Ready Services (CRS) creates and maintains one VIP address for each node in the DB System to + // enable failover. If one node fails, the VIP is reassigned to another active node in the cluster. + // - For a single-node DB System, this list is empty. + VipIds []string `mandatory:"false" json:"vipIds"` +} + +func (m DbSystem) String() string { + return common.PointerString(m) +} + +// DbSystemDatabaseEditionEnum Enum with underlying type: string +type DbSystemDatabaseEditionEnum string + +// Set of constants representing the allowable values for DbSystemDatabaseEdition +const ( + DbSystemDatabaseEditionStandardEdition DbSystemDatabaseEditionEnum = "STANDARD_EDITION" + DbSystemDatabaseEditionEnterpriseEdition DbSystemDatabaseEditionEnum = "ENTERPRISE_EDITION" + DbSystemDatabaseEditionEnterpriseEditionExtremePerformance DbSystemDatabaseEditionEnum = "ENTERPRISE_EDITION_EXTREME_PERFORMANCE" + DbSystemDatabaseEditionEnterpriseEditionHighPerformance DbSystemDatabaseEditionEnum = "ENTERPRISE_EDITION_HIGH_PERFORMANCE" +) + +var mappingDbSystemDatabaseEdition = map[string]DbSystemDatabaseEditionEnum{ + "STANDARD_EDITION": DbSystemDatabaseEditionStandardEdition, + "ENTERPRISE_EDITION": DbSystemDatabaseEditionEnterpriseEdition, + "ENTERPRISE_EDITION_EXTREME_PERFORMANCE": DbSystemDatabaseEditionEnterpriseEditionExtremePerformance, + "ENTERPRISE_EDITION_HIGH_PERFORMANCE": DbSystemDatabaseEditionEnterpriseEditionHighPerformance, +} + +// GetDbSystemDatabaseEditionEnumValues Enumerates the set of values for DbSystemDatabaseEdition +func GetDbSystemDatabaseEditionEnumValues() []DbSystemDatabaseEditionEnum { + values := make([]DbSystemDatabaseEditionEnum, 0) + for _, v := range mappingDbSystemDatabaseEdition { + values = append(values, v) + } + return values +} + +// DbSystemDiskRedundancyEnum Enum with underlying type: string +type DbSystemDiskRedundancyEnum string + +// Set of constants representing the allowable values for DbSystemDiskRedundancy +const ( + DbSystemDiskRedundancyHigh DbSystemDiskRedundancyEnum = "HIGH" + DbSystemDiskRedundancyNormal DbSystemDiskRedundancyEnum = "NORMAL" +) + +var mappingDbSystemDiskRedundancy = map[string]DbSystemDiskRedundancyEnum{ + "HIGH": DbSystemDiskRedundancyHigh, + "NORMAL": DbSystemDiskRedundancyNormal, +} + +// GetDbSystemDiskRedundancyEnumValues Enumerates the set of values for DbSystemDiskRedundancy +func GetDbSystemDiskRedundancyEnumValues() []DbSystemDiskRedundancyEnum { + values := make([]DbSystemDiskRedundancyEnum, 0) + for _, v := range mappingDbSystemDiskRedundancy { + values = append(values, v) + } + return values +} + +// DbSystemLicenseModelEnum Enum with underlying type: string +type DbSystemLicenseModelEnum string + +// Set of constants representing the allowable values for DbSystemLicenseModel +const ( + DbSystemLicenseModelLicenseIncluded DbSystemLicenseModelEnum = "LICENSE_INCLUDED" + DbSystemLicenseModelBringYourOwnLicense DbSystemLicenseModelEnum = "BRING_YOUR_OWN_LICENSE" +) + +var mappingDbSystemLicenseModel = map[string]DbSystemLicenseModelEnum{ + "LICENSE_INCLUDED": DbSystemLicenseModelLicenseIncluded, + "BRING_YOUR_OWN_LICENSE": DbSystemLicenseModelBringYourOwnLicense, +} + +// GetDbSystemLicenseModelEnumValues Enumerates the set of values for DbSystemLicenseModel +func GetDbSystemLicenseModelEnumValues() []DbSystemLicenseModelEnum { + values := make([]DbSystemLicenseModelEnum, 0) + for _, v := range mappingDbSystemLicenseModel { + values = append(values, v) + } + return values +} + +// DbSystemLifecycleStateEnum Enum with underlying type: string +type DbSystemLifecycleStateEnum string + +// Set of constants representing the allowable values for DbSystemLifecycleState +const ( + DbSystemLifecycleStateProvisioning DbSystemLifecycleStateEnum = "PROVISIONING" + DbSystemLifecycleStateAvailable DbSystemLifecycleStateEnum = "AVAILABLE" + DbSystemLifecycleStateUpdating DbSystemLifecycleStateEnum = "UPDATING" + DbSystemLifecycleStateTerminating DbSystemLifecycleStateEnum = "TERMINATING" + DbSystemLifecycleStateTerminated DbSystemLifecycleStateEnum = "TERMINATED" + DbSystemLifecycleStateFailed DbSystemLifecycleStateEnum = "FAILED" +) + +var mappingDbSystemLifecycleState = map[string]DbSystemLifecycleStateEnum{ + "PROVISIONING": DbSystemLifecycleStateProvisioning, + "AVAILABLE": DbSystemLifecycleStateAvailable, + "UPDATING": DbSystemLifecycleStateUpdating, + "TERMINATING": DbSystemLifecycleStateTerminating, + "TERMINATED": DbSystemLifecycleStateTerminated, + "FAILED": DbSystemLifecycleStateFailed, +} + +// GetDbSystemLifecycleStateEnumValues Enumerates the set of values for DbSystemLifecycleState +func GetDbSystemLifecycleStateEnumValues() []DbSystemLifecycleStateEnum { + values := make([]DbSystemLifecycleStateEnum, 0) + for _, v := range mappingDbSystemLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_system_shape_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/db_system_shape_summary.go new file mode 100644 index 0000000000..831411c167 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_system_shape_summary.go @@ -0,0 +1,34 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DbSystemShapeSummary The shape of the DB System. The shape determines resources to allocate to the DB system - CPU cores and memory for VM shapes; CPU cores, memory and storage for non-VM (or bare metal) shapes. +// For a description of shapes, see DB System Launch Options (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/References/launchoptions.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. +// If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type DbSystemShapeSummary struct { + + // The maximum number of CPU cores that can be enabled on the DB System. + AvailableCoreCount *int `mandatory:"true" json:"availableCoreCount"` + + // The name of the shape used for the DB System. + Name *string `mandatory:"true" json:"name"` + + // Deprecated. Use `name` instead of `shape`. + Shape *string `mandatory:"false" json:"shape"` +} + +func (m DbSystemShapeSummary) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_system_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/db_system_summary.go new file mode 100644 index 0000000000..7f8ba31a3b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_system_summary.go @@ -0,0 +1,236 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DbSystemSummary The Database Service supports several types of DB Systems, ranging in size, price, and performance. For details about each type of system, see: +// - Exadata DB Systems (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/exaoverview.htm) +// - Bare Metal or VM DB Systems (https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm) +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +// +// For information about access control and compartments, see +// Overview of the Identity Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// For information about Availability Domains, see +// Regions and Availability Domains (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). +// To get a list of Availability Domains, use the `ListAvailabilityDomains` operation +// in the Identity Service API. +type DbSystemSummary struct { + + // The name of the Availability Domain that the DB System is located in. + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The number of CPU cores enabled on the DB System. + CpuCoreCount *int `mandatory:"true" json:"cpuCoreCount"` + + // The Oracle Database Edition that applies to all the databases on the DB System. + DatabaseEdition DbSystemSummaryDatabaseEditionEnum `mandatory:"true" json:"databaseEdition"` + + // The user-friendly name for the DB System. It does not have to be unique. + DisplayName *string `mandatory:"true" json:"displayName"` + + // The domain name for the DB System. + Domain *string `mandatory:"true" json:"domain"` + + // The host name for the DB Node. + Hostname *string `mandatory:"true" json:"hostname"` + + // The OCID of the DB System. + Id *string `mandatory:"true" json:"id"` + + // The current state of the DB System. + LifecycleState DbSystemSummaryLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The shape of the DB System. The shape determines resources to allocate to the DB system - CPU cores and memory for VM shapes; CPU cores, memory and storage for non-VM (or bare metal) shapes. + Shape *string `mandatory:"true" json:"shape"` + + // The public key portion of one or more key pairs used for SSH access to the DB System. + SshPublicKeys []string `mandatory:"true" json:"sshPublicKeys"` + + // The OCID of the subnet the DB System is associated with. + // **Subnet Restrictions:** + // - For single node and 2-node (RAC) DB Systems, do not use a subnet that overlaps with 192.168.16.16/28 + // - For Exadata and VM-based RAC DB Systems, do not use a subnet that overlaps with 192.168.128.0/20 + // These subnets are used by the Oracle Clusterware private interconnect on the database instance. + // Specifying an overlapping subnet will cause the private interconnect to malfunction. + // This restriction applies to both the client subnet and backup subnet. + SubnetId *string `mandatory:"true" json:"subnetId"` + + // The OCID of the backup network subnet the DB System is associated with. Applicable only to Exadata. + // **Subnet Restriction:** See above subnetId's 'Subnet Restriction'. + // to malfunction. + BackupSubnetId *string `mandatory:"false" json:"backupSubnetId"` + + // Cluster name for Exadata and 2-node RAC DB Systems. The cluster name must begin with an an alphabetic character, and may contain hyphens (-). Underscores (_) are not permitted. The cluster name can be no longer than 11 characters and is not case sensitive. + ClusterName *string `mandatory:"false" json:"clusterName"` + + // The percentage assigned to DATA storage (user data and database files). + // The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). Accepted values are 40 and 80. + DataStoragePercentage *int `mandatory:"false" json:"dataStoragePercentage"` + + // Data storage size, in GBs, that is currently available to the DB system. This is applicable only for VM-based DBs. + DataStorageSizeInGBs *int `mandatory:"false" json:"dataStorageSizeInGBs"` + + // The type of redundancy configured for the DB System. + // Normal is 2-way redundancy. + // High is 3-way redundancy. + DiskRedundancy DbSystemSummaryDiskRedundancyEnum `mandatory:"false" json:"diskRedundancy,omitempty"` + + // The OCID of the last patch history. This is updated as soon as a patch operation is started. + LastPatchHistoryEntryId *string `mandatory:"false" json:"lastPatchHistoryEntryId"` + + // The Oracle license model that applies to all the databases on the DB System. The default is LICENSE_INCLUDED. + LicenseModel DbSystemSummaryLicenseModelEnum `mandatory:"false" json:"licenseModel,omitempty"` + + // Additional information about the current lifecycleState. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The port number configured for the listener on the DB System. + ListenerPort *int `mandatory:"false" json:"listenerPort"` + + // Number of nodes in this DB system. For RAC DBs, this will be greater than 1. + NodeCount *int `mandatory:"false" json:"nodeCount"` + + // RECO/REDO storage size, in GBs, that is currently allocated to the DB system. This is applicable only for VM-based DBs. + RecoStorageSizeInGB *int `mandatory:"false" json:"recoStorageSizeInGB"` + + // The OCID of the DNS record for the SCAN IP addresses that are associated with the DB System. + ScanDnsRecordId *string `mandatory:"false" json:"scanDnsRecordId"` + + // The OCID of the Single Client Access Name (SCAN) IP addresses associated with the DB System. + // SCAN IP addresses are typically used for load balancing and are not assigned to any interface. + // Clusterware directs the requests to the appropriate nodes in the cluster. + // - For a single-node DB System, this list is empty. + ScanIpIds []string `mandatory:"false" json:"scanIpIds"` + + // The date and time the DB System was created. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The version of the DB System. + Version *string `mandatory:"false" json:"version"` + + // The OCID of the virtual IP (VIP) addresses associated with the DB System. + // The Cluster Ready Services (CRS) creates and maintains one VIP address for each node in the DB System to + // enable failover. If one node fails, the VIP is reassigned to another active node in the cluster. + // - For a single-node DB System, this list is empty. + VipIds []string `mandatory:"false" json:"vipIds"` +} + +func (m DbSystemSummary) String() string { + return common.PointerString(m) +} + +// DbSystemSummaryDatabaseEditionEnum Enum with underlying type: string +type DbSystemSummaryDatabaseEditionEnum string + +// Set of constants representing the allowable values for DbSystemSummaryDatabaseEdition +const ( + DbSystemSummaryDatabaseEditionStandardEdition DbSystemSummaryDatabaseEditionEnum = "STANDARD_EDITION" + DbSystemSummaryDatabaseEditionEnterpriseEdition DbSystemSummaryDatabaseEditionEnum = "ENTERPRISE_EDITION" + DbSystemSummaryDatabaseEditionEnterpriseEditionExtremePerformance DbSystemSummaryDatabaseEditionEnum = "ENTERPRISE_EDITION_EXTREME_PERFORMANCE" + DbSystemSummaryDatabaseEditionEnterpriseEditionHighPerformance DbSystemSummaryDatabaseEditionEnum = "ENTERPRISE_EDITION_HIGH_PERFORMANCE" +) + +var mappingDbSystemSummaryDatabaseEdition = map[string]DbSystemSummaryDatabaseEditionEnum{ + "STANDARD_EDITION": DbSystemSummaryDatabaseEditionStandardEdition, + "ENTERPRISE_EDITION": DbSystemSummaryDatabaseEditionEnterpriseEdition, + "ENTERPRISE_EDITION_EXTREME_PERFORMANCE": DbSystemSummaryDatabaseEditionEnterpriseEditionExtremePerformance, + "ENTERPRISE_EDITION_HIGH_PERFORMANCE": DbSystemSummaryDatabaseEditionEnterpriseEditionHighPerformance, +} + +// GetDbSystemSummaryDatabaseEditionEnumValues Enumerates the set of values for DbSystemSummaryDatabaseEdition +func GetDbSystemSummaryDatabaseEditionEnumValues() []DbSystemSummaryDatabaseEditionEnum { + values := make([]DbSystemSummaryDatabaseEditionEnum, 0) + for _, v := range mappingDbSystemSummaryDatabaseEdition { + values = append(values, v) + } + return values +} + +// DbSystemSummaryDiskRedundancyEnum Enum with underlying type: string +type DbSystemSummaryDiskRedundancyEnum string + +// Set of constants representing the allowable values for DbSystemSummaryDiskRedundancy +const ( + DbSystemSummaryDiskRedundancyHigh DbSystemSummaryDiskRedundancyEnum = "HIGH" + DbSystemSummaryDiskRedundancyNormal DbSystemSummaryDiskRedundancyEnum = "NORMAL" +) + +var mappingDbSystemSummaryDiskRedundancy = map[string]DbSystemSummaryDiskRedundancyEnum{ + "HIGH": DbSystemSummaryDiskRedundancyHigh, + "NORMAL": DbSystemSummaryDiskRedundancyNormal, +} + +// GetDbSystemSummaryDiskRedundancyEnumValues Enumerates the set of values for DbSystemSummaryDiskRedundancy +func GetDbSystemSummaryDiskRedundancyEnumValues() []DbSystemSummaryDiskRedundancyEnum { + values := make([]DbSystemSummaryDiskRedundancyEnum, 0) + for _, v := range mappingDbSystemSummaryDiskRedundancy { + values = append(values, v) + } + return values +} + +// DbSystemSummaryLicenseModelEnum Enum with underlying type: string +type DbSystemSummaryLicenseModelEnum string + +// Set of constants representing the allowable values for DbSystemSummaryLicenseModel +const ( + DbSystemSummaryLicenseModelLicenseIncluded DbSystemSummaryLicenseModelEnum = "LICENSE_INCLUDED" + DbSystemSummaryLicenseModelBringYourOwnLicense DbSystemSummaryLicenseModelEnum = "BRING_YOUR_OWN_LICENSE" +) + +var mappingDbSystemSummaryLicenseModel = map[string]DbSystemSummaryLicenseModelEnum{ + "LICENSE_INCLUDED": DbSystemSummaryLicenseModelLicenseIncluded, + "BRING_YOUR_OWN_LICENSE": DbSystemSummaryLicenseModelBringYourOwnLicense, +} + +// GetDbSystemSummaryLicenseModelEnumValues Enumerates the set of values for DbSystemSummaryLicenseModel +func GetDbSystemSummaryLicenseModelEnumValues() []DbSystemSummaryLicenseModelEnum { + values := make([]DbSystemSummaryLicenseModelEnum, 0) + for _, v := range mappingDbSystemSummaryLicenseModel { + values = append(values, v) + } + return values +} + +// DbSystemSummaryLifecycleStateEnum Enum with underlying type: string +type DbSystemSummaryLifecycleStateEnum string + +// Set of constants representing the allowable values for DbSystemSummaryLifecycleState +const ( + DbSystemSummaryLifecycleStateProvisioning DbSystemSummaryLifecycleStateEnum = "PROVISIONING" + DbSystemSummaryLifecycleStateAvailable DbSystemSummaryLifecycleStateEnum = "AVAILABLE" + DbSystemSummaryLifecycleStateUpdating DbSystemSummaryLifecycleStateEnum = "UPDATING" + DbSystemSummaryLifecycleStateTerminating DbSystemSummaryLifecycleStateEnum = "TERMINATING" + DbSystemSummaryLifecycleStateTerminated DbSystemSummaryLifecycleStateEnum = "TERMINATED" + DbSystemSummaryLifecycleStateFailed DbSystemSummaryLifecycleStateEnum = "FAILED" +) + +var mappingDbSystemSummaryLifecycleState = map[string]DbSystemSummaryLifecycleStateEnum{ + "PROVISIONING": DbSystemSummaryLifecycleStateProvisioning, + "AVAILABLE": DbSystemSummaryLifecycleStateAvailable, + "UPDATING": DbSystemSummaryLifecycleStateUpdating, + "TERMINATING": DbSystemSummaryLifecycleStateTerminating, + "TERMINATED": DbSystemSummaryLifecycleStateTerminated, + "FAILED": DbSystemSummaryLifecycleStateFailed, +} + +// GetDbSystemSummaryLifecycleStateEnumValues Enumerates the set of values for DbSystemSummaryLifecycleState +func GetDbSystemSummaryLifecycleStateEnumValues() []DbSystemSummaryLifecycleStateEnum { + values := make([]DbSystemSummaryLifecycleStateEnum, 0) + for _, v := range mappingDbSystemSummaryLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/db_version_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/db_version_summary.go new file mode 100644 index 0000000000..5920cb4b95 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/db_version_summary.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// DbVersionSummary The Oracle database software version. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type DbVersionSummary struct { + + // A valid Oracle database version. + Version *string `mandatory:"true" json:"version"` + + // True if this version of the Oracle database software supports pluggable dbs. + SupportsPdb *bool `mandatory:"false" json:"supportsPdb"` +} + +func (m DbVersionSummary) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/delete_backup_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/delete_backup_request_response.go new file mode 100644 index 0000000000..ff0446bbbe --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/delete_backup_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteBackupRequest wrapper for the DeleteBackup operation +type DeleteBackupRequest struct { + + // The backup OCID. + BackupId *string `mandatory:"true" contributesTo:"path" name:"backupId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteBackupRequest) String() string { + return common.PointerString(request) +} + +// DeleteBackupResponse wrapper for the DeleteBackup operation +type DeleteBackupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteBackupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/delete_db_home_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/delete_db_home_request_response.go new file mode 100644 index 0000000000..d50d313f07 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/delete_db_home_request_response.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteDbHomeRequest wrapper for the DeleteDbHome operation +type DeleteDbHomeRequest struct { + + // The database home OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbHomeId *string `mandatory:"true" contributesTo:"path" name:"dbHomeId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Whether to perform a final backup of the database or not. Default is false. If you previously used RMAN or dbcli to configure backups and then you switch to using the Console or the API for backups, a new backup configuration is created and associated with your database. This means that you can no longer rely on your previously configured unmanaged backups to work. + PerformFinalBackup *bool `mandatory:"false" contributesTo:"query" name:"performFinalBackup"` +} + +func (request DeleteDbHomeRequest) String() string { + return common.PointerString(request) +} + +// DeleteDbHomeResponse wrapper for the DeleteDbHome operation +type DeleteDbHomeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteDbHomeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/failover_data_guard_association_details.go b/vendor/github.com/oracle/oci-go-sdk/database/failover_data_guard_association_details.go new file mode 100644 index 0000000000..40e8bc76b5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/failover_data_guard_association_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// FailoverDataGuardAssociationDetails The Data Guard association failover parameters. +type FailoverDataGuardAssociationDetails struct { + + // The DB System administrator password. + DatabaseAdminPassword *string `mandatory:"true" json:"databaseAdminPassword"` +} + +func (m FailoverDataGuardAssociationDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/failover_data_guard_association_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/failover_data_guard_association_request_response.go new file mode 100644 index 0000000000..265c73f007 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/failover_data_guard_association_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// FailoverDataGuardAssociationRequest wrapper for the FailoverDataGuardAssociation operation +type FailoverDataGuardAssociationRequest struct { + + // The database OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DatabaseId *string `mandatory:"true" contributesTo:"path" name:"databaseId"` + + // The Data Guard association's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DataGuardAssociationId *string `mandatory:"true" contributesTo:"path" name:"dataGuardAssociationId"` + + // A request to perform a failover, transitioning a standby database into a primary database. + FailoverDataGuardAssociationDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request FailoverDataGuardAssociationRequest) String() string { + return common.PointerString(request) +} + +// FailoverDataGuardAssociationResponse wrapper for the FailoverDataGuardAssociation operation +type FailoverDataGuardAssociationResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DataGuardAssociation instance + DataGuardAssociation `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response FailoverDataGuardAssociationResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_backup_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_backup_request_response.go new file mode 100644 index 0000000000..8a7ce18352 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_backup_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetBackupRequest wrapper for the GetBackup operation +type GetBackupRequest struct { + + // The backup OCID. + BackupId *string `mandatory:"true" contributesTo:"path" name:"backupId"` +} + +func (request GetBackupRequest) String() string { + return common.PointerString(request) +} + +// GetBackupResponse wrapper for the GetBackup operation +type GetBackupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Backup instance + Backup `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetBackupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_data_guard_association_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_data_guard_association_request_response.go new file mode 100644 index 0000000000..2b2f554568 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_data_guard_association_request_response.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDataGuardAssociationRequest wrapper for the GetDataGuardAssociation operation +type GetDataGuardAssociationRequest struct { + + // The database OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DatabaseId *string `mandatory:"true" contributesTo:"path" name:"databaseId"` + + // The Data Guard association's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DataGuardAssociationId *string `mandatory:"true" contributesTo:"path" name:"dataGuardAssociationId"` +} + +func (request GetDataGuardAssociationRequest) String() string { + return common.PointerString(request) +} + +// GetDataGuardAssociationResponse wrapper for the GetDataGuardAssociation operation +type GetDataGuardAssociationResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DataGuardAssociation instance + DataGuardAssociation `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDataGuardAssociationResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_database_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_database_request_response.go new file mode 100644 index 0000000000..8b3a5701b1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_database_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDatabaseRequest wrapper for the GetDatabase operation +type GetDatabaseRequest struct { + + // The database OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DatabaseId *string `mandatory:"true" contributesTo:"path" name:"databaseId"` +} + +func (request GetDatabaseRequest) String() string { + return common.PointerString(request) +} + +// GetDatabaseResponse wrapper for the GetDatabase operation +type GetDatabaseResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Database instance + Database `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDatabaseResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_db_home_patch_history_entry_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_db_home_patch_history_entry_request_response.go new file mode 100644 index 0000000000..c129a3119f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_db_home_patch_history_entry_request_response.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDbHomePatchHistoryEntryRequest wrapper for the GetDbHomePatchHistoryEntry operation +type GetDbHomePatchHistoryEntryRequest struct { + + // The database home OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbHomeId *string `mandatory:"true" contributesTo:"path" name:"dbHomeId"` + + // The OCID of the patch history entry. + PatchHistoryEntryId *string `mandatory:"true" contributesTo:"path" name:"patchHistoryEntryId"` +} + +func (request GetDbHomePatchHistoryEntryRequest) String() string { + return common.PointerString(request) +} + +// GetDbHomePatchHistoryEntryResponse wrapper for the GetDbHomePatchHistoryEntry operation +type GetDbHomePatchHistoryEntryResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The PatchHistoryEntry instance + PatchHistoryEntry `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDbHomePatchHistoryEntryResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_db_home_patch_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_db_home_patch_request_response.go new file mode 100644 index 0000000000..74b3896883 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_db_home_patch_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDbHomePatchRequest wrapper for the GetDbHomePatch operation +type GetDbHomePatchRequest struct { + + // The database home OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbHomeId *string `mandatory:"true" contributesTo:"path" name:"dbHomeId"` + + // The OCID of the patch. + PatchId *string `mandatory:"true" contributesTo:"path" name:"patchId"` +} + +func (request GetDbHomePatchRequest) String() string { + return common.PointerString(request) +} + +// GetDbHomePatchResponse wrapper for the GetDbHomePatch operation +type GetDbHomePatchResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Patch instance + Patch `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDbHomePatchResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_db_home_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_db_home_request_response.go new file mode 100644 index 0000000000..795c4f4bc1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_db_home_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDbHomeRequest wrapper for the GetDbHome operation +type GetDbHomeRequest struct { + + // The database home OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbHomeId *string `mandatory:"true" contributesTo:"path" name:"dbHomeId"` +} + +func (request GetDbHomeRequest) String() string { + return common.PointerString(request) +} + +// GetDbHomeResponse wrapper for the GetDbHome operation +type GetDbHomeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DbHome instance + DbHome `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDbHomeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_db_node_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_db_node_request_response.go new file mode 100644 index 0000000000..3f5e1fc2a1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_db_node_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDbNodeRequest wrapper for the GetDbNode operation +type GetDbNodeRequest struct { + + // The database node OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbNodeId *string `mandatory:"true" contributesTo:"path" name:"dbNodeId"` +} + +func (request GetDbNodeRequest) String() string { + return common.PointerString(request) +} + +// GetDbNodeResponse wrapper for the GetDbNode operation +type GetDbNodeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DbNode instance + DbNode `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDbNodeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_db_system_patch_history_entry_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_db_system_patch_history_entry_request_response.go new file mode 100644 index 0000000000..4891a2df8c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_db_system_patch_history_entry_request_response.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDbSystemPatchHistoryEntryRequest wrapper for the GetDbSystemPatchHistoryEntry operation +type GetDbSystemPatchHistoryEntryRequest struct { + + // The DB System OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbSystemId *string `mandatory:"true" contributesTo:"path" name:"dbSystemId"` + + // The OCID of the patch history entry. + PatchHistoryEntryId *string `mandatory:"true" contributesTo:"path" name:"patchHistoryEntryId"` +} + +func (request GetDbSystemPatchHistoryEntryRequest) String() string { + return common.PointerString(request) +} + +// GetDbSystemPatchHistoryEntryResponse wrapper for the GetDbSystemPatchHistoryEntry operation +type GetDbSystemPatchHistoryEntryResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The PatchHistoryEntry instance + PatchHistoryEntry `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDbSystemPatchHistoryEntryResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_db_system_patch_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_db_system_patch_request_response.go new file mode 100644 index 0000000000..916b6aafcf --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_db_system_patch_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDbSystemPatchRequest wrapper for the GetDbSystemPatch operation +type GetDbSystemPatchRequest struct { + + // The DB System OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbSystemId *string `mandatory:"true" contributesTo:"path" name:"dbSystemId"` + + // The OCID of the patch. + PatchId *string `mandatory:"true" contributesTo:"path" name:"patchId"` +} + +func (request GetDbSystemPatchRequest) String() string { + return common.PointerString(request) +} + +// GetDbSystemPatchResponse wrapper for the GetDbSystemPatch operation +type GetDbSystemPatchResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Patch instance + Patch `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDbSystemPatchResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/get_db_system_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/get_db_system_request_response.go new file mode 100644 index 0000000000..9a1dc670f8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/get_db_system_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetDbSystemRequest wrapper for the GetDbSystem operation +type GetDbSystemRequest struct { + + // The DB System OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbSystemId *string `mandatory:"true" contributesTo:"path" name:"dbSystemId"` +} + +func (request GetDbSystemRequest) String() string { + return common.PointerString(request) +} + +// GetDbSystemResponse wrapper for the GetDbSystem operation +type GetDbSystemResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DbSystem instance + DbSystem `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDbSystemResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/launch_db_system_details.go b/vendor/github.com/oracle/oci-go-sdk/database/launch_db_system_details.go new file mode 100644 index 0000000000..2ba66b6f79 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/launch_db_system_details.go @@ -0,0 +1,171 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// LaunchDbSystemDetails The representation of LaunchDbSystemDetails +type LaunchDbSystemDetails struct { + + // The Availability Domain where the DB System is located. + AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"` + + // The Oracle Cloud ID (OCID) of the compartment the DB System belongs in. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The number of CPU cores to enable. The valid values depend on the specified shape: + // - BM.DenseIO1.36 and BM.HighIO1.36 - Specify a multiple of 2, from 2 to 36. + // - BM.RACLocalStorage1.72 - Specify a multiple of 4, from 4 to 72. + // - Exadata.Quarter1.84 - Specify a multiple of 2, from 22 to 84. + // - Exadata.Half1.168 - Specify a multiple of 4, from 44 to 168. + // - Exadata.Full1.336 - Specify a multiple of 8, from 88 to 336. + // For VM DB systems, the core count is inferred from the specific VM shape chosen, so this parameter is not used. + CpuCoreCount *int `mandatory:"true" json:"cpuCoreCount"` + + // The Oracle Database Edition that applies to all the databases on the DB System. + // Exadata DB Systems and 2-node RAC DB Systems require ENTERPRISE_EDITION_EXTREME_PERFORMANCE. + DatabaseEdition LaunchDbSystemDetailsDatabaseEditionEnum `mandatory:"true" json:"databaseEdition"` + + DbHome *CreateDbHomeDetails `mandatory:"true" json:"dbHome"` + + // The host name for the DB System. The host name must begin with an alphabetic character and + // can contain a maximum of 30 alphanumeric characters, including hyphens (-). + // The maximum length of the combined hostname and domain is 63 characters. + // **Note:** The hostname must be unique within the subnet. If it is not unique, + // the DB System will fail to provision. + Hostname *string `mandatory:"true" json:"hostname"` + + // The shape of the DB System. The shape determines resources allocated to the DB System - CPU cores and memory for VM shapes; CPU cores, memory and storage for non-VM (or bare metal) shapes. To get a list of shapes, use the ListDbSystemShapes operation. + Shape *string `mandatory:"true" json:"shape"` + + // The public key portion of the key pair to use for SSH access to the DB System. Multiple public keys can be provided. The length of the combined keys cannot exceed 10,000 characters. + SshPublicKeys []string `mandatory:"true" json:"sshPublicKeys"` + + // The OCID of the subnet the DB System is associated with. + // **Subnet Restrictions:** + // - For single node and 2-node (RAC) DB Systems, do not use a subnet that overlaps with 192.168.16.16/28 + // - For Exadata and VM-based RAC DB Systems, do not use a subnet that overlaps with 192.168.128.0/20 + // These subnets are used by the Oracle Clusterware private interconnect on the database instance. + // Specifying an overlapping subnet will cause the private interconnect to malfunction. + // This restriction applies to both the client subnet and backup subnet. + SubnetId *string `mandatory:"true" json:"subnetId"` + + // The OCID of the backup network subnet the DB System is associated with. Applicable only to Exadata. + // **Subnet Restrictions:** See above subnetId's **Subnet Restriction**. + BackupSubnetId *string `mandatory:"false" json:"backupSubnetId"` + + // Cluster name for Exadata and 2-node RAC DB Systems. The cluster name must begin with an an alphabetic character, and may contain hyphens (-). Underscores (_) are not permitted. The cluster name can be no longer than 11 characters and is not case sensitive. + ClusterName *string `mandatory:"false" json:"clusterName"` + + // The percentage assigned to DATA storage (user data and database files). + // The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). + // Specify 80 or 40. The default is 80 percent assigned to DATA storage. This is not applicable for VM based DB systems. + DataStoragePercentage *int `mandatory:"false" json:"dataStoragePercentage"` + + // The type of redundancy configured for the DB System. + // Normal is 2-way redundancy, recommended for test and development systems. + // High is 3-way redundancy, recommended for production systems. + DiskRedundancy LaunchDbSystemDetailsDiskRedundancyEnum `mandatory:"false" json:"diskRedundancy,omitempty"` + + // The user-friendly name for the DB System. It does not have to be unique. + DisplayName *string `mandatory:"false" json:"displayName"` + + // A domain name used for the DB System. If the Oracle-provided Internet and VCN + // Resolver is enabled for the specified subnet, the domain name for the subnet is used + // (don't provide one). Otherwise, provide a valid DNS domain name. Hyphens (-) are not permitted. + Domain *string `mandatory:"false" json:"domain"` + + // Size, in GBs, of the initial data volume that will be created and attached to VM-shape based DB system. This storage can later be scaled up if needed. Note that the total storage size attached will be more than what is requested, to account for REDO/RECO space and software volume. + InitialDataStorageSizeInGB *int `mandatory:"false" json:"initialDataStorageSizeInGB"` + + // The Oracle license model that applies to all the databases on the DB System. The default is LICENSE_INCLUDED. + LicenseModel LaunchDbSystemDetailsLicenseModelEnum `mandatory:"false" json:"licenseModel,omitempty"` + + // Number of nodes to launch for a VM-shape based RAC DB system. + NodeCount *int `mandatory:"false" json:"nodeCount"` +} + +func (m LaunchDbSystemDetails) String() string { + return common.PointerString(m) +} + +// LaunchDbSystemDetailsDatabaseEditionEnum Enum with underlying type: string +type LaunchDbSystemDetailsDatabaseEditionEnum string + +// Set of constants representing the allowable values for LaunchDbSystemDetailsDatabaseEdition +const ( + LaunchDbSystemDetailsDatabaseEditionStandardEdition LaunchDbSystemDetailsDatabaseEditionEnum = "STANDARD_EDITION" + LaunchDbSystemDetailsDatabaseEditionEnterpriseEdition LaunchDbSystemDetailsDatabaseEditionEnum = "ENTERPRISE_EDITION" + LaunchDbSystemDetailsDatabaseEditionEnterpriseEditionExtremePerformance LaunchDbSystemDetailsDatabaseEditionEnum = "ENTERPRISE_EDITION_EXTREME_PERFORMANCE" + LaunchDbSystemDetailsDatabaseEditionEnterpriseEditionHighPerformance LaunchDbSystemDetailsDatabaseEditionEnum = "ENTERPRISE_EDITION_HIGH_PERFORMANCE" +) + +var mappingLaunchDbSystemDetailsDatabaseEdition = map[string]LaunchDbSystemDetailsDatabaseEditionEnum{ + "STANDARD_EDITION": LaunchDbSystemDetailsDatabaseEditionStandardEdition, + "ENTERPRISE_EDITION": LaunchDbSystemDetailsDatabaseEditionEnterpriseEdition, + "ENTERPRISE_EDITION_EXTREME_PERFORMANCE": LaunchDbSystemDetailsDatabaseEditionEnterpriseEditionExtremePerformance, + "ENTERPRISE_EDITION_HIGH_PERFORMANCE": LaunchDbSystemDetailsDatabaseEditionEnterpriseEditionHighPerformance, +} + +// GetLaunchDbSystemDetailsDatabaseEditionEnumValues Enumerates the set of values for LaunchDbSystemDetailsDatabaseEdition +func GetLaunchDbSystemDetailsDatabaseEditionEnumValues() []LaunchDbSystemDetailsDatabaseEditionEnum { + values := make([]LaunchDbSystemDetailsDatabaseEditionEnum, 0) + for _, v := range mappingLaunchDbSystemDetailsDatabaseEdition { + values = append(values, v) + } + return values +} + +// LaunchDbSystemDetailsDiskRedundancyEnum Enum with underlying type: string +type LaunchDbSystemDetailsDiskRedundancyEnum string + +// Set of constants representing the allowable values for LaunchDbSystemDetailsDiskRedundancy +const ( + LaunchDbSystemDetailsDiskRedundancyHigh LaunchDbSystemDetailsDiskRedundancyEnum = "HIGH" + LaunchDbSystemDetailsDiskRedundancyNormal LaunchDbSystemDetailsDiskRedundancyEnum = "NORMAL" +) + +var mappingLaunchDbSystemDetailsDiskRedundancy = map[string]LaunchDbSystemDetailsDiskRedundancyEnum{ + "HIGH": LaunchDbSystemDetailsDiskRedundancyHigh, + "NORMAL": LaunchDbSystemDetailsDiskRedundancyNormal, +} + +// GetLaunchDbSystemDetailsDiskRedundancyEnumValues Enumerates the set of values for LaunchDbSystemDetailsDiskRedundancy +func GetLaunchDbSystemDetailsDiskRedundancyEnumValues() []LaunchDbSystemDetailsDiskRedundancyEnum { + values := make([]LaunchDbSystemDetailsDiskRedundancyEnum, 0) + for _, v := range mappingLaunchDbSystemDetailsDiskRedundancy { + values = append(values, v) + } + return values +} + +// LaunchDbSystemDetailsLicenseModelEnum Enum with underlying type: string +type LaunchDbSystemDetailsLicenseModelEnum string + +// Set of constants representing the allowable values for LaunchDbSystemDetailsLicenseModel +const ( + LaunchDbSystemDetailsLicenseModelLicenseIncluded LaunchDbSystemDetailsLicenseModelEnum = "LICENSE_INCLUDED" + LaunchDbSystemDetailsLicenseModelBringYourOwnLicense LaunchDbSystemDetailsLicenseModelEnum = "BRING_YOUR_OWN_LICENSE" +) + +var mappingLaunchDbSystemDetailsLicenseModel = map[string]LaunchDbSystemDetailsLicenseModelEnum{ + "LICENSE_INCLUDED": LaunchDbSystemDetailsLicenseModelLicenseIncluded, + "BRING_YOUR_OWN_LICENSE": LaunchDbSystemDetailsLicenseModelBringYourOwnLicense, +} + +// GetLaunchDbSystemDetailsLicenseModelEnumValues Enumerates the set of values for LaunchDbSystemDetailsLicenseModel +func GetLaunchDbSystemDetailsLicenseModelEnumValues() []LaunchDbSystemDetailsLicenseModelEnum { + values := make([]LaunchDbSystemDetailsLicenseModelEnum, 0) + for _, v := range mappingLaunchDbSystemDetailsLicenseModel { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/launch_db_system_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/launch_db_system_request_response.go new file mode 100644 index 0000000000..d1d6b45e61 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/launch_db_system_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// LaunchDbSystemRequest wrapper for the LaunchDbSystem operation +type LaunchDbSystemRequest struct { + + // Request to launch a DB System. + LaunchDbSystemDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (for example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request LaunchDbSystemRequest) String() string { + return common.PointerString(request) +} + +// LaunchDbSystemResponse wrapper for the LaunchDbSystem operation +type LaunchDbSystemResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DbSystem instance + DbSystem `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response LaunchDbSystemResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_backups_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_backups_request_response.go new file mode 100644 index 0000000000..6bb0890166 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_backups_request_response.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListBackupsRequest wrapper for the ListBackups operation +type ListBackupsRequest struct { + + // The OCID of the database. + DatabaseId *string `mandatory:"false" contributesTo:"query" name:"databaseId"` + + // The compartment OCID. + CompartmentId *string `mandatory:"false" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListBackupsRequest) String() string { + return common.PointerString(request) +} + +// ListBackupsResponse wrapper for the ListBackups operation +type ListBackupsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []BackupSummary instance + Items []BackupSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListBackupsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_data_guard_associations_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_data_guard_associations_request_response.go new file mode 100644 index 0000000000..7f2f123d7a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_data_guard_associations_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDataGuardAssociationsRequest wrapper for the ListDataGuardAssociations operation +type ListDataGuardAssociationsRequest struct { + + // The database OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DatabaseId *string `mandatory:"true" contributesTo:"path" name:"databaseId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDataGuardAssociationsRequest) String() string { + return common.PointerString(request) +} + +// ListDataGuardAssociationsResponse wrapper for the ListDataGuardAssociations operation +type ListDataGuardAssociationsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []DataGuardAssociationSummary instance + Items []DataGuardAssociationSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDataGuardAssociationsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_databases_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_databases_request_response.go new file mode 100644 index 0000000000..73e3570187 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_databases_request_response.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDatabasesRequest wrapper for the ListDatabases operation +type ListDatabasesRequest struct { + + // The compartment OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // A database home OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbHomeId *string `mandatory:"true" contributesTo:"query" name:"dbHomeId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDatabasesRequest) String() string { + return common.PointerString(request) +} + +// ListDatabasesResponse wrapper for the ListDatabases operation +type ListDatabasesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []DatabaseSummary instance + Items []DatabaseSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDatabasesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_db_home_patch_history_entries_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_db_home_patch_history_entries_request_response.go new file mode 100644 index 0000000000..841a4a8099 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_db_home_patch_history_entries_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDbHomePatchHistoryEntriesRequest wrapper for the ListDbHomePatchHistoryEntries operation +type ListDbHomePatchHistoryEntriesRequest struct { + + // The database home OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbHomeId *string `mandatory:"true" contributesTo:"path" name:"dbHomeId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDbHomePatchHistoryEntriesRequest) String() string { + return common.PointerString(request) +} + +// ListDbHomePatchHistoryEntriesResponse wrapper for the ListDbHomePatchHistoryEntries operation +type ListDbHomePatchHistoryEntriesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []PatchHistoryEntrySummary instance + Items []PatchHistoryEntrySummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDbHomePatchHistoryEntriesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_db_home_patches_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_db_home_patches_request_response.go new file mode 100644 index 0000000000..5dd89d1a6c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_db_home_patches_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDbHomePatchesRequest wrapper for the ListDbHomePatches operation +type ListDbHomePatchesRequest struct { + + // The database home OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbHomeId *string `mandatory:"true" contributesTo:"path" name:"dbHomeId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDbHomePatchesRequest) String() string { + return common.PointerString(request) +} + +// ListDbHomePatchesResponse wrapper for the ListDbHomePatches operation +type ListDbHomePatchesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []PatchSummary instance + Items []PatchSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDbHomePatchesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_db_homes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_db_homes_request_response.go new file mode 100644 index 0000000000..363b609729 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_db_homes_request_response.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDbHomesRequest wrapper for the ListDbHomes operation +type ListDbHomesRequest struct { + + // The compartment OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the DB System. + DbSystemId *string `mandatory:"true" contributesTo:"query" name:"dbSystemId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDbHomesRequest) String() string { + return common.PointerString(request) +} + +// ListDbHomesResponse wrapper for the ListDbHomes operation +type ListDbHomesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []DbHomeSummary instance + Items []DbHomeSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDbHomesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_db_nodes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_db_nodes_request_response.go new file mode 100644 index 0000000000..ae02ae5832 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_db_nodes_request_response.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDbNodesRequest wrapper for the ListDbNodes operation +type ListDbNodesRequest struct { + + // The compartment OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the DB System. + DbSystemId *string `mandatory:"true" contributesTo:"query" name:"dbSystemId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDbNodesRequest) String() string { + return common.PointerString(request) +} + +// ListDbNodesResponse wrapper for the ListDbNodes operation +type ListDbNodesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []DbNodeSummary instance + Items []DbNodeSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDbNodesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_db_system_patch_history_entries_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_db_system_patch_history_entries_request_response.go new file mode 100644 index 0000000000..2a4c1aba1c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_db_system_patch_history_entries_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDbSystemPatchHistoryEntriesRequest wrapper for the ListDbSystemPatchHistoryEntries operation +type ListDbSystemPatchHistoryEntriesRequest struct { + + // The DB System OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbSystemId *string `mandatory:"true" contributesTo:"path" name:"dbSystemId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDbSystemPatchHistoryEntriesRequest) String() string { + return common.PointerString(request) +} + +// ListDbSystemPatchHistoryEntriesResponse wrapper for the ListDbSystemPatchHistoryEntries operation +type ListDbSystemPatchHistoryEntriesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []PatchHistoryEntrySummary instance + Items []PatchHistoryEntrySummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDbSystemPatchHistoryEntriesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_db_system_patches_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_db_system_patches_request_response.go new file mode 100644 index 0000000000..46ae8fc108 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_db_system_patches_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDbSystemPatchesRequest wrapper for the ListDbSystemPatches operation +type ListDbSystemPatchesRequest struct { + + // The DB System OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbSystemId *string `mandatory:"true" contributesTo:"path" name:"dbSystemId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDbSystemPatchesRequest) String() string { + return common.PointerString(request) +} + +// ListDbSystemPatchesResponse wrapper for the ListDbSystemPatches operation +type ListDbSystemPatchesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []PatchSummary instance + Items []PatchSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDbSystemPatchesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_db_system_shapes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_db_system_shapes_request_response.go new file mode 100644 index 0000000000..8f3d8b4709 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_db_system_shapes_request_response.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDbSystemShapesRequest wrapper for the ListDbSystemShapes operation +type ListDbSystemShapesRequest struct { + + // The name of the Availability Domain. + AvailabilityDomain *string `mandatory:"true" contributesTo:"query" name:"availabilityDomain"` + + // The compartment OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDbSystemShapesRequest) String() string { + return common.PointerString(request) +} + +// ListDbSystemShapesResponse wrapper for the ListDbSystemShapes operation +type ListDbSystemShapesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []DbSystemShapeSummary instance + Items []DbSystemShapeSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDbSystemShapesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_db_systems_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_db_systems_request_response.go new file mode 100644 index 0000000000..96a4693e5b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_db_systems_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDbSystemsRequest wrapper for the ListDbSystems operation +type ListDbSystemsRequest struct { + + // The compartment OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListDbSystemsRequest) String() string { + return common.PointerString(request) +} + +// ListDbSystemsResponse wrapper for the ListDbSystems operation +type ListDbSystemsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []DbSystemSummary instance + Items []DbSystemSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDbSystemsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/list_db_versions_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/list_db_versions_request_response.go new file mode 100644 index 0000000000..e6a77b7bb7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/list_db_versions_request_response.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListDbVersionsRequest wrapper for the ListDbVersions operation +type ListDbVersionsRequest struct { + + // The compartment OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The pagination token to continue listing from. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // If provided, filters the results to the set of database versions which are supported for the given shape. + DbSystemShape *string `mandatory:"false" contributesTo:"query" name:"dbSystemShape"` +} + +func (request ListDbVersionsRequest) String() string { + return common.PointerString(request) +} + +// ListDbVersionsResponse wrapper for the ListDbVersions operation +type ListDbVersionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []DbVersionSummary instance + Items []DbVersionSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then there are additional items still to get. Include this value as the `page` parameter for the + // subsequent GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#List_Pagination). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListDbVersionsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/patch.go b/vendor/github.com/oracle/oci-go-sdk/database/patch.go new file mode 100644 index 0000000000..7ed8a33980 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/patch.go @@ -0,0 +1,122 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Patch A Patch for a DB System or DB Home. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Patch struct { + + // The text describing this patch package. + Description *string `mandatory:"true" json:"description"` + + // The OCID of the patch. + Id *string `mandatory:"true" json:"id"` + + // The date and time that the patch was released. + TimeReleased *common.SDKTime `mandatory:"true" json:"timeReleased"` + + // The version of this patch package. + Version *string `mandatory:"true" json:"version"` + + // Actions that can possibly be performed using this patch. + AvailableActions []PatchAvailableActionsEnum `mandatory:"false" json:"availableActions,omitempty"` + + // Action that is currently being performed or was completed last. + LastAction PatchLastActionEnum `mandatory:"false" json:"lastAction,omitempty"` + + // A descriptive text associated with the lifecycleState. + // Typically can contain additional displayable text. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The current state of the patch as a result of lastAction. + LifecycleState PatchLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` +} + +func (m Patch) String() string { + return common.PointerString(m) +} + +// PatchAvailableActionsEnum Enum with underlying type: string +type PatchAvailableActionsEnum string + +// Set of constants representing the allowable values for PatchAvailableActions +const ( + PatchAvailableActionsApply PatchAvailableActionsEnum = "APPLY" + PatchAvailableActionsPrecheck PatchAvailableActionsEnum = "PRECHECK" +) + +var mappingPatchAvailableActions = map[string]PatchAvailableActionsEnum{ + "APPLY": PatchAvailableActionsApply, + "PRECHECK": PatchAvailableActionsPrecheck, +} + +// GetPatchAvailableActionsEnumValues Enumerates the set of values for PatchAvailableActions +func GetPatchAvailableActionsEnumValues() []PatchAvailableActionsEnum { + values := make([]PatchAvailableActionsEnum, 0) + for _, v := range mappingPatchAvailableActions { + values = append(values, v) + } + return values +} + +// PatchLastActionEnum Enum with underlying type: string +type PatchLastActionEnum string + +// Set of constants representing the allowable values for PatchLastAction +const ( + PatchLastActionApply PatchLastActionEnum = "APPLY" + PatchLastActionPrecheck PatchLastActionEnum = "PRECHECK" +) + +var mappingPatchLastAction = map[string]PatchLastActionEnum{ + "APPLY": PatchLastActionApply, + "PRECHECK": PatchLastActionPrecheck, +} + +// GetPatchLastActionEnumValues Enumerates the set of values for PatchLastAction +func GetPatchLastActionEnumValues() []PatchLastActionEnum { + values := make([]PatchLastActionEnum, 0) + for _, v := range mappingPatchLastAction { + values = append(values, v) + } + return values +} + +// PatchLifecycleStateEnum Enum with underlying type: string +type PatchLifecycleStateEnum string + +// Set of constants representing the allowable values for PatchLifecycleState +const ( + PatchLifecycleStateAvailable PatchLifecycleStateEnum = "AVAILABLE" + PatchLifecycleStateSuccess PatchLifecycleStateEnum = "SUCCESS" + PatchLifecycleStateInProgress PatchLifecycleStateEnum = "IN_PROGRESS" + PatchLifecycleStateFailed PatchLifecycleStateEnum = "FAILED" +) + +var mappingPatchLifecycleState = map[string]PatchLifecycleStateEnum{ + "AVAILABLE": PatchLifecycleStateAvailable, + "SUCCESS": PatchLifecycleStateSuccess, + "IN_PROGRESS": PatchLifecycleStateInProgress, + "FAILED": PatchLifecycleStateFailed, +} + +// GetPatchLifecycleStateEnumValues Enumerates the set of values for PatchLifecycleState +func GetPatchLifecycleStateEnumValues() []PatchLifecycleStateEnum { + values := make([]PatchLifecycleStateEnum, 0) + for _, v := range mappingPatchLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/patch_details.go b/vendor/github.com/oracle/oci-go-sdk/database/patch_details.go new file mode 100644 index 0000000000..1dab6a67a8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/patch_details.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// PatchDetails The details about what actions to perform and using what patch to the specified target. +// This is part of an update request that is applied to a version field on the target such +// as DB System, database home, etc. +type PatchDetails struct { + + // The action to perform on the patch. + Action PatchDetailsActionEnum `mandatory:"false" json:"action,omitempty"` + + // The OCID of the patch. + PatchId *string `mandatory:"false" json:"patchId"` +} + +func (m PatchDetails) String() string { + return common.PointerString(m) +} + +// PatchDetailsActionEnum Enum with underlying type: string +type PatchDetailsActionEnum string + +// Set of constants representing the allowable values for PatchDetailsAction +const ( + PatchDetailsActionApply PatchDetailsActionEnum = "APPLY" + PatchDetailsActionPrecheck PatchDetailsActionEnum = "PRECHECK" +) + +var mappingPatchDetailsAction = map[string]PatchDetailsActionEnum{ + "APPLY": PatchDetailsActionApply, + "PRECHECK": PatchDetailsActionPrecheck, +} + +// GetPatchDetailsActionEnumValues Enumerates the set of values for PatchDetailsAction +func GetPatchDetailsActionEnumValues() []PatchDetailsActionEnum { + values := make([]PatchDetailsActionEnum, 0) + for _, v := range mappingPatchDetailsAction { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/patch_history_entry.go b/vendor/github.com/oracle/oci-go-sdk/database/patch_history_entry.go new file mode 100644 index 0000000000..21fa02767e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/patch_history_entry.go @@ -0,0 +1,91 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// PatchHistoryEntry The record of a patch action on a specified target. +type PatchHistoryEntry struct { + + // The OCID of the patch history entry. + Id *string `mandatory:"true" json:"id"` + + // The current state of the action. + LifecycleState PatchHistoryEntryLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID of the patch. + PatchId *string `mandatory:"true" json:"patchId"` + + // The date and time when the patch action started. + TimeStarted *common.SDKTime `mandatory:"true" json:"timeStarted"` + + // The action being performed or was completed. + Action PatchHistoryEntryActionEnum `mandatory:"false" json:"action,omitempty"` + + // A descriptive text associated with the lifecycleState. + // Typically contains additional displayable text. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The date and time when the patch action completed. + TimeEnded *common.SDKTime `mandatory:"false" json:"timeEnded"` +} + +func (m PatchHistoryEntry) String() string { + return common.PointerString(m) +} + +// PatchHistoryEntryActionEnum Enum with underlying type: string +type PatchHistoryEntryActionEnum string + +// Set of constants representing the allowable values for PatchHistoryEntryAction +const ( + PatchHistoryEntryActionApply PatchHistoryEntryActionEnum = "APPLY" + PatchHistoryEntryActionPrecheck PatchHistoryEntryActionEnum = "PRECHECK" +) + +var mappingPatchHistoryEntryAction = map[string]PatchHistoryEntryActionEnum{ + "APPLY": PatchHistoryEntryActionApply, + "PRECHECK": PatchHistoryEntryActionPrecheck, +} + +// GetPatchHistoryEntryActionEnumValues Enumerates the set of values for PatchHistoryEntryAction +func GetPatchHistoryEntryActionEnumValues() []PatchHistoryEntryActionEnum { + values := make([]PatchHistoryEntryActionEnum, 0) + for _, v := range mappingPatchHistoryEntryAction { + values = append(values, v) + } + return values +} + +// PatchHistoryEntryLifecycleStateEnum Enum with underlying type: string +type PatchHistoryEntryLifecycleStateEnum string + +// Set of constants representing the allowable values for PatchHistoryEntryLifecycleState +const ( + PatchHistoryEntryLifecycleStateInProgress PatchHistoryEntryLifecycleStateEnum = "IN_PROGRESS" + PatchHistoryEntryLifecycleStateSucceeded PatchHistoryEntryLifecycleStateEnum = "SUCCEEDED" + PatchHistoryEntryLifecycleStateFailed PatchHistoryEntryLifecycleStateEnum = "FAILED" +) + +var mappingPatchHistoryEntryLifecycleState = map[string]PatchHistoryEntryLifecycleStateEnum{ + "IN_PROGRESS": PatchHistoryEntryLifecycleStateInProgress, + "SUCCEEDED": PatchHistoryEntryLifecycleStateSucceeded, + "FAILED": PatchHistoryEntryLifecycleStateFailed, +} + +// GetPatchHistoryEntryLifecycleStateEnumValues Enumerates the set of values for PatchHistoryEntryLifecycleState +func GetPatchHistoryEntryLifecycleStateEnumValues() []PatchHistoryEntryLifecycleStateEnum { + values := make([]PatchHistoryEntryLifecycleStateEnum, 0) + for _, v := range mappingPatchHistoryEntryLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/patch_history_entry_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/patch_history_entry_summary.go new file mode 100644 index 0000000000..ddb964f933 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/patch_history_entry_summary.go @@ -0,0 +1,91 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// PatchHistoryEntrySummary The record of a patch action on a specified target. +type PatchHistoryEntrySummary struct { + + // The OCID of the patch history entry. + Id *string `mandatory:"true" json:"id"` + + // The current state of the action. + LifecycleState PatchHistoryEntrySummaryLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID of the patch. + PatchId *string `mandatory:"true" json:"patchId"` + + // The date and time when the patch action started. + TimeStarted *common.SDKTime `mandatory:"true" json:"timeStarted"` + + // The action being performed or was completed. + Action PatchHistoryEntrySummaryActionEnum `mandatory:"false" json:"action,omitempty"` + + // A descriptive text associated with the lifecycleState. + // Typically contains additional displayable text. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The date and time when the patch action completed. + TimeEnded *common.SDKTime `mandatory:"false" json:"timeEnded"` +} + +func (m PatchHistoryEntrySummary) String() string { + return common.PointerString(m) +} + +// PatchHistoryEntrySummaryActionEnum Enum with underlying type: string +type PatchHistoryEntrySummaryActionEnum string + +// Set of constants representing the allowable values for PatchHistoryEntrySummaryAction +const ( + PatchHistoryEntrySummaryActionApply PatchHistoryEntrySummaryActionEnum = "APPLY" + PatchHistoryEntrySummaryActionPrecheck PatchHistoryEntrySummaryActionEnum = "PRECHECK" +) + +var mappingPatchHistoryEntrySummaryAction = map[string]PatchHistoryEntrySummaryActionEnum{ + "APPLY": PatchHistoryEntrySummaryActionApply, + "PRECHECK": PatchHistoryEntrySummaryActionPrecheck, +} + +// GetPatchHistoryEntrySummaryActionEnumValues Enumerates the set of values for PatchHistoryEntrySummaryAction +func GetPatchHistoryEntrySummaryActionEnumValues() []PatchHistoryEntrySummaryActionEnum { + values := make([]PatchHistoryEntrySummaryActionEnum, 0) + for _, v := range mappingPatchHistoryEntrySummaryAction { + values = append(values, v) + } + return values +} + +// PatchHistoryEntrySummaryLifecycleStateEnum Enum with underlying type: string +type PatchHistoryEntrySummaryLifecycleStateEnum string + +// Set of constants representing the allowable values for PatchHistoryEntrySummaryLifecycleState +const ( + PatchHistoryEntrySummaryLifecycleStateInProgress PatchHistoryEntrySummaryLifecycleStateEnum = "IN_PROGRESS" + PatchHistoryEntrySummaryLifecycleStateSucceeded PatchHistoryEntrySummaryLifecycleStateEnum = "SUCCEEDED" + PatchHistoryEntrySummaryLifecycleStateFailed PatchHistoryEntrySummaryLifecycleStateEnum = "FAILED" +) + +var mappingPatchHistoryEntrySummaryLifecycleState = map[string]PatchHistoryEntrySummaryLifecycleStateEnum{ + "IN_PROGRESS": PatchHistoryEntrySummaryLifecycleStateInProgress, + "SUCCEEDED": PatchHistoryEntrySummaryLifecycleStateSucceeded, + "FAILED": PatchHistoryEntrySummaryLifecycleStateFailed, +} + +// GetPatchHistoryEntrySummaryLifecycleStateEnumValues Enumerates the set of values for PatchHistoryEntrySummaryLifecycleState +func GetPatchHistoryEntrySummaryLifecycleStateEnumValues() []PatchHistoryEntrySummaryLifecycleStateEnum { + values := make([]PatchHistoryEntrySummaryLifecycleStateEnum, 0) + for _, v := range mappingPatchHistoryEntrySummaryLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/patch_summary.go b/vendor/github.com/oracle/oci-go-sdk/database/patch_summary.go new file mode 100644 index 0000000000..e803c53fbd --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/patch_summary.go @@ -0,0 +1,122 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// PatchSummary A Patch for a DB System or DB Home. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type PatchSummary struct { + + // The text describing this patch package. + Description *string `mandatory:"true" json:"description"` + + // The OCID of the patch. + Id *string `mandatory:"true" json:"id"` + + // The date and time that the patch was released. + TimeReleased *common.SDKTime `mandatory:"true" json:"timeReleased"` + + // The version of this patch package. + Version *string `mandatory:"true" json:"version"` + + // Actions that can possibly be performed using this patch. + AvailableActions []PatchSummaryAvailableActionsEnum `mandatory:"false" json:"availableActions,omitempty"` + + // Action that is currently being performed or was completed last. + LastAction PatchSummaryLastActionEnum `mandatory:"false" json:"lastAction,omitempty"` + + // A descriptive text associated with the lifecycleState. + // Typically can contain additional displayable text. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The current state of the patch as a result of lastAction. + LifecycleState PatchSummaryLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` +} + +func (m PatchSummary) String() string { + return common.PointerString(m) +} + +// PatchSummaryAvailableActionsEnum Enum with underlying type: string +type PatchSummaryAvailableActionsEnum string + +// Set of constants representing the allowable values for PatchSummaryAvailableActions +const ( + PatchSummaryAvailableActionsApply PatchSummaryAvailableActionsEnum = "APPLY" + PatchSummaryAvailableActionsPrecheck PatchSummaryAvailableActionsEnum = "PRECHECK" +) + +var mappingPatchSummaryAvailableActions = map[string]PatchSummaryAvailableActionsEnum{ + "APPLY": PatchSummaryAvailableActionsApply, + "PRECHECK": PatchSummaryAvailableActionsPrecheck, +} + +// GetPatchSummaryAvailableActionsEnumValues Enumerates the set of values for PatchSummaryAvailableActions +func GetPatchSummaryAvailableActionsEnumValues() []PatchSummaryAvailableActionsEnum { + values := make([]PatchSummaryAvailableActionsEnum, 0) + for _, v := range mappingPatchSummaryAvailableActions { + values = append(values, v) + } + return values +} + +// PatchSummaryLastActionEnum Enum with underlying type: string +type PatchSummaryLastActionEnum string + +// Set of constants representing the allowable values for PatchSummaryLastAction +const ( + PatchSummaryLastActionApply PatchSummaryLastActionEnum = "APPLY" + PatchSummaryLastActionPrecheck PatchSummaryLastActionEnum = "PRECHECK" +) + +var mappingPatchSummaryLastAction = map[string]PatchSummaryLastActionEnum{ + "APPLY": PatchSummaryLastActionApply, + "PRECHECK": PatchSummaryLastActionPrecheck, +} + +// GetPatchSummaryLastActionEnumValues Enumerates the set of values for PatchSummaryLastAction +func GetPatchSummaryLastActionEnumValues() []PatchSummaryLastActionEnum { + values := make([]PatchSummaryLastActionEnum, 0) + for _, v := range mappingPatchSummaryLastAction { + values = append(values, v) + } + return values +} + +// PatchSummaryLifecycleStateEnum Enum with underlying type: string +type PatchSummaryLifecycleStateEnum string + +// Set of constants representing the allowable values for PatchSummaryLifecycleState +const ( + PatchSummaryLifecycleStateAvailable PatchSummaryLifecycleStateEnum = "AVAILABLE" + PatchSummaryLifecycleStateSuccess PatchSummaryLifecycleStateEnum = "SUCCESS" + PatchSummaryLifecycleStateInProgress PatchSummaryLifecycleStateEnum = "IN_PROGRESS" + PatchSummaryLifecycleStateFailed PatchSummaryLifecycleStateEnum = "FAILED" +) + +var mappingPatchSummaryLifecycleState = map[string]PatchSummaryLifecycleStateEnum{ + "AVAILABLE": PatchSummaryLifecycleStateAvailable, + "SUCCESS": PatchSummaryLifecycleStateSuccess, + "IN_PROGRESS": PatchSummaryLifecycleStateInProgress, + "FAILED": PatchSummaryLifecycleStateFailed, +} + +// GetPatchSummaryLifecycleStateEnumValues Enumerates the set of values for PatchSummaryLifecycleState +func GetPatchSummaryLifecycleStateEnumValues() []PatchSummaryLifecycleStateEnum { + values := make([]PatchSummaryLifecycleStateEnum, 0) + for _, v := range mappingPatchSummaryLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/reinstate_data_guard_association_details.go b/vendor/github.com/oracle/oci-go-sdk/database/reinstate_data_guard_association_details.go new file mode 100644 index 0000000000..b348fafb94 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/reinstate_data_guard_association_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// ReinstateDataGuardAssociationDetails The Data Guard association reinstate parameters. +type ReinstateDataGuardAssociationDetails struct { + + // The DB System administrator password. + DatabaseAdminPassword *string `mandatory:"true" json:"databaseAdminPassword"` +} + +func (m ReinstateDataGuardAssociationDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/reinstate_data_guard_association_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/reinstate_data_guard_association_request_response.go new file mode 100644 index 0000000000..994fdb3c2b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/reinstate_data_guard_association_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ReinstateDataGuardAssociationRequest wrapper for the ReinstateDataGuardAssociation operation +type ReinstateDataGuardAssociationRequest struct { + + // The database OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DatabaseId *string `mandatory:"true" contributesTo:"path" name:"databaseId"` + + // The Data Guard association's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DataGuardAssociationId *string `mandatory:"true" contributesTo:"path" name:"dataGuardAssociationId"` + + // A request to reinstate a database in a standby role. + ReinstateDataGuardAssociationDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request ReinstateDataGuardAssociationRequest) String() string { + return common.PointerString(request) +} + +// ReinstateDataGuardAssociationResponse wrapper for the ReinstateDataGuardAssociation operation +type ReinstateDataGuardAssociationResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DataGuardAssociation instance + DataGuardAssociation `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ReinstateDataGuardAssociationResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/restore_database_details.go b/vendor/github.com/oracle/oci-go-sdk/database/restore_database_details.go new file mode 100644 index 0000000000..4322a35ad1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/restore_database_details.go @@ -0,0 +1,30 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// RestoreDatabaseDetails The representation of RestoreDatabaseDetails +type RestoreDatabaseDetails struct { + + // Restores using the backup with the System Change Number (SCN) specified. + DatabaseSCN *string `mandatory:"false" json:"databaseSCN"` + + // Restores to the last known good state with the least possible data loss. + Latest *bool `mandatory:"false" json:"latest"` + + // Restores to the timestamp specified. + Timestamp *common.SDKTime `mandatory:"false" json:"timestamp"` +} + +func (m RestoreDatabaseDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/restore_database_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/restore_database_request_response.go new file mode 100644 index 0000000000..19873c9238 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/restore_database_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// RestoreDatabaseRequest wrapper for the RestoreDatabase operation +type RestoreDatabaseRequest struct { + + // The database OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DatabaseId *string `mandatory:"true" contributesTo:"path" name:"databaseId"` + + // Request to perform database restore. + RestoreDatabaseDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request RestoreDatabaseRequest) String() string { + return common.PointerString(request) +} + +// RestoreDatabaseResponse wrapper for the RestoreDatabase operation +type RestoreDatabaseResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Database instance + Database `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response RestoreDatabaseResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/switchover_data_guard_association_details.go b/vendor/github.com/oracle/oci-go-sdk/database/switchover_data_guard_association_details.go new file mode 100644 index 0000000000..0877059238 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/switchover_data_guard_association_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// SwitchoverDataGuardAssociationDetails The Data Guard association switchover parameters. +type SwitchoverDataGuardAssociationDetails struct { + + // The DB System administrator password. + DatabaseAdminPassword *string `mandatory:"true" json:"databaseAdminPassword"` +} + +func (m SwitchoverDataGuardAssociationDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/switchover_data_guard_association_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/switchover_data_guard_association_request_response.go new file mode 100644 index 0000000000..0e30247153 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/switchover_data_guard_association_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// SwitchoverDataGuardAssociationRequest wrapper for the SwitchoverDataGuardAssociation operation +type SwitchoverDataGuardAssociationRequest struct { + + // The database OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DatabaseId *string `mandatory:"true" contributesTo:"path" name:"databaseId"` + + // The Data Guard association's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DataGuardAssociationId *string `mandatory:"true" contributesTo:"path" name:"dataGuardAssociationId"` + + // Request to swtichover a primary to a standby. + SwitchoverDataGuardAssociationDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request SwitchoverDataGuardAssociationRequest) String() string { + return common.PointerString(request) +} + +// SwitchoverDataGuardAssociationResponse wrapper for the SwitchoverDataGuardAssociation operation +type SwitchoverDataGuardAssociationResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DataGuardAssociation instance + DataGuardAssociation `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response SwitchoverDataGuardAssociationResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/terminate_db_system_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/terminate_db_system_request_response.go new file mode 100644 index 0000000000..991b68b0f8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/terminate_db_system_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// TerminateDbSystemRequest wrapper for the TerminateDbSystem operation +type TerminateDbSystemRequest struct { + + // The DB System OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbSystemId *string `mandatory:"true" contributesTo:"path" name:"dbSystemId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request TerminateDbSystemRequest) String() string { + return common.PointerString(request) +} + +// TerminateDbSystemResponse wrapper for the TerminateDbSystem operation +type TerminateDbSystemResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response TerminateDbSystemResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/update_database_details.go b/vendor/github.com/oracle/oci-go-sdk/database/update_database_details.go new file mode 100644 index 0000000000..2d436d6d6c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/update_database_details.go @@ -0,0 +1,22 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateDatabaseDetails The representation of UpdateDatabaseDetails +type UpdateDatabaseDetails struct { + DbBackupConfig *DbBackupConfig `mandatory:"false" json:"dbBackupConfig"` +} + +func (m UpdateDatabaseDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/update_database_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/update_database_request_response.go new file mode 100644 index 0000000000..c438676031 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/update_database_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateDatabaseRequest wrapper for the UpdateDatabase operation +type UpdateDatabaseRequest struct { + + // The database OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DatabaseId *string `mandatory:"true" contributesTo:"path" name:"databaseId"` + + // Request to perform database update. + UpdateDatabaseDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateDatabaseRequest) String() string { + return common.PointerString(request) +} + +// UpdateDatabaseResponse wrapper for the UpdateDatabase operation +type UpdateDatabaseResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Database instance + Database `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateDatabaseResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/update_db_home_details.go b/vendor/github.com/oracle/oci-go-sdk/database/update_db_home_details.go new file mode 100644 index 0000000000..741a7e36f6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/update_db_home_details.go @@ -0,0 +1,22 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateDbHomeDetails Describes the modification parameters for the DB Home. +type UpdateDbHomeDetails struct { + DbVersion *PatchDetails `mandatory:"false" json:"dbVersion"` +} + +func (m UpdateDbHomeDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/update_db_home_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/update_db_home_request_response.go new file mode 100644 index 0000000000..b02cd0fb8e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/update_db_home_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateDbHomeRequest wrapper for the UpdateDbHome operation +type UpdateDbHomeRequest struct { + + // The database home OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbHomeId *string `mandatory:"true" contributesTo:"path" name:"dbHomeId"` + + // Request to update the properties of a DB Home. + UpdateDbHomeDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateDbHomeRequest) String() string { + return common.PointerString(request) +} + +// UpdateDbHomeResponse wrapper for the UpdateDbHome operation +type UpdateDbHomeResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DbHome instance + DbHome `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateDbHomeResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/update_db_system_details.go b/vendor/github.com/oracle/oci-go-sdk/database/update_db_system_details.go new file mode 100644 index 0000000000..eb03d5d10b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/update_db_system_details.go @@ -0,0 +1,32 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Database Service API +// +// The API for the Database Service. +// + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateDbSystemDetails Describes the modification parameters for the DB System. +type UpdateDbSystemDetails struct { + + // The number of CPU Cores to be set on the DB System. Applicable only for non-VM based DB systems. + CpuCoreCount *int `mandatory:"false" json:"cpuCoreCount"` + + // Size, in GBs, to which the currently attached storage needs to be scaled up to for VM based DB system. This must be greater than current storage size. Note that the total storage size attached will be more than what is requested, to account for REDO/RECO space and software volume. + DataStorageSizeInGBs *int `mandatory:"false" json:"dataStorageSizeInGBs"` + + // The public key portion of the key pair to use for SSH access to the DB System. Multiple public keys can be provided. The length of the combined keys cannot exceed 10,000 characters. + SshPublicKeys []string `mandatory:"false" json:"sshPublicKeys"` + + Version *PatchDetails `mandatory:"false" json:"version"` +} + +func (m UpdateDbSystemDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/database/update_db_system_request_response.go b/vendor/github.com/oracle/oci-go-sdk/database/update_db_system_request_response.go new file mode 100644 index 0000000000..d9cd0493e9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/database/update_db_system_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package database + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateDbSystemRequest wrapper for the UpdateDbSystem operation +type UpdateDbSystemRequest struct { + + // The DB System OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + DbSystemId *string `mandatory:"true" contributesTo:"path" name:"dbSystemId"` + + // Request to update the properties of a DB System. + UpdateDbSystemDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateDbSystemRequest) String() string { + return common.PointerString(request) +} + +// UpdateDbSystemResponse wrapper for the UpdateDbSystem operation +type UpdateDbSystemResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DbSystem instance + DbSystem `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateDbSystemResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/example_audit_test.go b/vendor/github.com/oracle/oci-go-sdk/example/example_audit_test.go new file mode 100644 index 0000000000..5b83bdd7f5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/example_audit_test.go @@ -0,0 +1,36 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Example code for Audit API +// +package example + +import ( + "context" + "fmt" + "time" + + "github.com/oracle/oci-go-sdk/audit" + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/example/helpers" +) + +func ExampleListEvents() { + c, clerr := audit.NewAuditClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(clerr) + + // list events for last 5 hour + req := audit.ListEventsRequest{ + CompartmentId: helpers.CompartmentID(), + StartTime: &common.SDKTime{time.Now().Add(time.Hour * -5)}, + EndTime: &common.SDKTime{time.Now()}, + } + + _, err := c.ListEvents(context.Background(), req) + helpers.LogIfError(err) + + //log.Printf("events returned back: %v", resp.Items) + fmt.Println("list events completed") + + // Output: + // list events completed +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/example_core_pagination_test.go b/vendor/github.com/oracle/oci-go-sdk/example/example_core_pagination_test.go new file mode 100644 index 0000000000..2e7df409c1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/example_core_pagination_test.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Example code for Core Services API +// +package example + +import ( + "context" + "fmt" + "log" + + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/core" + "github.com/oracle/oci-go-sdk/example/helpers" +) + +// ExampleListShapes_Pagination demostrate how to use page parameter +func ExampleListShapes_Pagination() { + c, err := core.NewComputeClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(err) + + request := core.ListShapesRequest{ + CompartmentId: helpers.CompartmentID(), + } + + // to show how pagination works, reduce number of items to return in a paginated "List" call + request.Limit = common.Int(2) + + listShapesFunc := func(request core.ListShapesRequest) (core.ListShapesResponse, error) { + return c.ListShapes(context.Background(), request) + } + + for r, err := listShapesFunc(request); ; r, err = listShapesFunc(request) { + helpers.LogIfError(err) + + log.Printf("list shapes returns: %v", r.Items) + + if r.OpcNextPage != nil { + // if there are more items in next page, fetch items from next page + request.Page = r.OpcNextPage + } else { + // no more result, break the loop + break + } + } + + fmt.Println("list shapes completed") + + // Output: + // list shapes completed +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/example_core_test.go b/vendor/github.com/oracle/oci-go-sdk/example/example_core_test.go new file mode 100644 index 0000000000..4f28be3080 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/example_core_test.go @@ -0,0 +1,429 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Example code for Core Services API +// + +package example + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/core" + "github.com/oracle/oci-go-sdk/example/helpers" +) + +const ( + vcnDisplayName = "OCI-GOSDK-Sample-VCN" + subnetDisplayName1 = "OCI-GOSDK-Sample-Subnet1" + subnetDisplayName2 = "OCI-GOSDK-Sample-Subnet2" + + // replace following variables with your instance info + // this is used by ExampleCreateImageDetails_Polymorphic + objectStorageURIWtihImage = "[The Object Storage URL for the image which will be used to create an image.]" +) + +// ExampleLaunchInstance does create an instance +// NOTE: launch instance will create a new instance and VCN. please make sure delete the instance +// after execute this sample code, otherwise, you will be charged for the running instance +func ExampleLaunchInstance() { + c, err := core.NewComputeClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(err) + ctx := context.Background() + + // create the launch instance request + request := core.LaunchInstanceRequest{} + request.CompartmentId = helpers.CompartmentID() + request.DisplayName = common.String("OCI-Sample-Instance") + request.AvailabilityDomain = helpers.AvailabilityDomain() + + // create a subnet or get the one already created + subnet := CreateOrGetSubnet() + fmt.Println("subnet created") + request.SubnetId = subnet.Id + + // get a image + image := listImages(ctx, c)[0] + fmt.Println("list images") + request.ImageId = image.Id + + // get all the shapes and filter the list by compatibility with the image + shapes := listShapes(ctx, c, request.ImageId) + fmt.Println("list shapes") + request.Shape = shapes[0].Shape + + createResp, err := c.LaunchInstance(ctx, request) + helpers.LogIfError(err) + fmt.Println("instance created") + + // get new created instance + getInstance := func() (interface{}, error) { + request := core.GetInstanceRequest{ + InstanceId: createResp.Instance.Id, + } + + readResp, err := c.GetInstance(ctx, request) + + if err != nil { + return nil, err + } + + return readResp, err + } + + // wait for instance lifecyle become running + helpers.LogIfError( + helpers.RetryUntilTrueOrError( + getInstance, + helpers.CheckLifecycleState(string(core.InstanceLifecycleStateRunning)), + time.Tick(10*time.Second), + time.After((5 * time.Minute)))) + + defer func() { + terminateInstance(ctx, c, createResp.Id) + + client, clerr := core.NewVirtualNetworkClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(clerr) + + vcnID := subnet.VcnId + deleteSubnet(ctx, client, subnet.Id) + deleteVcn(ctx, client, vcnID) + }() + + // Output: + // subnet created + // list images + // list shapes + // instance created + // terminating instance + // instance terminated + // deleteing subnet + // subnet deleted + // deleteing VCN + // VCN deleted +} + +// ExampleCreateImageDetails_Polymorphic creates a boot disk image for the specified instance or +// imports an exported image from the Oracle Cloud Infrastructure Object Storage service. +func ExampleCreateImageDetails_Polymorphic() { + request := core.CreateImageRequest{} + request.CompartmentId = helpers.CompartmentID() + + // you can import an image based on the Object Storage URL 'core.ImageSourceViaObjectStorageUriDetails' + // or based on the namespace, bucket name and object name 'core.ImageSourceViaObjectStorageTupleDetails' + // following example shows how to import image from object storage uri, you can use another one: + // request.ImageSourceDetails = core.ImageSourceViaObjectStorageTupleDetails + sourceDetails := core.ImageSourceViaObjectStorageUriDetails{} + sourceDetails.SourceUri = common.String(objectStorageURIWtihImage) + + request.ImageSourceDetails = sourceDetails + + c, err := core.NewComputeClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(err) + + _, err = c.CreateImage(context.Background(), request) + helpers.LogIfError(err) + fmt.Println("image created") +} + +// CreateOrGetVcn either creates a new Virtual Cloud Network (VCN) or get the one already exist +func CreateOrGetVcn() core.Vcn { + c, clerr := core.NewVirtualNetworkClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(clerr) + ctx := context.Background() + + vcnItems := listVcns(ctx, c) + + for _, element := range vcnItems { + if *element.DisplayName == vcnDisplayName { + // VCN already created, return it + return element + } + } + + // create a new VCN + request := core.CreateVcnRequest{} + request.CidrBlock = common.String("10.0.0.0/16") + request.CompartmentId = helpers.CompartmentID() + request.DisplayName = common.String(vcnDisplayName) + request.DnsLabel = common.String("vcndns") + + r, err := c.CreateVcn(ctx, request) + helpers.LogIfError(err) + return r.Vcn +} + +// CreateSubnet creates a new subnet or get the one already exist +func CreateOrGetSubnet() core.Subnet { + return CreateOrGetSubnetWithDetails( + common.String(subnetDisplayName1), + common.String("10.0.0.0/24"), + common.String("subnetdns1"), + helpers.AvailabilityDomain()) +} + +// CreateOrGetSubnetWithDetails either creates a new Virtual Cloud Network (VCN) or get the one already exist +// with detail info +func CreateOrGetSubnetWithDetails(displayName *string, cidrBlock *string, dnsLabel *string, availableDomain *string) core.Subnet { + c, clerr := core.NewVirtualNetworkClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(clerr) + ctx := context.Background() + + subnets := listSubnets(ctx, c) + + if displayName == nil { + displayName = common.String(subnetDisplayName1) + } + + // check if the subnet has already been created + for _, element := range subnets { + if *element.DisplayName == *displayName { + // find the subnet, return it + return element + } + } + + // create a new subnet + request := core.CreateSubnetRequest{} + request.AvailabilityDomain = availableDomain + request.CompartmentId = helpers.CompartmentID() + request.CidrBlock = cidrBlock + request.DisplayName = displayName + request.DnsLabel = dnsLabel + + vcn := CreateOrGetVcn() + request.VcnId = vcn.Id + + r, err := c.CreateSubnet(ctx, request) + helpers.LogIfError(err) + + getSubnet := func() (interface{}, error) { + getReq := core.GetSubnetRequest{ + SubnetId: r.Id, + } + + getResp, err := c.GetSubnet(ctx, getReq) + + if err != nil { + return nil, err + } + + return getResp, nil + } + + // wait for lifecyle become running + helpers.LogIfError( + helpers.RetryUntilTrueOrError( + getSubnet, + helpers.CheckLifecycleState(string(core.SubnetLifecycleStateAvailable)), + time.Tick(10*time.Second), + time.After((5 * time.Minute)))) + + // update the security rules + getReq := core.GetSecurityListRequest{ + SecurityListId: common.String(r.SecurityListIds[0]), + } + + getResp, err := c.GetSecurityList(ctx, getReq) + helpers.LogIfError(err) + + // this security rule allows remote control the instance + portRange := core.PortRange{ + Max: common.Int(1521), + Min: common.Int(1521), + } + + newRules := append(getResp.IngressSecurityRules, core.IngressSecurityRule{ + Protocol: common.String("6"), // TCP + Source: common.String("0.0.0.0/0"), + TcpOptions: &core.TcpOptions{ + DestinationPortRange: &portRange, + }, + }) + + updateReq := core.UpdateSecurityListRequest{ + SecurityListId: common.String(r.SecurityListIds[0]), + } + + updateReq.IngressSecurityRules = newRules + + _, err = c.UpdateSecurityList(ctx, updateReq) + helpers.LogIfError(err) + + return r.Subnet +} + +func listVcns(ctx context.Context, c core.VirtualNetworkClient) []core.Vcn { + request := core.ListVcnsRequest{ + CompartmentId: helpers.CompartmentID(), + } + + r, err := c.ListVcns(ctx, request) + helpers.LogIfError(err) + return r.Items +} + +func listSubnets(ctx context.Context, c core.VirtualNetworkClient) []core.Subnet { + vcn := CreateOrGetVcn() + + request := core.ListSubnetsRequest{ + CompartmentId: helpers.CompartmentID(), + VcnId: vcn.Id, + } + + r, err := c.ListSubnets(ctx, request) + helpers.LogIfError(err) + return r.Items +} + +// ListImages lists the available images in the specified compartment. +func listImages(ctx context.Context, c core.ComputeClient) []core.Image { + request := core.ListImagesRequest{ + CompartmentId: helpers.CompartmentID(), + } + + r, err := c.ListImages(ctx, request) + helpers.LogIfError(err) + + return r.Items +} + +// ListShapes Lists the shapes that can be used to launch an instance within the specified compartment. +func listShapes(ctx context.Context, c core.ComputeClient, imageID *string) []core.Shape { + request := core.ListShapesRequest{ + CompartmentId: helpers.CompartmentID(), + ImageId: imageID, + } + + r, err := c.ListShapes(ctx, request) + helpers.LogIfError(err) + + if r.Items == nil || len(r.Items) == 0 { + log.Fatalln("Invalid response from ListShapes") + } + + return r.Items +} + +func terminateInstance(ctx context.Context, c core.ComputeClient, id *string) { + request := core.TerminateInstanceRequest{ + InstanceId: id, + } + + _, err := c.TerminateInstance(ctx, request) + helpers.LogIfError(err) + + fmt.Println("terminating instance") + + // get new created instance + getInstance := func() (interface{}, error) { + request := core.GetInstanceRequest{ + InstanceId: id, + } + + readResp, err := c.GetInstance(ctx, request) + + if err != nil { + if readResp.RawResponse.StatusCode == 404 { + // cannot find resources which means it's been deleted + return core.Instance{LifecycleState: core.InstanceLifecycleStateTerminated}, nil + } + return nil, err + } + + return readResp, err + } + + // wait for instance lifecyle become terminated + helpers.LogIfError( + helpers.RetryUntilTrueOrError( + getInstance, + helpers.CheckLifecycleState(string(core.InstanceLifecycleStateTerminated)), + time.Tick(10*time.Second), + time.After((5 * time.Minute)))) + + fmt.Println("instance terminated") + +} + +func deleteVcn(ctx context.Context, c core.VirtualNetworkClient, id *string) { + request := core.DeleteVcnRequest{ + VcnId: id, + } + + fmt.Println("deleteing VCN") + _, err := c.DeleteVcn(ctx, request) + helpers.LogIfError(err) + + getVcn := func() (interface{}, error) { + getReq := core.GetVcnRequest{ + VcnId: id, + } + + getResp, err := c.GetVcn(ctx, getReq) + + if err != nil { + if getResp.RawResponse.StatusCode == 404 { + // resource cannot found which means it's been deleted in this case + return core.Vcn{LifecycleState: core.VcnLifecycleStateTerminated}, nil + } + + return nil, err + } + + return getResp, nil + } + + // wait for lifecyle become terminated + helpers.LogIfError( + helpers.RetryUntilTrueOrError( + getVcn, + helpers.CheckLifecycleState(string(core.VcnLifecycleStateTerminated)), + time.Tick(10*time.Second), + time.After((5 * time.Minute)))) + + fmt.Println("VCN deleted") +} + +func deleteSubnet(ctx context.Context, c core.VirtualNetworkClient, id *string) { + request := core.DeleteSubnetRequest{ + SubnetId: id, + } + + _, err := c.DeleteSubnet(context.Background(), request) + helpers.LogIfError(err) + + fmt.Println("deleteing subnet") + + getSubnet := func() (interface{}, error) { + getReq := core.GetSubnetRequest{ + SubnetId: id, + } + + getResp, err := c.GetSubnet(ctx, getReq) + + if err != nil { + if getResp.RawResponse.StatusCode == 404 { + // resource cannot found which means it's been deleted in this case + return core.Subnet{LifecycleState: core.SubnetLifecycleStateTerminated}, nil + } + + return nil, err + } + + return getResp, nil + } + + // wait for lifecyle become terminated + helpers.LogIfError( + helpers.RetryUntilTrueOrError( + getSubnet, + helpers.CheckLifecycleState(string(core.SubnetLifecycleStateTerminated)), + time.Tick(10*time.Second), + time.After((5 * time.Minute)))) + + fmt.Println("subnet deleted") +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/example_identity_test.go b/vendor/github.com/oracle/oci-go-sdk/example/example_identity_test.go new file mode 100644 index 0000000000..1ae3cf5777 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/example_identity_test.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Example code for Identity and Access Management Service API +// + +package example + +import ( + "context" + "fmt" + "log" + + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/example/helpers" + "github.com/oracle/oci-go-sdk/identity" +) + +// ExampleListAvailabilityDomains Lists the Availability Domains in your tenancy. +// Specify the OCID of either the tenancy or another of your compartments as +// the value for the compartment ID (remember that the tenancy is simply the root compartment). +func ExampleListAvailabilityDomains() { + c, err := identity.NewIdentityClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(err) + + // The OCID of the tenancy containing the compartment. + tenancyID, err := common.DefaultConfigProvider().TenancyOCID() + helpers.LogIfError(err) + + request := identity.ListAvailabilityDomainsRequest{ + CompartmentId: &tenancyID, + } + + r, err := c.ListAvailabilityDomains(context.Background(), request) + helpers.LogIfError(err) + + log.Printf("list of available domains: %v", r.Items) + fmt.Println("list available domains completed") + + // Output: + // list available domains completed +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/example_loadbalancer_test.go b/vendor/github.com/oracle/oci-go-sdk/example/example_loadbalancer_test.go new file mode 100644 index 0000000000..db884fd290 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/example_loadbalancer_test.go @@ -0,0 +1,188 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Example code for Load Balancing Service API +// + +package example + +import ( + "context" + "fmt" + "time" + + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/core" + "github.com/oracle/oci-go-sdk/example/helpers" + "github.com/oracle/oci-go-sdk/identity" + "github.com/oracle/oci-go-sdk/loadbalancer" +) + +const ( + loadbalancerDisplayName = "OCI-GO-Sample-LB" +) + +func ExampleCreateLoadbalancer() { + + c, clerr := loadbalancer.NewLoadBalancerClientWithConfigurationProvider(common.DefaultConfigProvider()) + ctx := context.Background() + helpers.LogIfError(clerr) + + request := loadbalancer.CreateLoadBalancerRequest{} + request.CompartmentId = helpers.CompartmentID() + request.DisplayName = common.String(loadbalancerDisplayName) + + subnet1 := CreateOrGetSubnet() + fmt.Println("create subnet1 complete") + + // create a subnet in different availability domain + identityClient, err := identity.NewIdentityClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(err) + req := identity.ListAvailabilityDomainsRequest{} + req.CompartmentId = helpers.CompartmentID() + response, err := identityClient.ListAvailabilityDomains(ctx, req) + helpers.LogIfError(err) + availableDomain := response.Items[1].Name + + subnet2 := CreateOrGetSubnetWithDetails(common.String(subnetDisplayName2), common.String("10.0.1.0/24"), common.String("subnetdns2"), availableDomain) + fmt.Println("create subnet2 complete") + + request.SubnetIds = []string{*subnet1.Id, *subnet2.Id} + + shapes := listLoadBalancerShapes(ctx, c) + fmt.Println("list load balancer shapes complete") + + request.ShapeName = shapes[0].Name + + _, err = c.CreateLoadBalancer(ctx, request) + helpers.LogIfError(err) + + fmt.Println("create load balancer complete") + + // get created loadbalancer + getLoadBalancer := func() *loadbalancer.LoadBalancer { + loadbalancers := listLoadBalancers(ctx, c, loadbalancer.LoadBalancerLifecycleStateActive) + for _, element := range loadbalancers { + if *element.DisplayName == loadbalancerDisplayName { + // found it, return + return &element + } + } + + return nil + } + + // use to check the lifecycle states of new load balancer + loadBalancerLifecycleStateCheck := func() (interface{}, error) { + loadBalancer := getLoadBalancer() + if loadBalancer != nil { + return loadBalancer, nil + } + + return loadbalancer.LoadBalancer{}, nil + } + + // wait for instance lifecyle state become running + helpers.LogIfError( + helpers.RetryUntilTrueOrError( + loadBalancerLifecycleStateCheck, + helpers.CheckLifecycleState(string(loadbalancer.LoadBalancerLifecycleStateActive)), + time.Tick(10*time.Second), + time.After((5 * time.Minute)))) + + newCreatedLoadBalancer := getLoadBalancer() + fmt.Printf("new loadbalancer LifecycleState is: %s\n", newCreatedLoadBalancer.LifecycleState) + + // clean up resources + defer func() { + deleteLoadbalancer(ctx, c, newCreatedLoadBalancer.Id) + + client, clerr := core.NewVirtualNetworkClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(clerr) + + vcnID := subnet1.VcnId + deleteSubnet(ctx, client, subnet1.Id) + deleteSubnet(ctx, client, subnet2.Id) + deleteVcn(ctx, client, vcnID) + }() + + // Output: + // create subnet1 complete + // create subnet2 complete + // list load balancer shapes complete + // create load balancer complete + // new loadbalancer LifecycleState is: ACTIVE + // deleting load balancer + // load balancer deleted + // deleteing subnet + // subnet deleted + // deleteing subnet + // subnet deleted + // deleteing VCN + // VCN deleted +} + +func listLoadBalancerShapes(ctx context.Context, client loadbalancer.LoadBalancerClient) []loadbalancer.LoadBalancerShape { + request := loadbalancer.ListShapesRequest{ + CompartmentId: helpers.CompartmentID(), + } + + r, err := client.ListShapes(ctx, request) + helpers.LogIfError(err) + return r.Items +} + +func listLoadBalancers(ctx context.Context, client loadbalancer.LoadBalancerClient, lifecycleState loadbalancer.LoadBalancerLifecycleStateEnum) []loadbalancer.LoadBalancer { + request := loadbalancer.ListLoadBalancersRequest{ + CompartmentId: helpers.CompartmentID(), + DisplayName: common.String(loadbalancerDisplayName), + LifecycleState: lifecycleState, + } + + r, err := client.ListLoadBalancers(ctx, request) + helpers.LogIfError(err) + return r.Items +} + +func deleteLoadbalancer(ctx context.Context, client loadbalancer.LoadBalancerClient, id *string) { + request := loadbalancer.DeleteLoadBalancerRequest{ + LoadBalancerId: id, + } + + _, err := client.DeleteLoadBalancer(ctx, request) + helpers.LogIfError(err) + fmt.Println("deleting load balancer") + + // get loadbalancer + getLoadBalancer := func() *loadbalancer.LoadBalancer { + loadbalancers := listLoadBalancers(ctx, client, loadbalancer.LoadBalancerLifecycleStateDeleting) + for _, element := range loadbalancers { + if *element.DisplayName == loadbalancerDisplayName { + // found it, return + return &element + } + } + + return nil + } + + // use to check the lifecycle state of load balancer + loadBalancerLifecycleStateCheck := func() (interface{}, error) { + loadBalancer := getLoadBalancer() + if loadBalancer != nil { + return loadBalancer, nil + } + + // cannot find load balancer which means it's been deleted + return loadbalancer.LoadBalancer{LifecycleState: loadbalancer.LoadBalancerLifecycleStateDeleted}, nil + } + + // wait for load balancer been deleted + helpers.LogIfError( + helpers.RetryUntilTrueOrError( + loadBalancerLifecycleStateCheck, + helpers.CheckLifecycleState(string(loadbalancer.LoadBalancerLifecycleStateDeleted)), + time.Tick(10*time.Second), + time.After((10 * time.Minute)))) + + fmt.Println("load balancer deleted") +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/example_objectstorage_test.go b/vendor/github.com/oracle/oci-go-sdk/example/example_objectstorage_test.go new file mode 100644 index 0000000000..3481cdc62e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/example_objectstorage_test.go @@ -0,0 +1,129 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Example code for Object Storage Service API +// + +package example + +import ( + "context" + "crypto/sha256" + "fmt" + "io" + "io/ioutil" + "math/rand" + "os" + "path" + "time" + + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/example/helpers" + "github.com/oracle/oci-go-sdk/objectstorage" +) + +// ExampleObjectStorage_UploadFile shows how to create a bucket and upload a file +func ExampleObjectStorage_UploadFile() { + c, clerr := objectstorage.NewObjectStorageClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.LogIfError(clerr) + + ctx := context.Background() + bname := helpers.GetRandomString(8) + namespace := getNamespace(ctx, c) + + createBucket(ctx, c, namespace, bname) + defer deleteBucket(ctx, c, namespace, bname) + + contentlen := 1024 * 1000 + filepath, filesize := writeTempFileOfSize(int64(contentlen)) + filename := path.Base(filepath) + defer func() { + os.Remove(filename) + }() + + file, e := os.Open(filepath) + defer file.Close() + helpers.LogIfError(e) + + e = putObject(ctx, c, namespace, bname, filename, int(filesize), file, nil) + helpers.LogIfError(e) + defer deleteObject(ctx, c, namespace, bname, filename) + + // Output: + // get namespace + // create bucket + // put object + // delete object + // delete bucket +} + +func getNamespace(ctx context.Context, c objectstorage.ObjectStorageClient) string { + request := objectstorage.GetNamespaceRequest{} + r, err := c.GetNamespace(ctx, request) + helpers.LogIfError(err) + fmt.Println("get namespace") + return *r.Value +} + +func putObject(ctx context.Context, c objectstorage.ObjectStorageClient, namespace, bucketname, objectname string, contentLen int, content io.ReadCloser, metadata map[string]string) error { + request := objectstorage.PutObjectRequest{ + NamespaceName: &namespace, + BucketName: &bucketname, + ObjectName: &objectname, + ContentLength: &contentLen, + PutObjectBody: content, + OpcMeta: metadata, + } + _, err := c.PutObject(ctx, request) + fmt.Println("put object") + return err +} + +func deleteObject(ctx context.Context, c objectstorage.ObjectStorageClient, namespace, bucketname, objectname string) (err error) { + request := objectstorage.DeleteObjectRequest{ + NamespaceName: &namespace, + BucketName: &bucketname, + ObjectName: &objectname, + } + _, err = c.DeleteObject(ctx, request) + helpers.LogIfError(err) + fmt.Println("delete object") + return +} + +func createBucket(ctx context.Context, c objectstorage.ObjectStorageClient, namespace, name string) { + request := objectstorage.CreateBucketRequest{ + NamespaceName: &namespace, + } + request.CompartmentId = helpers.CompartmentID() + request.Name = &name + request.Metadata = make(map[string]string) + request.PublicAccessType = objectstorage.CreateBucketDetailsPublicAccessTypeNopublicaccess + _, err := c.CreateBucket(ctx, request) + helpers.LogIfError(err) + + fmt.Println("create bucket") +} + +func deleteBucket(ctx context.Context, c objectstorage.ObjectStorageClient, namespace, name string) (err error) { + request := objectstorage.DeleteBucketRequest{ + NamespaceName: &namespace, + BucketName: &name, + } + _, err = c.DeleteBucket(ctx, request) + helpers.LogIfError(err) + + fmt.Println("delete bucket") + return +} + +func writeTempFileOfSize(filesize int64) (fileName string, fileSize int64) { + hash := sha256.New() + f, _ := ioutil.TempFile("", "OCIGOSDKSampleFile") + ra := rand.New(rand.NewSource(time.Now().UnixNano())) + defer f.Close() + writer := io.MultiWriter(f, hash) + written, _ := io.CopyN(writer, ra, filesize) + fileName = f.Name() + fileSize = written + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/example_rawrequest_test.go b/vendor/github.com/oracle/oci-go-sdk/example/example_rawrequest_test.go new file mode 100644 index 0000000000..ce2fcc1e37 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/example_rawrequest_test.go @@ -0,0 +1,61 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Example code for sending raw request to Service API +// + +package example + +import ( + "fmt" + "io/ioutil" + "log" + "net/http" + "time" + + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/example/helpers" +) + +// ExampleRawRequest compose a request, sign it and send to server +func ExampleListUsers_RawRequest() { + // build the url + url := "https://identity.us-phoenix-1.oraclecloud.com/20160918/users/?compartmentId=" + *helpers.RootCompartmentID() + + // create request + request, err := http.NewRequest("GET", url, nil) + helpers.LogIfError(err) + + // Set the Date header + request.Header.Set("Date", time.Now().UTC().Format(http.TimeFormat)) + + // And a provider of cryptographic keys + provider := common.DefaultConfigProvider() + + // Build the signer + signer := common.DefaultRequestSigner(provider) + + // Sign the request + signer.Sign(request) + + client := http.Client{} + + fmt.Println("send request") + + // Execute the request + resp, err := client.Do(request) + helpers.LogIfError(err) + + defer resp.Body.Close() + + log.Println("response Status:", resp.Status) + log.Println("response Headers:", resp.Header) + + body, _ := ioutil.ReadAll(resp.Body) + log.Println("response Body:", string(body)) + + fmt.Println("receive response") + + // Output: + // send request + // receive response +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/example_test.go b/vendor/github.com/oracle/oci-go-sdk/example/example_test.go new file mode 100644 index 0000000000..dca41999e4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/example_test.go @@ -0,0 +1,23 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Example code for OCI GOSDK +// +package example + +import ( + "os" + "testing" + + "github.com/oracle/oci-go-sdk/example/helpers" +) + +// Before run the samples, update the .env.sample file with your tenancy info. +// To run individual sample: +// go test github.com/oracle/oci-go-sdk/example -run ^ExampleLaunchInstance$ +// To run all samples: +// go test github.com/oracle/oci-go-sdk/example +func TestMain(m *testing.M) { + // parse the arguments defined in .env.sample file + helpers.ParseAgrs() + os.Exit(m.Run()) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/helpers/args.go b/vendor/github.com/oracle/oci-go-sdk/example/helpers/args.go new file mode 100644 index 0000000000..4f8b123f0f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/helpers/args.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Helper methods for OCI GOSDK Samples +// + +package helpers + +import ( + "os" + + "github.com/oracle/oci-go-sdk/common" + + "github.com/subosito/gotenv" +) + +var ( + availabilityDomain string + compartmentID string + rootCompartmentID string +) + +// ParseAgrs parse shared variables from environment variables, other samples should define their own +// viariables and call this function to initialize shared variables +func ParseAgrs() { + err := gotenv.Load(".env.sample") + LogIfError(err) + + availabilityDomain = os.Getenv("OCI_AVAILABILITY_DOMAIN") + compartmentID = os.Getenv("OCI_COMPARTMENT_ID") + rootCompartmentID = os.Getenv("OCI_ROOT_COMPARTMENT_ID") +} + +// AvailabilityDomain return the aviailability domain defined in .env.sample file +func AvailabilityDomain() *string { + return common.String(availabilityDomain) +} + +// CompartmentID return the compartment ID defined in .env.sample file +func CompartmentID() *string { + return common.String(compartmentID) +} + +// RootCompartmentID return the root compartment ID defined in .env.sample file +func RootCompartmentID() *string { + return common.String(rootCompartmentID) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/example/helpers/helper.go b/vendor/github.com/oracle/oci-go-sdk/example/helpers/helper.go new file mode 100644 index 0000000000..71317387da --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/example/helpers/helper.go @@ -0,0 +1,111 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// +// Helper methods for OCI GOSDK Samples +// + +package helpers + +import ( + "fmt" + "log" + "math/rand" + "reflect" + "strings" + "time" +) + +// LogIfError is equivalent to Println() followed by a call to os.Exit(1) if error is not nil +func LogIfError(err error) { + if err != nil { + log.Fatalln(err.Error()) + } +} + +// RetryUntilTrueOrError retries a function until the predicate is true or it reaches a timeout. +// The operation is retried at the give frequency +func RetryUntilTrueOrError(operation func() (interface{}, error), predicate func(interface{}) (bool, error), frequency, timeout <-chan time.Time) error { + for { + select { + case <-timeout: + return fmt.Errorf("timeout reached") + case <-frequency: + result, err := operation() + if err != nil { + return err + } + + isTrue, err := predicate(result) + if err != nil { + return err + } + + if isTrue { + return nil + } + } + } +} + +// FindLifecycleFieldValue finds lifecycle value inside the struct based on reflection +func FindLifecycleFieldValue(request interface{}) (string, error) { + val := reflect.ValueOf(request) + if val.Kind() == reflect.Ptr { + if val.IsNil() { + return "", fmt.Errorf("can not unmarshal to response a pointer to nil structure") + } + val = val.Elem() + } + + var err error + typ := val.Type() + for i := 0; i < typ.NumField(); i++ { + if err != nil { + return "", err + } + + sf := typ.Field(i) + + //unexported + if sf.PkgPath != "" { + continue + } + + sv := val.Field(i) + + if sv.Kind() == reflect.Struct { + lif, err := FindLifecycleFieldValue(sv.Interface()) + if err == nil { + return lif, nil + } + } + if !strings.Contains(strings.ToLower(sf.Name), "lifecyclestate") { + continue + } + return sv.String(), nil + } + return "", fmt.Errorf("request does not have a lifecycle field") +} + +// CheckLifecycleState returns a function that checks for that a struct has the given lifecycle +func CheckLifecycleState(lifecycleState string) func(interface{}) (bool, error) { + return func(request interface{}) (bool, error) { + fieldLifecycle, err := FindLifecycleFieldValue(request) + if err != nil { + return false, err + } + isEqual := fieldLifecycle == lifecycleState + log.Printf("Current lifecycle state is: %s, waiting for it becomes to: %s", fieldLifecycle, lifecycleState) + return isEqual, nil + } +} + +// GetRandomString returns a random string with length equals to n +func GetRandomString(n int) string { + letters := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + + b := make([]rune, n) + for i := range b { + b[i] = letters[rand.Intn(len(letters))] + } + return string(b) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/add_user_to_group_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/add_user_to_group_details.go new file mode 100644 index 0000000000..03b811f24b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/add_user_to_group_details.go @@ -0,0 +1,27 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// AddUserToGroupDetails The representation of AddUserToGroupDetails +type AddUserToGroupDetails struct { + + // The OCID of the user. + UserId *string `mandatory:"true" json:"userId"` + + // The OCID of the group. + GroupId *string `mandatory:"true" json:"groupId"` +} + +func (m AddUserToGroupDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/add_user_to_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/add_user_to_group_request_response.go new file mode 100644 index 0000000000..34b121dd08 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/add_user_to_group_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// AddUserToGroupRequest wrapper for the AddUserToGroup operation +type AddUserToGroupRequest struct { + + // Request object for adding a user to a group. + AddUserToGroupDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request AddUserToGroupRequest) String() string { + return common.PointerString(request) +} + +// AddUserToGroupResponse wrapper for the AddUserToGroup operation +type AddUserToGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The UserGroupMembership instance + UserGroupMembership `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response AddUserToGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/api_key.go b/vendor/github.com/oracle/oci-go-sdk/identity/api_key.go new file mode 100644 index 0000000000..d5b9eed1de --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/api_key.go @@ -0,0 +1,80 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// ApiKey A PEM-format RSA credential for securing requests to the Oracle Cloud Infrastructure REST API. Also known +// as an *API signing key*. Specifically, this is the public key from the key pair. The private key remains with +// the user calling the API. For information about generating a key pair +// in the required PEM format, see Required Keys and OCIDs (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm). +// **Important:** This is **not** the SSH key for accessing compute instances. +// Each user can have a maximum of three API signing keys. +// For more information about user credentials, see User Credentials (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/usercredentials.htm). +type ApiKey struct { + + // An Oracle-assigned identifier for the key, in this format: + // TENANCY_OCID/USER_OCID/KEY_FINGERPRINT. + KeyId *string `mandatory:"false" json:"keyId"` + + // The key's value. + KeyValue *string `mandatory:"false" json:"keyValue"` + + // The key's fingerprint (e.g., 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef). + Fingerprint *string `mandatory:"false" json:"fingerprint"` + + // The OCID of the user the key belongs to. + UserId *string `mandatory:"false" json:"userId"` + + // Date and time the `ApiKey` object was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The API key's current state. After creating an `ApiKey` object, make sure its `lifecycleState` changes from + // CREATING to ACTIVE before using it. + LifecycleState ApiKeyLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m ApiKey) String() string { + return common.PointerString(m) +} + +// ApiKeyLifecycleStateEnum Enum with underlying type: string +type ApiKeyLifecycleStateEnum string + +// Set of constants representing the allowable values for ApiKeyLifecycleState +const ( + ApiKeyLifecycleStateCreating ApiKeyLifecycleStateEnum = "CREATING" + ApiKeyLifecycleStateActive ApiKeyLifecycleStateEnum = "ACTIVE" + ApiKeyLifecycleStateInactive ApiKeyLifecycleStateEnum = "INACTIVE" + ApiKeyLifecycleStateDeleting ApiKeyLifecycleStateEnum = "DELETING" + ApiKeyLifecycleStateDeleted ApiKeyLifecycleStateEnum = "DELETED" +) + +var mappingApiKeyLifecycleState = map[string]ApiKeyLifecycleStateEnum{ + "CREATING": ApiKeyLifecycleStateCreating, + "ACTIVE": ApiKeyLifecycleStateActive, + "INACTIVE": ApiKeyLifecycleStateInactive, + "DELETING": ApiKeyLifecycleStateDeleting, + "DELETED": ApiKeyLifecycleStateDeleted, +} + +// GetApiKeyLifecycleStateEnumValues Enumerates the set of values for ApiKeyLifecycleState +func GetApiKeyLifecycleStateEnumValues() []ApiKeyLifecycleStateEnum { + values := make([]ApiKeyLifecycleStateEnum, 0) + for _, v := range mappingApiKeyLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/availability_domain.go b/vendor/github.com/oracle/oci-go-sdk/identity/availability_domain.go new file mode 100644 index 0000000000..7d5d03b958 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/availability_domain.go @@ -0,0 +1,29 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// AvailabilityDomain One or more isolated, fault-tolerant Oracle data centers that host cloud resources such as instances, volumes, +// and subnets. A region contains several Availability Domains. For more information, see +// Regions and Availability Domains (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). +type AvailabilityDomain struct { + + // The name of the Availability Domain. + Name *string `mandatory:"false" json:"name"` + + // The OCID of the tenancy. + CompartmentId *string `mandatory:"false" json:"compartmentId"` +} + +func (m AvailabilityDomain) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/compartment.go b/vendor/github.com/oracle/oci-go-sdk/identity/compartment.go new file mode 100644 index 0000000000..941523d226 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/compartment.go @@ -0,0 +1,88 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Compartment A collection of related resources. Compartments are a fundamental component of Oracle Cloud Infrastructure +// for organizing and isolating your cloud resources. You use them to clearly separate resources for the purposes +// of measuring usage and billing, access (through the use of IAM Service policies), and isolation (separating the +// resources for one project or business unit from another). A common approach is to create a compartment for each +// major part of your organization. For more information, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm) and also +// Setting Up Your Tenancy (https://docs.us-phoenix-1.oraclecloud.com/Content/GSG/Concepts/settinguptenancy.htm). +// +// To place a resource in a compartment, simply specify the compartment ID in the "Create" request object when +// initially creating the resource. For example, to launch an instance into a particular compartment, specify +// that compartment's OCID in the `LaunchInstance` request. You can't move an existing resource from one +// compartment to another. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Compartment struct { + + // The OCID of the compartment. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the tenancy containing the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the compartment during creation. The name must be unique across all + // compartments in the tenancy. + Name *string `mandatory:"true" json:"name"` + + // The description you assign to the compartment. Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` + + // Date and time the compartment was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The compartment's current state. After creating a compartment, make sure its `lifecycleState` changes from + // CREATING to ACTIVE before using it. + LifecycleState CompartmentLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m Compartment) String() string { + return common.PointerString(m) +} + +// CompartmentLifecycleStateEnum Enum with underlying type: string +type CompartmentLifecycleStateEnum string + +// Set of constants representing the allowable values for CompartmentLifecycleState +const ( + CompartmentLifecycleStateCreating CompartmentLifecycleStateEnum = "CREATING" + CompartmentLifecycleStateActive CompartmentLifecycleStateEnum = "ACTIVE" + CompartmentLifecycleStateInactive CompartmentLifecycleStateEnum = "INACTIVE" + CompartmentLifecycleStateDeleting CompartmentLifecycleStateEnum = "DELETING" + CompartmentLifecycleStateDeleted CompartmentLifecycleStateEnum = "DELETED" +) + +var mappingCompartmentLifecycleState = map[string]CompartmentLifecycleStateEnum{ + "CREATING": CompartmentLifecycleStateCreating, + "ACTIVE": CompartmentLifecycleStateActive, + "INACTIVE": CompartmentLifecycleStateInactive, + "DELETING": CompartmentLifecycleStateDeleting, + "DELETED": CompartmentLifecycleStateDeleted, +} + +// GetCompartmentLifecycleStateEnumValues Enumerates the set of values for CompartmentLifecycleState +func GetCompartmentLifecycleStateEnumValues() []CompartmentLifecycleStateEnum { + values := make([]CompartmentLifecycleStateEnum, 0) + for _, v := range mappingCompartmentLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_api_key_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_api_key_details.go new file mode 100644 index 0000000000..b9d6157ab9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_api_key_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateApiKeyDetails The representation of CreateApiKeyDetails +type CreateApiKeyDetails struct { + + // The public key. Must be an RSA key in PEM format. + Key *string `mandatory:"true" json:"key"` +} + +func (m CreateApiKeyDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_compartment_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_compartment_details.go new file mode 100644 index 0000000000..fb4813a61b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_compartment_details.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateCompartmentDetails The representation of CreateCompartmentDetails +type CreateCompartmentDetails struct { + + // The OCID of the tenancy containing the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the compartment during creation. The name must be unique across all compartments + // in the tenancy. + Name *string `mandatory:"true" json:"name"` + + // The description you assign to the compartment during creation. Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` +} + +func (m CreateCompartmentDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_compartment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_compartment_request_response.go new file mode 100644 index 0000000000..5ae960ed65 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_compartment_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateCompartmentRequest wrapper for the CreateCompartment operation +type CreateCompartmentRequest struct { + + // Request object for creating a new compartment. + CreateCompartmentDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateCompartmentRequest) String() string { + return common.PointerString(request) +} + +// CreateCompartmentResponse wrapper for the CreateCompartment operation +type CreateCompartmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Compartment instance + Compartment `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response CreateCompartmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_customer_secret_key_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_customer_secret_key_details.go new file mode 100644 index 0000000000..f61527dc91 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_customer_secret_key_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateCustomerSecretKeyDetails The representation of CreateCustomerSecretKeyDetails +type CreateCustomerSecretKeyDetails struct { + + // The name you assign to the secret key during creation. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"true" json:"displayName"` +} + +func (m CreateCustomerSecretKeyDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_customer_secret_key_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_customer_secret_key_request_response.go new file mode 100644 index 0000000000..db24ca7a86 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_customer_secret_key_request_response.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateCustomerSecretKeyRequest wrapper for the CreateCustomerSecretKey operation +type CreateCustomerSecretKeyRequest struct { + + // Request object for creating a new secret key. + CreateCustomerSecretKeyDetails `contributesTo:"body"` + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateCustomerSecretKeyRequest) String() string { + return common.PointerString(request) +} + +// CreateCustomerSecretKeyResponse wrapper for the CreateCustomerSecretKey operation +type CreateCustomerSecretKeyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CustomerSecretKey instance + CustomerSecretKey `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response CreateCustomerSecretKeyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_group_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_group_details.go new file mode 100644 index 0000000000..98a265dc95 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_group_details.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateGroupDetails The representation of CreateGroupDetails +type CreateGroupDetails struct { + + // The OCID of the tenancy containing the group. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the group during creation. The name must be unique across all groups + // in the tenancy and cannot be changed. + Name *string `mandatory:"true" json:"name"` + + // The description you assign to the group during creation. Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` +} + +func (m CreateGroupDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_group_request_response.go new file mode 100644 index 0000000000..882880cb97 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_group_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateGroupRequest wrapper for the CreateGroup operation +type CreateGroupRequest struct { + + // Request object for creating a new group. + CreateGroupDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateGroupRequest) String() string { + return common.PointerString(request) +} + +// CreateGroupResponse wrapper for the CreateGroup operation +type CreateGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Group instance + Group `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response CreateGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_identity_provider_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_identity_provider_details.go new file mode 100644 index 0000000000..35d7f594a8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_identity_provider_details.go @@ -0,0 +1,125 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateIdentityProviderDetails The representation of CreateIdentityProviderDetails +type CreateIdentityProviderDetails interface { + + // The OCID of your tenancy. + GetCompartmentId() *string + + // The name you assign to the `IdentityProvider` during creation. + // The name must be unique across all `IdentityProvider` objects in the + // tenancy and cannot be changed. + GetName() *string + + // The description you assign to the `IdentityProvider` during creation. + // Does not have to be unique, and it's changeable. + GetDescription() *string + + // The identity provider service or product. + // Supported identity providers are Oracle Identity Cloud Service (IDCS) and Microsoft + // Active Directory Federation Services (ADFS). + // Example: `IDCS` + GetProductType() CreateIdentityProviderDetailsProductTypeEnum +} + +type createidentityproviderdetails struct { + JsonData []byte + CompartmentId *string `mandatory:"true" json:"compartmentId"` + Name *string `mandatory:"true" json:"name"` + Description *string `mandatory:"true" json:"description"` + ProductType CreateIdentityProviderDetailsProductTypeEnum `mandatory:"true" json:"productType"` + Protocol string `json:"protocol"` +} + +// UnmarshalJSON unmarshals json +func (m *createidentityproviderdetails) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalercreateidentityproviderdetails createidentityproviderdetails + s := struct { + Model Unmarshalercreateidentityproviderdetails + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.CompartmentId = s.Model.CompartmentId + m.Name = s.Model.Name + m.Description = s.Model.Description + m.ProductType = s.Model.ProductType + m.Protocol = s.Model.Protocol + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *createidentityproviderdetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.Protocol { + case "SAML2": + mm := CreateSaml2IdentityProviderDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +//GetCompartmentId returns CompartmentId +func (m createidentityproviderdetails) GetCompartmentId() *string { + return m.CompartmentId +} + +//GetName returns Name +func (m createidentityproviderdetails) GetName() *string { + return m.Name +} + +//GetDescription returns Description +func (m createidentityproviderdetails) GetDescription() *string { + return m.Description +} + +//GetProductType returns ProductType +func (m createidentityproviderdetails) GetProductType() CreateIdentityProviderDetailsProductTypeEnum { + return m.ProductType +} + +func (m createidentityproviderdetails) String() string { + return common.PointerString(m) +} + +// CreateIdentityProviderDetailsProductTypeEnum Enum with underlying type: string +type CreateIdentityProviderDetailsProductTypeEnum string + +// Set of constants representing the allowable values for CreateIdentityProviderDetailsProductType +const ( + CreateIdentityProviderDetailsProductTypeIdcs CreateIdentityProviderDetailsProductTypeEnum = "IDCS" + CreateIdentityProviderDetailsProductTypeAdfs CreateIdentityProviderDetailsProductTypeEnum = "ADFS" +) + +var mappingCreateIdentityProviderDetailsProductType = map[string]CreateIdentityProviderDetailsProductTypeEnum{ + "IDCS": CreateIdentityProviderDetailsProductTypeIdcs, + "ADFS": CreateIdentityProviderDetailsProductTypeAdfs, +} + +// GetCreateIdentityProviderDetailsProductTypeEnumValues Enumerates the set of values for CreateIdentityProviderDetailsProductType +func GetCreateIdentityProviderDetailsProductTypeEnumValues() []CreateIdentityProviderDetailsProductTypeEnum { + values := make([]CreateIdentityProviderDetailsProductTypeEnum, 0) + for _, v := range mappingCreateIdentityProviderDetailsProductType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_identity_provider_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_identity_provider_request_response.go new file mode 100644 index 0000000000..a3ac552dd6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_identity_provider_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateIdentityProviderRequest wrapper for the CreateIdentityProvider operation +type CreateIdentityProviderRequest struct { + + // Request object for creating a new SAML2 identity provider. + CreateIdentityProviderDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateIdentityProviderRequest) String() string { + return common.PointerString(request) +} + +// CreateIdentityProviderResponse wrapper for the CreateIdentityProvider operation +type CreateIdentityProviderResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IdentityProvider instance + IdentityProvider `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response CreateIdentityProviderResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_idp_group_mapping_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_idp_group_mapping_details.go new file mode 100644 index 0000000000..a6cb911929 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_idp_group_mapping_details.go @@ -0,0 +1,28 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateIdpGroupMappingDetails The representation of CreateIdpGroupMappingDetails +type CreateIdpGroupMappingDetails struct { + + // The name of the IdP group you want to map. + IdpGroupName *string `mandatory:"true" json:"idpGroupName"` + + // The OCID of the IAM Service Group + // you want to map to the IdP group. + GroupId *string `mandatory:"true" json:"groupId"` +} + +func (m CreateIdpGroupMappingDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_idp_group_mapping_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_idp_group_mapping_request_response.go new file mode 100644 index 0000000000..376d07bc33 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_idp_group_mapping_request_response.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateIdpGroupMappingRequest wrapper for the CreateIdpGroupMapping operation +type CreateIdpGroupMappingRequest struct { + + // Add a mapping from an SAML2.0 identity provider group to a BMC group. + CreateIdpGroupMappingDetails `contributesTo:"body"` + + // The OCID of the identity provider. + IdentityProviderId *string `mandatory:"true" contributesTo:"path" name:"identityProviderId"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateIdpGroupMappingRequest) String() string { + return common.PointerString(request) +} + +// CreateIdpGroupMappingResponse wrapper for the CreateIdpGroupMapping operation +type CreateIdpGroupMappingResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IdpGroupMapping instance + IdpGroupMapping `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response CreateIdpGroupMappingResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_or_reset_u_i_password_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_or_reset_u_i_password_request_response.go new file mode 100644 index 0000000000..8d6de9aa8f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_or_reset_u_i_password_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateOrResetUIPasswordRequest wrapper for the CreateOrResetUIPassword operation +type CreateOrResetUIPasswordRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateOrResetUIPasswordRequest) String() string { + return common.PointerString(request) +} + +// CreateOrResetUIPasswordResponse wrapper for the CreateOrResetUIPassword operation +type CreateOrResetUIPasswordResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The UiPassword instance + UiPassword `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response CreateOrResetUIPasswordResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_policy_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_policy_details.go new file mode 100644 index 0000000000..b25f8b649d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_policy_details.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreatePolicyDetails The representation of CreatePolicyDetails +type CreatePolicyDetails struct { + + // The OCID of the compartment containing the policy (either the tenancy or another compartment). + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the policy during creation. The name must be unique across all policies + // in the tenancy and cannot be changed. + Name *string `mandatory:"true" json:"name"` + + // An array of policy statements written in the policy language. See + // How Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policies.htm) and + // Common Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/commonpolicies.htm). + Statements []string `mandatory:"true" json:"statements"` + + // The description you assign to the policy during creation. Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` + + // The version of the policy. If null or set to an empty string, when a request comes in for authorization, the + // policy will be evaluated according to the current behavior of the services at that moment. If set to a particular + // date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date. + VersionDate *common.SDKTime `mandatory:"false" json:"versionDate"` +} + +func (m CreatePolicyDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_policy_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_policy_request_response.go new file mode 100644 index 0000000000..b6d7e00285 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_policy_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreatePolicyRequest wrapper for the CreatePolicy operation +type CreatePolicyRequest struct { + + // Request object for creating a new policy. + CreatePolicyDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreatePolicyRequest) String() string { + return common.PointerString(request) +} + +// CreatePolicyResponse wrapper for the CreatePolicy operation +type CreatePolicyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Policy instance + Policy `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response CreatePolicyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_region_subscription_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_region_subscription_details.go new file mode 100644 index 0000000000..78e866f7cb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_region_subscription_details.go @@ -0,0 +1,29 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateRegionSubscriptionDetails The representation of CreateRegionSubscriptionDetails +type CreateRegionSubscriptionDetails struct { + + // The regions's key. + // Allowed values are: + // - `PHX` + // - `IAD` + // - `FRA` + // Example: `PHX` + RegionKey *string `mandatory:"true" json:"regionKey"` +} + +func (m CreateRegionSubscriptionDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_region_subscription_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_region_subscription_request_response.go new file mode 100644 index 0000000000..66dc199d1d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_region_subscription_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateRegionSubscriptionRequest wrapper for the CreateRegionSubscription operation +type CreateRegionSubscriptionRequest struct { + + // Request object for activate a new region. + CreateRegionSubscriptionDetails `contributesTo:"body"` + + // The OCID of the tenancy. + TenancyId *string `mandatory:"true" contributesTo:"path" name:"tenancyId"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateRegionSubscriptionRequest) String() string { + return common.PointerString(request) +} + +// CreateRegionSubscriptionResponse wrapper for the CreateRegionSubscription operation +type CreateRegionSubscriptionResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The RegionSubscription instance + RegionSubscription `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateRegionSubscriptionResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_saml2_identity_provider_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_saml2_identity_provider_details.go new file mode 100644 index 0000000000..f4eba6eee2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_saml2_identity_provider_details.go @@ -0,0 +1,81 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// CreateSaml2IdentityProviderDetails The representation of CreateSaml2IdentityProviderDetails +type CreateSaml2IdentityProviderDetails struct { + + // The OCID of your tenancy. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the `IdentityProvider` during creation. + // The name must be unique across all `IdentityProvider` objects in the + // tenancy and cannot be changed. + Name *string `mandatory:"true" json:"name"` + + // The description you assign to the `IdentityProvider` during creation. + // Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` + + // The URL for retrieving the identity provider's metadata, + // which contains information required for federating. + MetadataUrl *string `mandatory:"true" json:"metadataUrl"` + + // The XML that contains the information required for federating. + Metadata *string `mandatory:"true" json:"metadata"` + + // The identity provider service or product. + // Supported identity providers are Oracle Identity Cloud Service (IDCS) and Microsoft + // Active Directory Federation Services (ADFS). + // Example: `IDCS` + ProductType CreateIdentityProviderDetailsProductTypeEnum `mandatory:"true" json:"productType"` +} + +//GetCompartmentId returns CompartmentId +func (m CreateSaml2IdentityProviderDetails) GetCompartmentId() *string { + return m.CompartmentId +} + +//GetName returns Name +func (m CreateSaml2IdentityProviderDetails) GetName() *string { + return m.Name +} + +//GetDescription returns Description +func (m CreateSaml2IdentityProviderDetails) GetDescription() *string { + return m.Description +} + +//GetProductType returns ProductType +func (m CreateSaml2IdentityProviderDetails) GetProductType() CreateIdentityProviderDetailsProductTypeEnum { + return m.ProductType +} + +func (m CreateSaml2IdentityProviderDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m CreateSaml2IdentityProviderDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCreateSaml2IdentityProviderDetails CreateSaml2IdentityProviderDetails + s := struct { + DiscriminatorParam string `json:"protocol"` + MarshalTypeCreateSaml2IdentityProviderDetails + }{ + "SAML2", + (MarshalTypeCreateSaml2IdentityProviderDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_swift_password_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_swift_password_details.go new file mode 100644 index 0000000000..0182d9dc55 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_swift_password_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateSwiftPasswordDetails The representation of CreateSwiftPasswordDetails +type CreateSwiftPasswordDetails struct { + + // The description you assign to the Swift password during creation. Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` +} + +func (m CreateSwiftPasswordDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_swift_password_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_swift_password_request_response.go new file mode 100644 index 0000000000..696261df50 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_swift_password_request_response.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateSwiftPasswordRequest wrapper for the CreateSwiftPassword operation +type CreateSwiftPasswordRequest struct { + + // Request object for creating a new swift password. + CreateSwiftPasswordDetails `contributesTo:"body"` + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateSwiftPasswordRequest) String() string { + return common.PointerString(request) +} + +// CreateSwiftPasswordResponse wrapper for the CreateSwiftPassword operation +type CreateSwiftPasswordResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The SwiftPassword instance + SwiftPassword `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response CreateSwiftPasswordResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_user_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_user_details.go new file mode 100644 index 0000000000..37ddd58570 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_user_details.go @@ -0,0 +1,31 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateUserDetails The representation of CreateUserDetails +type CreateUserDetails struct { + + // The OCID of the tenancy containing the user. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the user during creation. This is the user's login for the Console. + // The name must be unique across all users in the tenancy and cannot be changed. + Name *string `mandatory:"true" json:"name"` + + // The description you assign to the user during creation. Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` +} + +func (m CreateUserDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/create_user_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/create_user_request_response.go new file mode 100644 index 0000000000..137de94467 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/create_user_request_response.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateUserRequest wrapper for the CreateUser operation +type CreateUserRequest struct { + + // Request object for creating a new user. + CreateUserDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateUserRequest) String() string { + return common.PointerString(request) +} + +// CreateUserResponse wrapper for the CreateUser operation +type CreateUserResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The User instance + User `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response CreateUserResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/customer_secret_key.go b/vendor/github.com/oracle/oci-go-sdk/identity/customer_secret_key.go new file mode 100644 index 0000000000..f3137bf6e5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/customer_secret_key.go @@ -0,0 +1,82 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CustomerSecretKey A `CustomerSecretKey` is an Oracle-provided key for using the Object Storage Service's +// Amazon S3 compatible API (https://docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/s3compatibleapi.htm). +// A user can have up to two secret keys at a time. +// **Note:** The secret key is always an Oracle-generated string; you can't change it to a string of your choice. +// For more information, see Managing User Credentials (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingcredentials.htm). +type CustomerSecretKey struct { + + // The secret key. + Key *string `mandatory:"false" json:"key"` + + // The OCID of the secret key. + Id *string `mandatory:"false" json:"id"` + + // The OCID of the user the password belongs to. + UserId *string `mandatory:"false" json:"userId"` + + // The display name you assign to the secret key. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // Date and time the `CustomerSecretKey` object was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // Date and time when this password will expire, in the format defined by RFC3339. + // Null if it never expires. + // Example: `2016-08-25T21:10:29.600Z` + TimeExpires *common.SDKTime `mandatory:"false" json:"timeExpires"` + + // The secret key's current state. After creating a secret key, make sure its `lifecycleState` changes from + // CREATING to ACTIVE before using it. + LifecycleState CustomerSecretKeyLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m CustomerSecretKey) String() string { + return common.PointerString(m) +} + +// CustomerSecretKeyLifecycleStateEnum Enum with underlying type: string +type CustomerSecretKeyLifecycleStateEnum string + +// Set of constants representing the allowable values for CustomerSecretKeyLifecycleState +const ( + CustomerSecretKeyLifecycleStateCreating CustomerSecretKeyLifecycleStateEnum = "CREATING" + CustomerSecretKeyLifecycleStateActive CustomerSecretKeyLifecycleStateEnum = "ACTIVE" + CustomerSecretKeyLifecycleStateInactive CustomerSecretKeyLifecycleStateEnum = "INACTIVE" + CustomerSecretKeyLifecycleStateDeleting CustomerSecretKeyLifecycleStateEnum = "DELETING" + CustomerSecretKeyLifecycleStateDeleted CustomerSecretKeyLifecycleStateEnum = "DELETED" +) + +var mappingCustomerSecretKeyLifecycleState = map[string]CustomerSecretKeyLifecycleStateEnum{ + "CREATING": CustomerSecretKeyLifecycleStateCreating, + "ACTIVE": CustomerSecretKeyLifecycleStateActive, + "INACTIVE": CustomerSecretKeyLifecycleStateInactive, + "DELETING": CustomerSecretKeyLifecycleStateDeleting, + "DELETED": CustomerSecretKeyLifecycleStateDeleted, +} + +// GetCustomerSecretKeyLifecycleStateEnumValues Enumerates the set of values for CustomerSecretKeyLifecycleState +func GetCustomerSecretKeyLifecycleStateEnumValues() []CustomerSecretKeyLifecycleStateEnum { + values := make([]CustomerSecretKeyLifecycleStateEnum, 0) + for _, v := range mappingCustomerSecretKeyLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/customer_secret_key_summary.go b/vendor/github.com/oracle/oci-go-sdk/identity/customer_secret_key_summary.go new file mode 100644 index 0000000000..bc59eed420 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/customer_secret_key_summary.go @@ -0,0 +1,76 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CustomerSecretKeySummary As the name suggests, a `CustomerSecretKeySummary` object contains information about a `CustomerSecretKey`. +// A `CustomerSecretKey` is an Oracle-provided key for using the Object Storage Service's Amazon S3 compatible API. +type CustomerSecretKeySummary struct { + + // The OCID of the secret key. + Id *string `mandatory:"false" json:"id"` + + // The OCID of the user the password belongs to. + UserId *string `mandatory:"false" json:"userId"` + + // The displayName you assign to the secret key. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // Date and time the `CustomerSecretKey` object was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // Date and time when this password will expire, in the format defined by RFC3339. + // Null if it never expires. + // Example: `2016-08-25T21:10:29.600Z` + TimeExpires *common.SDKTime `mandatory:"false" json:"timeExpires"` + + // The secret key's current state. After creating a secret key, make sure its `lifecycleState` changes from + // CREATING to ACTIVE before using it. + LifecycleState CustomerSecretKeySummaryLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m CustomerSecretKeySummary) String() string { + return common.PointerString(m) +} + +// CustomerSecretKeySummaryLifecycleStateEnum Enum with underlying type: string +type CustomerSecretKeySummaryLifecycleStateEnum string + +// Set of constants representing the allowable values for CustomerSecretKeySummaryLifecycleState +const ( + CustomerSecretKeySummaryLifecycleStateCreating CustomerSecretKeySummaryLifecycleStateEnum = "CREATING" + CustomerSecretKeySummaryLifecycleStateActive CustomerSecretKeySummaryLifecycleStateEnum = "ACTIVE" + CustomerSecretKeySummaryLifecycleStateInactive CustomerSecretKeySummaryLifecycleStateEnum = "INACTIVE" + CustomerSecretKeySummaryLifecycleStateDeleting CustomerSecretKeySummaryLifecycleStateEnum = "DELETING" + CustomerSecretKeySummaryLifecycleStateDeleted CustomerSecretKeySummaryLifecycleStateEnum = "DELETED" +) + +var mappingCustomerSecretKeySummaryLifecycleState = map[string]CustomerSecretKeySummaryLifecycleStateEnum{ + "CREATING": CustomerSecretKeySummaryLifecycleStateCreating, + "ACTIVE": CustomerSecretKeySummaryLifecycleStateActive, + "INACTIVE": CustomerSecretKeySummaryLifecycleStateInactive, + "DELETING": CustomerSecretKeySummaryLifecycleStateDeleting, + "DELETED": CustomerSecretKeySummaryLifecycleStateDeleted, +} + +// GetCustomerSecretKeySummaryLifecycleStateEnumValues Enumerates the set of values for CustomerSecretKeySummaryLifecycleState +func GetCustomerSecretKeySummaryLifecycleStateEnumValues() []CustomerSecretKeySummaryLifecycleStateEnum { + values := make([]CustomerSecretKeySummaryLifecycleStateEnum, 0) + for _, v := range mappingCustomerSecretKeySummaryLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/delete_api_key_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/delete_api_key_request_response.go new file mode 100644 index 0000000000..e2beffe0a2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/delete_api_key_request_response.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteApiKeyRequest wrapper for the DeleteApiKey operation +type DeleteApiKeyRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // The key's fingerprint. + Fingerprint *string `mandatory:"true" contributesTo:"path" name:"fingerprint"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteApiKeyRequest) String() string { + return common.PointerString(request) +} + +// DeleteApiKeyResponse wrapper for the DeleteApiKey operation +type DeleteApiKeyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteApiKeyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/delete_customer_secret_key_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/delete_customer_secret_key_request_response.go new file mode 100644 index 0000000000..02855f42bf --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/delete_customer_secret_key_request_response.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteCustomerSecretKeyRequest wrapper for the DeleteCustomerSecretKey operation +type DeleteCustomerSecretKeyRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // The OCID of the secret key. + CustomerSecretKeyId *string `mandatory:"true" contributesTo:"path" name:"customerSecretKeyId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteCustomerSecretKeyRequest) String() string { + return common.PointerString(request) +} + +// DeleteCustomerSecretKeyResponse wrapper for the DeleteCustomerSecretKey operation +type DeleteCustomerSecretKeyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteCustomerSecretKeyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/delete_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/delete_group_request_response.go new file mode 100644 index 0000000000..9b63b8bf44 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/delete_group_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteGroupRequest wrapper for the DeleteGroup operation +type DeleteGroupRequest struct { + + // The OCID of the group. + GroupId *string `mandatory:"true" contributesTo:"path" name:"groupId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteGroupRequest) String() string { + return common.PointerString(request) +} + +// DeleteGroupResponse wrapper for the DeleteGroup operation +type DeleteGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/delete_identity_provider_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/delete_identity_provider_request_response.go new file mode 100644 index 0000000000..e0d82c0faf --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/delete_identity_provider_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteIdentityProviderRequest wrapper for the DeleteIdentityProvider operation +type DeleteIdentityProviderRequest struct { + + // The OCID of the identity provider. + IdentityProviderId *string `mandatory:"true" contributesTo:"path" name:"identityProviderId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteIdentityProviderRequest) String() string { + return common.PointerString(request) +} + +// DeleteIdentityProviderResponse wrapper for the DeleteIdentityProvider operation +type DeleteIdentityProviderResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteIdentityProviderResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/delete_idp_group_mapping_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/delete_idp_group_mapping_request_response.go new file mode 100644 index 0000000000..02d2b8c50d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/delete_idp_group_mapping_request_response.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteIdpGroupMappingRequest wrapper for the DeleteIdpGroupMapping operation +type DeleteIdpGroupMappingRequest struct { + + // The OCID of the identity provider. + IdentityProviderId *string `mandatory:"true" contributesTo:"path" name:"identityProviderId"` + + // The OCID of the group mapping. + MappingId *string `mandatory:"true" contributesTo:"path" name:"mappingId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteIdpGroupMappingRequest) String() string { + return common.PointerString(request) +} + +// DeleteIdpGroupMappingResponse wrapper for the DeleteIdpGroupMapping operation +type DeleteIdpGroupMappingResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteIdpGroupMappingResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/delete_policy_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/delete_policy_request_response.go new file mode 100644 index 0000000000..905f97563a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/delete_policy_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeletePolicyRequest wrapper for the DeletePolicy operation +type DeletePolicyRequest struct { + + // The OCID of the policy. + PolicyId *string `mandatory:"true" contributesTo:"path" name:"policyId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeletePolicyRequest) String() string { + return common.PointerString(request) +} + +// DeletePolicyResponse wrapper for the DeletePolicy operation +type DeletePolicyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeletePolicyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/delete_swift_password_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/delete_swift_password_request_response.go new file mode 100644 index 0000000000..fac41a4f3f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/delete_swift_password_request_response.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteSwiftPasswordRequest wrapper for the DeleteSwiftPassword operation +type DeleteSwiftPasswordRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // The OCID of the Swift password. + SwiftPasswordId *string `mandatory:"true" contributesTo:"path" name:"swiftPasswordId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteSwiftPasswordRequest) String() string { + return common.PointerString(request) +} + +// DeleteSwiftPasswordResponse wrapper for the DeleteSwiftPassword operation +type DeleteSwiftPasswordResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteSwiftPasswordResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/delete_user_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/delete_user_request_response.go new file mode 100644 index 0000000000..5dffac8f5c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/delete_user_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteUserRequest wrapper for the DeleteUser operation +type DeleteUserRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request DeleteUserRequest) String() string { + return common.PointerString(request) +} + +// DeleteUserResponse wrapper for the DeleteUser operation +type DeleteUserResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteUserResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/fault_domain.go b/vendor/github.com/oracle/oci-go-sdk/identity/fault_domain.go new file mode 100644 index 0000000000..4f596c95ba --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/fault_domain.go @@ -0,0 +1,32 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// FaultDomain A Fault Domain is a logical grouping of hardware and infrastructure within an Availability Domain that can become +// unavailable in its entirety either due to hardware failure such as Top-of-rack (TOR) switch failure or due to +// planned software maintenance such as security updates that reboot your instances. +type FaultDomain struct { + + // The name of the Fault Domain. + Name *string `mandatory:"false" json:"name"` + + // The OCID of the of the compartment. Currently only tenancy (root) compartment can be provided. + CompartmentId *string `mandatory:"false" json:"compartmentId"` + + // The name of the availabilityDomain where the Fault Domain belongs. + AvailabilityDomain *string `mandatory:"false" json:"availabilityDomain"` +} + +func (m FaultDomain) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/get_compartment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/get_compartment_request_response.go new file mode 100644 index 0000000000..f85794587f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/get_compartment_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetCompartmentRequest wrapper for the GetCompartment operation +type GetCompartmentRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"path" name:"compartmentId"` +} + +func (request GetCompartmentRequest) String() string { + return common.PointerString(request) +} + +// GetCompartmentResponse wrapper for the GetCompartment operation +type GetCompartmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Compartment instance + Compartment `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response GetCompartmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/get_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/get_group_request_response.go new file mode 100644 index 0000000000..90d97badc5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/get_group_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetGroupRequest wrapper for the GetGroup operation +type GetGroupRequest struct { + + // The OCID of the group. + GroupId *string `mandatory:"true" contributesTo:"path" name:"groupId"` +} + +func (request GetGroupRequest) String() string { + return common.PointerString(request) +} + +// GetGroupResponse wrapper for the GetGroup operation +type GetGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Group instance + Group `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response GetGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/get_identity_provider_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/get_identity_provider_request_response.go new file mode 100644 index 0000000000..503c1687ac --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/get_identity_provider_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetIdentityProviderRequest wrapper for the GetIdentityProvider operation +type GetIdentityProviderRequest struct { + + // The OCID of the identity provider. + IdentityProviderId *string `mandatory:"true" contributesTo:"path" name:"identityProviderId"` +} + +func (request GetIdentityProviderRequest) String() string { + return common.PointerString(request) +} + +// GetIdentityProviderResponse wrapper for the GetIdentityProvider operation +type GetIdentityProviderResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IdentityProvider instance + IdentityProvider `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response GetIdentityProviderResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/get_idp_group_mapping_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/get_idp_group_mapping_request_response.go new file mode 100644 index 0000000000..b589e1e9f8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/get_idp_group_mapping_request_response.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetIdpGroupMappingRequest wrapper for the GetIdpGroupMapping operation +type GetIdpGroupMappingRequest struct { + + // The OCID of the identity provider. + IdentityProviderId *string `mandatory:"true" contributesTo:"path" name:"identityProviderId"` + + // The OCID of the group mapping. + MappingId *string `mandatory:"true" contributesTo:"path" name:"mappingId"` +} + +func (request GetIdpGroupMappingRequest) String() string { + return common.PointerString(request) +} + +// GetIdpGroupMappingResponse wrapper for the GetIdpGroupMapping operation +type GetIdpGroupMappingResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IdpGroupMapping instance + IdpGroupMapping `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response GetIdpGroupMappingResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/get_policy_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/get_policy_request_response.go new file mode 100644 index 0000000000..3bff5478cb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/get_policy_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetPolicyRequest wrapper for the GetPolicy operation +type GetPolicyRequest struct { + + // The OCID of the policy. + PolicyId *string `mandatory:"true" contributesTo:"path" name:"policyId"` +} + +func (request GetPolicyRequest) String() string { + return common.PointerString(request) +} + +// GetPolicyResponse wrapper for the GetPolicy operation +type GetPolicyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Policy instance + Policy `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response GetPolicyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/get_tenancy_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/get_tenancy_request_response.go new file mode 100644 index 0000000000..8ad0f641d4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/get_tenancy_request_response.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetTenancyRequest wrapper for the GetTenancy operation +type GetTenancyRequest struct { + + // The OCID of the tenancy. + TenancyId *string `mandatory:"true" contributesTo:"path" name:"tenancyId"` +} + +func (request GetTenancyRequest) String() string { + return common.PointerString(request) +} + +// GetTenancyResponse wrapper for the GetTenancy operation +type GetTenancyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Tenancy instance + Tenancy `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetTenancyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/get_user_group_membership_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/get_user_group_membership_request_response.go new file mode 100644 index 0000000000..492240dbfe --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/get_user_group_membership_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetUserGroupMembershipRequest wrapper for the GetUserGroupMembership operation +type GetUserGroupMembershipRequest struct { + + // The OCID of the userGroupMembership. + UserGroupMembershipId *string `mandatory:"true" contributesTo:"path" name:"userGroupMembershipId"` +} + +func (request GetUserGroupMembershipRequest) String() string { + return common.PointerString(request) +} + +// GetUserGroupMembershipResponse wrapper for the GetUserGroupMembership operation +type GetUserGroupMembershipResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The UserGroupMembership instance + UserGroupMembership `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response GetUserGroupMembershipResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/get_user_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/get_user_request_response.go new file mode 100644 index 0000000000..980955dad7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/get_user_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetUserRequest wrapper for the GetUser operation +type GetUserRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` +} + +func (request GetUserRequest) String() string { + return common.PointerString(request) +} + +// GetUserResponse wrapper for the GetUser operation +type GetUserResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The User instance + User `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response GetUserResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/group.go b/vendor/github.com/oracle/oci-go-sdk/identity/group.go new file mode 100644 index 0000000000..8029ba9504 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/group.go @@ -0,0 +1,84 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Group A collection of users who all need the same type of access to a particular set of resources or compartment. +// For conceptual information about groups and other IAM Service components, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// If you're federating with an identity provider (IdP), you need to create mappings between the groups +// defined in the IdP and groups you define in the IAM service. For more information, see +// Identity Providers and Federation (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/federation.htm). Also see +// IdentityProvider and +// IdpGroupMapping. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Group struct { + + // The OCID of the group. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the tenancy containing the group. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the group during creation. The name must be unique across all groups in + // the tenancy and cannot be changed. + Name *string `mandatory:"true" json:"name"` + + // The description you assign to the group. Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` + + // Date and time the group was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The group's current state. After creating a group, make sure its `lifecycleState` changes from CREATING to + // ACTIVE before using it. + LifecycleState GroupLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m Group) String() string { + return common.PointerString(m) +} + +// GroupLifecycleStateEnum Enum with underlying type: string +type GroupLifecycleStateEnum string + +// Set of constants representing the allowable values for GroupLifecycleState +const ( + GroupLifecycleStateCreating GroupLifecycleStateEnum = "CREATING" + GroupLifecycleStateActive GroupLifecycleStateEnum = "ACTIVE" + GroupLifecycleStateInactive GroupLifecycleStateEnum = "INACTIVE" + GroupLifecycleStateDeleting GroupLifecycleStateEnum = "DELETING" + GroupLifecycleStateDeleted GroupLifecycleStateEnum = "DELETED" +) + +var mappingGroupLifecycleState = map[string]GroupLifecycleStateEnum{ + "CREATING": GroupLifecycleStateCreating, + "ACTIVE": GroupLifecycleStateActive, + "INACTIVE": GroupLifecycleStateInactive, + "DELETING": GroupLifecycleStateDeleting, + "DELETED": GroupLifecycleStateDeleted, +} + +// GetGroupLifecycleStateEnumValues Enumerates the set of values for GroupLifecycleState +func GetGroupLifecycleStateEnumValues() []GroupLifecycleStateEnum { + values := make([]GroupLifecycleStateEnum, 0) + for _, v := range mappingGroupLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/identity_client.go b/vendor/github.com/oracle/oci-go-sdk/identity/identity_client.go new file mode 100644 index 0000000000..8bf0c90c5b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/identity_client.go @@ -0,0 +1,1167 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +//IdentityClient a client for Identity +type IdentityClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewIdentityClientWithConfigurationProvider Creates a new default Identity client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewIdentityClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client IdentityClient, err error) { + baseClient, err := common.NewClientWithConfig(configProvider) + if err != nil { + return + } + + client = IdentityClient{BaseClient: baseClient} + client.BasePath = "20160918" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *IdentityClient) SetRegion(region string) { + client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "identity", region) +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *IdentityClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.config = &configProvider + client.SetRegion(region) + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *IdentityClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// AddUserToGroup Adds the specified user to the specified group and returns a `UserGroupMembership` object with its own OCID. +// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the +// object, first make sure its `lifecycleState` has changed to ACTIVE. +func (client IdentityClient) AddUserToGroup(ctx context.Context, request AddUserToGroupRequest) (response AddUserToGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/userGroupMemberships/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateCompartment Creates a new compartment in your tenancy. +// **Important:** Compartments cannot be deleted. +// You must specify your tenancy's OCID as the compartment ID in the request object. Remember that the tenancy +// is simply the root compartment. For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You must also specify a *name* for the compartment, which must be unique across all compartments in +// your tenancy. You can use this name or the OCID when writing policies that apply +// to the compartment. For more information about policies, see +// How Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policies.htm). +// You must also specify a *description* for the compartment (although it can be an empty string). It does +// not have to be unique, and you can change it anytime with +// UpdateCompartment. +// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the +// object, first make sure its `lifecycleState` has changed to ACTIVE. +func (client IdentityClient) CreateCompartment(ctx context.Context, request CreateCompartmentRequest) (response CreateCompartmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/compartments/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateCustomerSecretKey Creates a new secret key for the specified user. Secret keys are used for authentication with the Object Storage Service's Amazon S3 +// compatible API. For information, see +// Managing User Credentials (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingcredentials.htm). +// You must specify a *description* for the secret key (although it can be an empty string). It does not +// have to be unique, and you can change it anytime with +// UpdateCustomerSecretKey. +// Every user has permission to create a secret key for *their own user ID*. An administrator in your organization +// does not need to write a policy to give users this ability. To compare, administrators who have permission to the +// tenancy can use this operation to create a secret key for any user, including themselves. +func (client IdentityClient) CreateCustomerSecretKey(ctx context.Context, request CreateCustomerSecretKeyRequest) (response CreateCustomerSecretKeyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/users/{userId}/customerSecretKeys/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateGroup Creates a new group in your tenancy. +// You must specify your tenancy's OCID as the compartment ID in the request object (remember that the tenancy +// is simply the root compartment). Notice that IAM resources (users, groups, compartments, and some policies) +// reside within the tenancy itself, unlike cloud resources such as compute instances, which typically +// reside within compartments inside the tenancy. For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You must also specify a *name* for the group, which must be unique across all groups in your tenancy and +// cannot be changed. You can use this name or the OCID when writing policies that apply to the group. For more +// information about policies, see How Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policies.htm). +// You must also specify a *description* for the group (although it can be an empty string). It does not +// have to be unique, and you can change it anytime with UpdateGroup. +// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the +// object, first make sure its `lifecycleState` has changed to ACTIVE. +// After creating the group, you need to put users in it and write policies for it. +// See AddUserToGroup and +// CreatePolicy. +func (client IdentityClient) CreateGroup(ctx context.Context, request CreateGroupRequest) (response CreateGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/groups/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateIdentityProvider Creates a new identity provider in your tenancy. For more information, see +// Identity Providers and Federation (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/federation.htm). +// You must specify your tenancy's OCID as the compartment ID in the request object. +// Remember that the tenancy is simply the root compartment. For information about +// OCIDs, see Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You must also specify a *name* for the `IdentityProvider`, which must be unique +// across all `IdentityProvider` objects in your tenancy and cannot be changed. +// You must also specify a *description* for the `IdentityProvider` (although +// it can be an empty string). It does not have to be unique, and you can change +// it anytime with +// UpdateIdentityProvider. +// After you send your request, the new object's `lifecycleState` will temporarily +// be CREATING. Before using the object, first make sure its `lifecycleState` has +// changed to ACTIVE. +func (client IdentityClient) CreateIdentityProvider(ctx context.Context, request CreateIdentityProviderRequest) (response CreateIdentityProviderResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/identityProviders/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &identityprovider{}) + return +} + +// CreateIdpGroupMapping Creates a single mapping between an IdP group and an IAM Service +// Group. +func (client IdentityClient) CreateIdpGroupMapping(ctx context.Context, request CreateIdpGroupMappingRequest) (response CreateIdpGroupMappingResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/identityProviders/{identityProviderId}/groupMappings/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateOrResetUIPassword Creates a new Console one-time password for the specified user. For more information about user +// credentials, see User Credentials (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/usercredentials.htm). +// Use this operation after creating a new user, or if a user forgets their password. The new one-time +// password is returned to you in the response, and you must securely deliver it to the user. They'll +// be prompted to change this password the next time they sign in to the Console. If they don't change +// it within 7 days, the password will expire and you'll need to create a new one-time password for the +// user. +// **Note:** The user's Console login is the unique name you specified when you created the user +// (see CreateUser). +func (client IdentityClient) CreateOrResetUIPassword(ctx context.Context, request CreateOrResetUIPasswordRequest) (response CreateOrResetUIPasswordResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/users/{userId}/uiPassword", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreatePolicy Creates a new policy in the specified compartment (either the tenancy or another of your compartments). +// If you're new to policies, see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +// You must specify a *name* for the policy, which must be unique across all policies in your tenancy +// and cannot be changed. +// You must also specify a *description* for the policy (although it can be an empty string). It does not +// have to be unique, and you can change it anytime with UpdatePolicy. +// You must specify one or more policy statements in the statements array. For information about writing +// policies, see How Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policies.htm) and +// Common Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/commonpolicies.htm). +// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using the +// object, first make sure its `lifecycleState` has changed to ACTIVE. +// New policies take effect typically within 10 seconds. +func (client IdentityClient) CreatePolicy(ctx context.Context, request CreatePolicyRequest) (response CreatePolicyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/policies/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateRegionSubscription Creates a subscription to a region for a tenancy. +func (client IdentityClient) CreateRegionSubscription(ctx context.Context, request CreateRegionSubscriptionRequest) (response CreateRegionSubscriptionResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/tenancies/{tenancyId}/regionSubscriptions", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateSwiftPassword Creates a new Swift password for the specified user. For information about what Swift passwords are for, see +// Managing User Credentials (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingcredentials.htm). +// You must specify a *description* for the Swift password (although it can be an empty string). It does not +// have to be unique, and you can change it anytime with +// UpdateSwiftPassword. +// Every user has permission to create a Swift password for *their own user ID*. An administrator in your organization +// does not need to write a policy to give users this ability. To compare, administrators who have permission to the +// tenancy can use this operation to create a Swift password for any user, including themselves. +func (client IdentityClient) CreateSwiftPassword(ctx context.Context, request CreateSwiftPasswordRequest) (response CreateSwiftPasswordResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/users/{userId}/swiftPasswords/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateUser Creates a new user in your tenancy. For conceptual information about users, your tenancy, and other +// IAM Service components, see Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// You must specify your tenancy's OCID as the compartment ID in the request object (remember that the +// tenancy is simply the root compartment). Notice that IAM resources (users, groups, compartments, and +// some policies) reside within the tenancy itself, unlike cloud resources such as compute instances, +// which typically reside within compartments inside the tenancy. For information about OCIDs, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// You must also specify a *name* for the user, which must be unique across all users in your tenancy +// and cannot be changed. Allowed characters: No spaces. Only letters, numerals, hyphens, periods, +// underscores, +, and @. If you specify a name that's already in use, you'll get a 409 error. +// This name will be the user's login to the Console. You might want to pick a +// name that your company's own identity system (e.g., Active Directory, LDAP, etc.) already uses. +// If you delete a user and then create a new user with the same name, they'll be considered different +// users because they have different OCIDs. +// You must also specify a *description* for the user (although it can be an empty string). +// It does not have to be unique, and you can change it anytime with +// UpdateUser. You can use the field to provide the user's +// full name, a description, a nickname, or other information to generally identify the user. +// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before +// using the object, first make sure its `lifecycleState` has changed to ACTIVE. +// A new user has no permissions until you place the user in one or more groups (see +// AddUserToGroup). If the user needs to +// access the Console, you need to provide the user a password (see +// CreateOrResetUIPassword). +// If the user needs to access the Oracle Cloud Infrastructure REST API, you need to upload a +// public API signing key for that user (see +// Required Keys and OCIDs (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm) and also +// UploadApiKey). +// **Important:** Make sure to inform the new user which compartment(s) they have access to. +func (client IdentityClient) CreateUser(ctx context.Context, request CreateUserRequest) (response CreateUserResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/users/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteApiKey Deletes the specified API signing key for the specified user. +// Every user has permission to use this operation to delete a key for *their own user ID*. An +// administrator in your organization does not need to write a policy to give users this ability. +// To compare, administrators who have permission to the tenancy can use this operation to delete +// a key for any user, including themselves. +func (client IdentityClient) DeleteApiKey(ctx context.Context, request DeleteApiKeyRequest) (response DeleteApiKeyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/users/{userId}/apiKeys/{fingerprint}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteCustomerSecretKey Deletes the specified secret key for the specified user. +func (client IdentityClient) DeleteCustomerSecretKey(ctx context.Context, request DeleteCustomerSecretKeyRequest) (response DeleteCustomerSecretKeyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/users/{userId}/customerSecretKeys/{customerSecretKeyId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteGroup Deletes the specified group. The group must be empty. +func (client IdentityClient) DeleteGroup(ctx context.Context, request DeleteGroupRequest) (response DeleteGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/groups/{groupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteIdentityProvider Deletes the specified identity provider. The identity provider must not have +// any group mappings (see IdpGroupMapping). +func (client IdentityClient) DeleteIdentityProvider(ctx context.Context, request DeleteIdentityProviderRequest) (response DeleteIdentityProviderResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/identityProviders/{identityProviderId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteIdpGroupMapping Deletes the specified group mapping. +func (client IdentityClient) DeleteIdpGroupMapping(ctx context.Context, request DeleteIdpGroupMappingRequest) (response DeleteIdpGroupMappingResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/identityProviders/{identityProviderId}/groupMappings/{mappingId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeletePolicy Deletes the specified policy. The deletion takes effect typically within 10 seconds. +func (client IdentityClient) DeletePolicy(ctx context.Context, request DeletePolicyRequest) (response DeletePolicyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/policies/{policyId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteSwiftPassword Deletes the specified Swift password for the specified user. +func (client IdentityClient) DeleteSwiftPassword(ctx context.Context, request DeleteSwiftPasswordRequest) (response DeleteSwiftPasswordResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/users/{userId}/swiftPasswords/{swiftPasswordId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteUser Deletes the specified user. The user must not be in any groups. +func (client IdentityClient) DeleteUser(ctx context.Context, request DeleteUserRequest) (response DeleteUserResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/users/{userId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetCompartment Gets the specified compartment's information. +// This operation does not return a list of all the resources inside the compartment. There is no single +// API operation that does that. Compartments can contain multiple types of resources (instances, block +// storage volumes, etc.). To find out what's in a compartment, you must call the "List" operation for +// each resource type and specify the compartment's OCID as a query parameter in the request. For example, +// call the ListInstances operation in the Cloud Compute +// Service or the ListVolumes operation in Cloud Block Storage. +func (client IdentityClient) GetCompartment(ctx context.Context, request GetCompartmentRequest) (response GetCompartmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/compartments/{compartmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetGroup Gets the specified group's information. +// This operation does not return a list of all the users in the group. To do that, use +// ListUserGroupMemberships and +// provide the group's OCID as a query parameter in the request. +func (client IdentityClient) GetGroup(ctx context.Context, request GetGroupRequest) (response GetGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/groups/{groupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetIdentityProvider Gets the specified identity provider's information. +func (client IdentityClient) GetIdentityProvider(ctx context.Context, request GetIdentityProviderRequest) (response GetIdentityProviderResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/identityProviders/{identityProviderId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &identityprovider{}) + return +} + +// GetIdpGroupMapping Gets the specified group mapping. +func (client IdentityClient) GetIdpGroupMapping(ctx context.Context, request GetIdpGroupMappingRequest) (response GetIdpGroupMappingResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/identityProviders/{identityProviderId}/groupMappings/{mappingId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetPolicy Gets the specified policy's information. +func (client IdentityClient) GetPolicy(ctx context.Context, request GetPolicyRequest) (response GetPolicyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/policies/{policyId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetTenancy Get the specified tenancy's information. +func (client IdentityClient) GetTenancy(ctx context.Context, request GetTenancyRequest) (response GetTenancyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/tenancies/{tenancyId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetUser Gets the specified user's information. +func (client IdentityClient) GetUser(ctx context.Context, request GetUserRequest) (response GetUserResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/users/{userId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetUserGroupMembership Gets the specified UserGroupMembership's information. +func (client IdentityClient) GetUserGroupMembership(ctx context.Context, request GetUserGroupMembershipRequest) (response GetUserGroupMembershipResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/userGroupMemberships/{userGroupMembershipId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListApiKeys Lists the API signing keys for the specified user. A user can have a maximum of three keys. +// Every user has permission to use this API call for *their own user ID*. An administrator in your +// organization does not need to write a policy to give users this ability. +func (client IdentityClient) ListApiKeys(ctx context.Context, request ListApiKeysRequest) (response ListApiKeysResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/users/{userId}/apiKeys/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListAvailabilityDomains Lists the Availability Domains in your tenancy. Specify the OCID of either the tenancy or another +// of your compartments as the value for the compartment ID (remember that the tenancy is simply the root compartment). +// See Where to Get the Tenancy's OCID and User's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five). +func (client IdentityClient) ListAvailabilityDomains(ctx context.Context, request ListAvailabilityDomainsRequest) (response ListAvailabilityDomainsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/availabilityDomains/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListCompartments Lists the compartments in your tenancy. You must specify your tenancy's OCID as the value +// for the compartment ID (remember that the tenancy is simply the root compartment). +// See Where to Get the Tenancy's OCID and User's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five). +func (client IdentityClient) ListCompartments(ctx context.Context, request ListCompartmentsRequest) (response ListCompartmentsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/compartments/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListCustomerSecretKeys Lists the secret keys for the specified user. The returned object contains the secret key's OCID, but not +// the secret key itself. The actual secret key is returned only upon creation. +func (client IdentityClient) ListCustomerSecretKeys(ctx context.Context, request ListCustomerSecretKeysRequest) (response ListCustomerSecretKeysResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/users/{userId}/customerSecretKeys/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListFaultDomains Lists the Fault Domains in your tenancy. Specify the OCID of either the tenancy or another +// of your compartments as the value for the compartment ID (remember that the tenancy is simply the root compartment). +// See Where to Get the Tenancy's OCID and User's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five). +func (client IdentityClient) ListFaultDomains(ctx context.Context, request ListFaultDomainsRequest) (response ListFaultDomainsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/faultDomains/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListGroups Lists the groups in your tenancy. You must specify your tenancy's OCID as the value for +// the compartment ID (remember that the tenancy is simply the root compartment). +// See Where to Get the Tenancy's OCID and User's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five). +func (client IdentityClient) ListGroups(ctx context.Context, request ListGroupsRequest) (response ListGroupsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/groups/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +//listidentityprovider allows to unmarshal list of polymorphic IdentityProvider +type listidentityprovider []identityprovider + +//UnmarshalPolymorphicJSON unmarshals polymorphic json list of items +func (m *listidentityprovider) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + res := make([]IdentityProvider, len(*m)) + for i, v := range *m { + nn, err := v.UnmarshalPolymorphicJSON(v.JsonData) + if err != nil { + return nil, err + } + res[i] = nn.(IdentityProvider) + } + return res, nil +} + +// ListIdentityProviders Lists all the identity providers in your tenancy. You must specify the identity provider type (e.g., `SAML2` for +// identity providers using the SAML2.0 protocol). You must specify your tenancy's OCID as the value for the +// compartment ID (remember that the tenancy is simply the root compartment). +// See Where to Get the Tenancy's OCID and User's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five). +func (client IdentityClient) ListIdentityProviders(ctx context.Context, request ListIdentityProvidersRequest) (response ListIdentityProvidersResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/identityProviders/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &listidentityprovider{}) + return +} + +// ListIdpGroupMappings Lists the group mappings for the specified identity provider. +func (client IdentityClient) ListIdpGroupMappings(ctx context.Context, request ListIdpGroupMappingsRequest) (response ListIdpGroupMappingsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/identityProviders/{identityProviderId}/groupMappings/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListPolicies Lists the policies in the specified compartment (either the tenancy or another of your compartments). +// See Where to Get the Tenancy's OCID and User's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five). +// To determine which policies apply to a particular group or compartment, you must view the individual +// statements inside all your policies. There isn't a way to automatically obtain that information via the API. +func (client IdentityClient) ListPolicies(ctx context.Context, request ListPoliciesRequest) (response ListPoliciesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/policies/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListRegionSubscriptions Lists the region subscriptions for the specified tenancy. +func (client IdentityClient) ListRegionSubscriptions(ctx context.Context, request ListRegionSubscriptionsRequest) (response ListRegionSubscriptionsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/tenancies/{tenancyId}/regionSubscriptions", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListRegions Lists all the regions offered by Oracle Cloud Infrastructure. +func (client IdentityClient) ListRegions(ctx context.Context) (response ListRegionsResponse, err error) { + httpRequest := common.MakeDefaultHTTPRequest(http.MethodGet, "/regions") + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListSwiftPasswords Lists the Swift passwords for the specified user. The returned object contains the password's OCID, but not +// the password itself. The actual password is returned only upon creation. +func (client IdentityClient) ListSwiftPasswords(ctx context.Context, request ListSwiftPasswordsRequest) (response ListSwiftPasswordsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/users/{userId}/swiftPasswords/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListUserGroupMemberships Lists the `UserGroupMembership` objects in your tenancy. You must specify your tenancy's OCID +// as the value for the compartment ID +// (see Where to Get the Tenancy's OCID and User's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five)). +// You must also then filter the list in one of these ways: +// - You can limit the results to just the memberships for a given user by specifying a `userId`. +// - Similarly, you can limit the results to just the memberships for a given group by specifying a `groupId`. +// - You can set both the `userId` and `groupId` to determine if the specified user is in the specified group. +// If the answer is no, the response is an empty list. +func (client IdentityClient) ListUserGroupMemberships(ctx context.Context, request ListUserGroupMembershipsRequest) (response ListUserGroupMembershipsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/userGroupMemberships/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListUsers Lists the users in your tenancy. You must specify your tenancy's OCID as the value for the +// compartment ID (remember that the tenancy is simply the root compartment). +// See Where to Get the Tenancy's OCID and User's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five). +func (client IdentityClient) ListUsers(ctx context.Context, request ListUsersRequest) (response ListUsersResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/users/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// RemoveUserFromGroup Removes a user from a group by deleting the corresponding `UserGroupMembership`. +func (client IdentityClient) RemoveUserFromGroup(ctx context.Context, request RemoveUserFromGroupRequest) (response RemoveUserFromGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/userGroupMemberships/{userGroupMembershipId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateCompartment Updates the specified compartment's description or name. You can't update the root compartment. +func (client IdentityClient) UpdateCompartment(ctx context.Context, request UpdateCompartmentRequest) (response UpdateCompartmentResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/compartments/{compartmentId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateCustomerSecretKey Updates the specified secret key's description. +func (client IdentityClient) UpdateCustomerSecretKey(ctx context.Context, request UpdateCustomerSecretKeyRequest) (response UpdateCustomerSecretKeyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/users/{userId}/customerSecretKeys/{customerSecretKeyId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateGroup Updates the specified group. +func (client IdentityClient) UpdateGroup(ctx context.Context, request UpdateGroupRequest) (response UpdateGroupResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/groups/{groupId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateIdentityProvider Updates the specified identity provider. +func (client IdentityClient) UpdateIdentityProvider(ctx context.Context, request UpdateIdentityProviderRequest) (response UpdateIdentityProviderResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/identityProviders/{identityProviderId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponseWithPolymorphicBody(httpResponse, &response, &identityprovider{}) + return +} + +// UpdateIdpGroupMapping Updates the specified group mapping. +func (client IdentityClient) UpdateIdpGroupMapping(ctx context.Context, request UpdateIdpGroupMappingRequest) (response UpdateIdpGroupMappingResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/identityProviders/{identityProviderId}/groupMappings/{mappingId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdatePolicy Updates the specified policy. You can update the description or the policy statements themselves. +// Policy changes take effect typically within 10 seconds. +func (client IdentityClient) UpdatePolicy(ctx context.Context, request UpdatePolicyRequest) (response UpdatePolicyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/policies/{policyId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateSwiftPassword Updates the specified Swift password's description. +func (client IdentityClient) UpdateSwiftPassword(ctx context.Context, request UpdateSwiftPasswordRequest) (response UpdateSwiftPasswordResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/users/{userId}/swiftPasswords/{swiftPasswordId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateUser Updates the description of the specified user. +func (client IdentityClient) UpdateUser(ctx context.Context, request UpdateUserRequest) (response UpdateUserResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/users/{userId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateUserState Updates the state of the specified user. +func (client IdentityClient) UpdateUserState(ctx context.Context, request UpdateUserStateRequest) (response UpdateUserStateResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/users/{userId}/state/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UploadApiKey Uploads an API signing key for the specified user. +// Every user has permission to use this operation to upload a key for *their own user ID*. An +// administrator in your organization does not need to write a policy to give users this ability. +// To compare, administrators who have permission to the tenancy can use this operation to upload a +// key for any user, including themselves. +// **Important:** Even though you have permission to upload an API key, you might not yet +// have permission to do much else. If you try calling an operation unrelated to your own credential +// management (e.g., `ListUsers`, `LaunchInstance`) and receive an "unauthorized" error, +// check with an administrator to confirm which IAM Service group(s) you're in and what access +// you have. Also confirm you're working in the correct compartment. +// After you send your request, the new object's `lifecycleState` will temporarily be CREATING. Before using +// the object, first make sure its `lifecycleState` has changed to ACTIVE. +func (client IdentityClient) UploadApiKey(ctx context.Context, request UploadApiKeyRequest) (response UploadApiKeyResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/users/{userId}/apiKeys/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/identity_provider.go b/vendor/github.com/oracle/oci-go-sdk/identity/identity_provider.go new file mode 100644 index 0000000000..170df88799 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/identity_provider.go @@ -0,0 +1,185 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// IdentityProvider The resulting base object when you add an identity provider to your tenancy. A +// Saml2IdentityProvider +// is a specific type of `IdentityProvider` that supports the SAML 2.0 protocol. Each +// `IdentityProvider` object has its own OCID. For more information, see +// Identity Providers and Federation (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/federation.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type IdentityProvider interface { + + // The OCID of the `IdentityProvider`. + GetId() *string + + // The OCID of the tenancy containing the `IdentityProvider`. + GetCompartmentId() *string + + // The name you assign to the `IdentityProvider` during creation. The name + // must be unique across all `IdentityProvider` objects in the tenancy and + // cannot be changed. This is the name federated users see when choosing + // which identity provider to use when signing in to the Oracle Cloud Infrastructure + // Console. + GetName() *string + + // The description you assign to the `IdentityProvider` during creation. Does + // not have to be unique, and it's changeable. + GetDescription() *string + + // The identity provider service or product. + // Supported identity providers are Oracle Identity Cloud Service (IDCS) and Microsoft + // Active Directory Federation Services (ADFS). + // Allowed values are: + // - `ADFS` + // - `IDCS` + // Example: `IDCS` + GetProductType() *string + + // Date and time the `IdentityProvider` was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + GetTimeCreated() *common.SDKTime + + // The current state. After creating an `IdentityProvider`, make sure its + // `lifecycleState` changes from CREATING to ACTIVE before using it. + GetLifecycleState() IdentityProviderLifecycleStateEnum + + // The detailed status of INACTIVE lifecycleState. + GetInactiveStatus() *int +} + +type identityprovider struct { + JsonData []byte + Id *string `mandatory:"true" json:"id"` + CompartmentId *string `mandatory:"true" json:"compartmentId"` + Name *string `mandatory:"true" json:"name"` + Description *string `mandatory:"true" json:"description"` + ProductType *string `mandatory:"true" json:"productType"` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + LifecycleState IdentityProviderLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` + Protocol string `json:"protocol"` +} + +// UnmarshalJSON unmarshals json +func (m *identityprovider) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshaleridentityprovider identityprovider + s := struct { + Model Unmarshaleridentityprovider + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.Id = s.Model.Id + m.CompartmentId = s.Model.CompartmentId + m.Name = s.Model.Name + m.Description = s.Model.Description + m.ProductType = s.Model.ProductType + m.TimeCreated = s.Model.TimeCreated + m.LifecycleState = s.Model.LifecycleState + m.InactiveStatus = s.Model.InactiveStatus + m.Protocol = s.Model.Protocol + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *identityprovider) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.Protocol { + case "SAML2": + mm := Saml2IdentityProvider{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +//GetId returns Id +func (m identityprovider) GetId() *string { + return m.Id +} + +//GetCompartmentId returns CompartmentId +func (m identityprovider) GetCompartmentId() *string { + return m.CompartmentId +} + +//GetName returns Name +func (m identityprovider) GetName() *string { + return m.Name +} + +//GetDescription returns Description +func (m identityprovider) GetDescription() *string { + return m.Description +} + +//GetProductType returns ProductType +func (m identityprovider) GetProductType() *string { + return m.ProductType +} + +//GetTimeCreated returns TimeCreated +func (m identityprovider) GetTimeCreated() *common.SDKTime { + return m.TimeCreated +} + +//GetLifecycleState returns LifecycleState +func (m identityprovider) GetLifecycleState() IdentityProviderLifecycleStateEnum { + return m.LifecycleState +} + +//GetInactiveStatus returns InactiveStatus +func (m identityprovider) GetInactiveStatus() *int { + return m.InactiveStatus +} + +func (m identityprovider) String() string { + return common.PointerString(m) +} + +// IdentityProviderLifecycleStateEnum Enum with underlying type: string +type IdentityProviderLifecycleStateEnum string + +// Set of constants representing the allowable values for IdentityProviderLifecycleState +const ( + IdentityProviderLifecycleStateCreating IdentityProviderLifecycleStateEnum = "CREATING" + IdentityProviderLifecycleStateActive IdentityProviderLifecycleStateEnum = "ACTIVE" + IdentityProviderLifecycleStateInactive IdentityProviderLifecycleStateEnum = "INACTIVE" + IdentityProviderLifecycleStateDeleting IdentityProviderLifecycleStateEnum = "DELETING" + IdentityProviderLifecycleStateDeleted IdentityProviderLifecycleStateEnum = "DELETED" +) + +var mappingIdentityProviderLifecycleState = map[string]IdentityProviderLifecycleStateEnum{ + "CREATING": IdentityProviderLifecycleStateCreating, + "ACTIVE": IdentityProviderLifecycleStateActive, + "INACTIVE": IdentityProviderLifecycleStateInactive, + "DELETING": IdentityProviderLifecycleStateDeleting, + "DELETED": IdentityProviderLifecycleStateDeleted, +} + +// GetIdentityProviderLifecycleStateEnumValues Enumerates the set of values for IdentityProviderLifecycleState +func GetIdentityProviderLifecycleStateEnumValues() []IdentityProviderLifecycleStateEnum { + values := make([]IdentityProviderLifecycleStateEnum, 0) + for _, v := range mappingIdentityProviderLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/idp_group_mapping.go b/vendor/github.com/oracle/oci-go-sdk/identity/idp_group_mapping.go new file mode 100644 index 0000000000..cf9c0100bc --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/idp_group_mapping.go @@ -0,0 +1,84 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// IdpGroupMapping A mapping between a single group defined by the identity provider (IdP) you're federating with +// and a single IAM Service Group in Oracle Cloud Infrastructure. +// For more information about group mappings and what they're for, see +// Identity Providers and Federation (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/federation.htm). +// A given IdP group can be mapped to zero, one, or multiple IAM Service groups, and vice versa. +// But each `IdPGroupMapping` object is between only a single IdP group and IAM Service group. +// Each `IdPGroupMapping` object has its own OCID. +// **Note:** Any users who are in more than 50 IdP groups cannot be authenticated to use the Oracle +// Cloud Infrastructure Console. +type IdpGroupMapping struct { + + // The OCID of the `IdpGroupMapping`. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the `IdentityProvider` this mapping belongs to. + IdpId *string `mandatory:"true" json:"idpId"` + + // The name of the IdP group that is mapped to the IAM Service group. + IdpGroupName *string `mandatory:"true" json:"idpGroupName"` + + // The OCID of the IAM Service group that is mapped to the IdP group. + GroupId *string `mandatory:"true" json:"groupId"` + + // The OCID of the tenancy containing the `IdentityProvider`. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Date and time the mapping was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The mapping's current state. After creating a mapping object, make sure its `lifecycleState` changes + // from CREATING to ACTIVE before using it. + LifecycleState IdpGroupMappingLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m IdpGroupMapping) String() string { + return common.PointerString(m) +} + +// IdpGroupMappingLifecycleStateEnum Enum with underlying type: string +type IdpGroupMappingLifecycleStateEnum string + +// Set of constants representing the allowable values for IdpGroupMappingLifecycleState +const ( + IdpGroupMappingLifecycleStateCreating IdpGroupMappingLifecycleStateEnum = "CREATING" + IdpGroupMappingLifecycleStateActive IdpGroupMappingLifecycleStateEnum = "ACTIVE" + IdpGroupMappingLifecycleStateInactive IdpGroupMappingLifecycleStateEnum = "INACTIVE" + IdpGroupMappingLifecycleStateDeleting IdpGroupMappingLifecycleStateEnum = "DELETING" + IdpGroupMappingLifecycleStateDeleted IdpGroupMappingLifecycleStateEnum = "DELETED" +) + +var mappingIdpGroupMappingLifecycleState = map[string]IdpGroupMappingLifecycleStateEnum{ + "CREATING": IdpGroupMappingLifecycleStateCreating, + "ACTIVE": IdpGroupMappingLifecycleStateActive, + "INACTIVE": IdpGroupMappingLifecycleStateInactive, + "DELETING": IdpGroupMappingLifecycleStateDeleting, + "DELETED": IdpGroupMappingLifecycleStateDeleted, +} + +// GetIdpGroupMappingLifecycleStateEnumValues Enumerates the set of values for IdpGroupMappingLifecycleState +func GetIdpGroupMappingLifecycleStateEnumValues() []IdpGroupMappingLifecycleStateEnum { + values := make([]IdpGroupMappingLifecycleStateEnum, 0) + for _, v := range mappingIdpGroupMappingLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_api_keys_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_api_keys_request_response.go new file mode 100644 index 0000000000..62ce550f5c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_api_keys_request_response.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListApiKeysRequest wrapper for the ListApiKeys operation +type ListApiKeysRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` +} + +func (request ListApiKeysRequest) String() string { + return common.PointerString(request) +} + +// ListApiKeysResponse wrapper for the ListApiKeys operation +type ListApiKeysResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []ApiKey instance + Items []ApiKey `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListApiKeysResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_availability_domains_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_availability_domains_request_response.go new file mode 100644 index 0000000000..407c2a36a6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_availability_domains_request_response.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListAvailabilityDomainsRequest wrapper for the ListAvailabilityDomains operation +type ListAvailabilityDomainsRequest struct { + + // The OCID of the compartment (remember that the tenancy is simply the root compartment). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` +} + +func (request ListAvailabilityDomainsRequest) String() string { + return common.PointerString(request) +} + +// ListAvailabilityDomainsResponse wrapper for the ListAvailabilityDomains operation +type ListAvailabilityDomainsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []AvailabilityDomain instance + Items []AvailabilityDomain `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListAvailabilityDomainsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_compartments_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_compartments_request_response.go new file mode 100644 index 0000000000..6d4338d3d3 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_compartments_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListCompartmentsRequest wrapper for the ListCompartments operation +type ListCompartmentsRequest struct { + + // The OCID of the compartment (remember that the tenancy is simply the root compartment). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The maximum number of items to return in a paginated "List" call. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` +} + +func (request ListCompartmentsRequest) String() string { + return common.PointerString(request) +} + +// ListCompartmentsResponse wrapper for the ListCompartments operation +type ListCompartmentsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Compartment instance + Items []Compartment `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListCompartmentsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_customer_secret_keys_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_customer_secret_keys_request_response.go new file mode 100644 index 0000000000..a1de6bb335 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_customer_secret_keys_request_response.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListCustomerSecretKeysRequest wrapper for the ListCustomerSecretKeys operation +type ListCustomerSecretKeysRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` +} + +func (request ListCustomerSecretKeysRequest) String() string { + return common.PointerString(request) +} + +// ListCustomerSecretKeysResponse wrapper for the ListCustomerSecretKeys operation +type ListCustomerSecretKeysResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []CustomerSecretKeySummary instance + Items []CustomerSecretKeySummary `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListCustomerSecretKeysResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_fault_domains_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_fault_domains_request_response.go new file mode 100644 index 0000000000..58e8cf4edb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_fault_domains_request_response.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListFaultDomainsRequest wrapper for the ListFaultDomains operation +type ListFaultDomainsRequest struct { + + // The OCID of the compartment (remember that the tenancy is simply the root compartment). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The name of the availibilityDomain. + AvailabilityDomain *string `mandatory:"true" contributesTo:"query" name:"availabilityDomain"` +} + +func (request ListFaultDomainsRequest) String() string { + return common.PointerString(request) +} + +// ListFaultDomainsResponse wrapper for the ListFaultDomains operation +type ListFaultDomainsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []FaultDomain instance + Items []FaultDomain `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListFaultDomainsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_groups_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_groups_request_response.go new file mode 100644 index 0000000000..b466a566f4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_groups_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListGroupsRequest wrapper for the ListGroups operation +type ListGroupsRequest struct { + + // The OCID of the compartment (remember that the tenancy is simply the root compartment). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The maximum number of items to return in a paginated "List" call. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` +} + +func (request ListGroupsRequest) String() string { + return common.PointerString(request) +} + +// ListGroupsResponse wrapper for the ListGroups operation +type ListGroupsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Group instance + Items []Group `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListGroupsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_identity_providers_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_identity_providers_request_response.go new file mode 100644 index 0000000000..abebf68770 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_identity_providers_request_response.go @@ -0,0 +1,73 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListIdentityProvidersRequest wrapper for the ListIdentityProviders operation +type ListIdentityProvidersRequest struct { + + // The protocol used for federation. + Protocol ListIdentityProvidersProtocolEnum `mandatory:"true" contributesTo:"query" name:"protocol" omitEmpty:"true"` + + // The OCID of the compartment (remember that the tenancy is simply the root compartment). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The maximum number of items to return in a paginated "List" call. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` +} + +func (request ListIdentityProvidersRequest) String() string { + return common.PointerString(request) +} + +// ListIdentityProvidersResponse wrapper for the ListIdentityProviders operation +type ListIdentityProvidersResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []IdentityProvider instance + Items []IdentityProvider `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListIdentityProvidersResponse) String() string { + return common.PointerString(response) +} + +// ListIdentityProvidersProtocolEnum Enum with underlying type: string +type ListIdentityProvidersProtocolEnum string + +// Set of constants representing the allowable values for ListIdentityProvidersProtocol +const ( + ListIdentityProvidersProtocolSaml2 ListIdentityProvidersProtocolEnum = "SAML2" +) + +var mappingListIdentityProvidersProtocol = map[string]ListIdentityProvidersProtocolEnum{ + "SAML2": ListIdentityProvidersProtocolSaml2, +} + +// GetListIdentityProvidersProtocolEnumValues Enumerates the set of values for ListIdentityProvidersProtocol +func GetListIdentityProvidersProtocolEnumValues() []ListIdentityProvidersProtocolEnum { + values := make([]ListIdentityProvidersProtocolEnum, 0) + for _, v := range mappingListIdentityProvidersProtocol { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_idp_group_mappings_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_idp_group_mappings_request_response.go new file mode 100644 index 0000000000..09323f6595 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_idp_group_mappings_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListIdpGroupMappingsRequest wrapper for the ListIdpGroupMappings operation +type ListIdpGroupMappingsRequest struct { + + // The OCID of the identity provider. + IdentityProviderId *string `mandatory:"true" contributesTo:"path" name:"identityProviderId"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The maximum number of items to return in a paginated "List" call. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` +} + +func (request ListIdpGroupMappingsRequest) String() string { + return common.PointerString(request) +} + +// ListIdpGroupMappingsResponse wrapper for the ListIdpGroupMappings operation +type ListIdpGroupMappingsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []IdpGroupMapping instance + Items []IdpGroupMapping `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListIdpGroupMappingsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_policies_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_policies_request_response.go new file mode 100644 index 0000000000..6b6461d28a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_policies_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListPoliciesRequest wrapper for the ListPolicies operation +type ListPoliciesRequest struct { + + // The OCID of the compartment (remember that the tenancy is simply the root compartment). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The maximum number of items to return in a paginated "List" call. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` +} + +func (request ListPoliciesRequest) String() string { + return common.PointerString(request) +} + +// ListPoliciesResponse wrapper for the ListPolicies operation +type ListPoliciesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Policy instance + Items []Policy `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListPoliciesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_region_subscriptions_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_region_subscriptions_request_response.go new file mode 100644 index 0000000000..a109176338 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_region_subscriptions_request_response.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListRegionSubscriptionsRequest wrapper for the ListRegionSubscriptions operation +type ListRegionSubscriptionsRequest struct { + + // The OCID of the tenancy. + TenancyId *string `mandatory:"true" contributesTo:"path" name:"tenancyId"` +} + +func (request ListRegionSubscriptionsRequest) String() string { + return common.PointerString(request) +} + +// ListRegionSubscriptionsResponse wrapper for the ListRegionSubscriptions operation +type ListRegionSubscriptionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []RegionSubscription instance + Items []RegionSubscription `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListRegionSubscriptionsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_regions_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_regions_request_response.go new file mode 100644 index 0000000000..528b6b8631 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_regions_request_response.go @@ -0,0 +1,35 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListRegionsRequest wrapper for the ListRegions operation +type ListRegionsRequest struct { +} + +func (request ListRegionsRequest) String() string { + return common.PointerString(request) +} + +// ListRegionsResponse wrapper for the ListRegions operation +type ListRegionsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Region instance + Items []Region `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListRegionsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_swift_passwords_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_swift_passwords_request_response.go new file mode 100644 index 0000000000..86d737c0fa --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_swift_passwords_request_response.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListSwiftPasswordsRequest wrapper for the ListSwiftPasswords operation +type ListSwiftPasswordsRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` +} + +func (request ListSwiftPasswordsRequest) String() string { + return common.PointerString(request) +} + +// ListSwiftPasswordsResponse wrapper for the ListSwiftPasswords operation +type ListSwiftPasswordsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []SwiftPassword instance + Items []SwiftPassword `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListSwiftPasswordsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_user_group_memberships_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_user_group_memberships_request_response.go new file mode 100644 index 0000000000..3f6d406b86 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_user_group_memberships_request_response.go @@ -0,0 +1,55 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListUserGroupMembershipsRequest wrapper for the ListUserGroupMemberships operation +type ListUserGroupMembershipsRequest struct { + + // The OCID of the compartment (remember that the tenancy is simply the root compartment). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID of the user. + UserId *string `mandatory:"false" contributesTo:"query" name:"userId"` + + // The OCID of the group. + GroupId *string `mandatory:"false" contributesTo:"query" name:"groupId"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The maximum number of items to return in a paginated "List" call. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` +} + +func (request ListUserGroupMembershipsRequest) String() string { + return common.PointerString(request) +} + +// ListUserGroupMembershipsResponse wrapper for the ListUserGroupMemberships operation +type ListUserGroupMembershipsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []UserGroupMembership instance + Items []UserGroupMembership `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListUserGroupMembershipsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/list_users_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/list_users_request_response.go new file mode 100644 index 0000000000..905d7e8c5b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/list_users_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListUsersRequest wrapper for the ListUsers operation +type ListUsersRequest struct { + + // The OCID of the compartment (remember that the tenancy is simply the root compartment). + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The value of the `opc-next-page` response header from the previous "List" call. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The maximum number of items to return in a paginated "List" call. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` +} + +func (request ListUsersRequest) String() string { + return common.PointerString(request) +} + +// ListUsersResponse wrapper for the ListUsers operation +type ListUsersResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []User instance + Items []User `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListUsersResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/policy.go b/vendor/github.com/oracle/oci-go-sdk/identity/policy.go new file mode 100644 index 0000000000..39eacc77a7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/policy.go @@ -0,0 +1,91 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Policy A document that specifies the type of access a group has to the resources in a compartment. For information about +// policies and other IAM Service components, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). If you're new to policies, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +// The word "policy" is used by people in different ways: +// * An individual statement written in the policy language +// * A collection of statements in a single, named "policy" document (which has an Oracle Cloud ID (OCID) assigned to it) +// * The overall body of policies your organization uses to control access to resources +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. +type Policy struct { + + // The OCID of the policy. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the compartment containing the policy (either the tenancy or another compartment). + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the policy during creation. The name must be unique across all policies + // in the tenancy and cannot be changed. + Name *string `mandatory:"true" json:"name"` + + // An array of one or more policy statements written in the policy language. + Statements []string `mandatory:"true" json:"statements"` + + // The description you assign to the policy. Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` + + // Date and time the policy was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The policy's current state. After creating a policy, make sure its `lifecycleState` changes from CREATING to + // ACTIVE before using it. + LifecycleState PolicyLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` + + // The version of the policy. If null or set to an empty string, when a request comes in for authorization, the + // policy will be evaluated according to the current behavior of the services at that moment. If set to a particular + // date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date. + VersionDate *common.SDKTime `mandatory:"false" json:"versionDate"` +} + +func (m Policy) String() string { + return common.PointerString(m) +} + +// PolicyLifecycleStateEnum Enum with underlying type: string +type PolicyLifecycleStateEnum string + +// Set of constants representing the allowable values for PolicyLifecycleState +const ( + PolicyLifecycleStateCreating PolicyLifecycleStateEnum = "CREATING" + PolicyLifecycleStateActive PolicyLifecycleStateEnum = "ACTIVE" + PolicyLifecycleStateInactive PolicyLifecycleStateEnum = "INACTIVE" + PolicyLifecycleStateDeleting PolicyLifecycleStateEnum = "DELETING" + PolicyLifecycleStateDeleted PolicyLifecycleStateEnum = "DELETED" +) + +var mappingPolicyLifecycleState = map[string]PolicyLifecycleStateEnum{ + "CREATING": PolicyLifecycleStateCreating, + "ACTIVE": PolicyLifecycleStateActive, + "INACTIVE": PolicyLifecycleStateInactive, + "DELETING": PolicyLifecycleStateDeleting, + "DELETED": PolicyLifecycleStateDeleted, +} + +// GetPolicyLifecycleStateEnumValues Enumerates the set of values for PolicyLifecycleState +func GetPolicyLifecycleStateEnumValues() []PolicyLifecycleStateEnum { + values := make([]PolicyLifecycleStateEnum, 0) + for _, v := range mappingPolicyLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/region.go b/vendor/github.com/oracle/oci-go-sdk/identity/region.go new file mode 100644 index 0000000000..ba73a44535 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/region.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Region A localized geographic area, such as Phoenix, AZ. Oracle Cloud Infrastructure is hosted in regions and Availability +// Domains. A region is composed of several Availability Domains. An Availability Domain is one or more data centers +// located within a region. For more information, see Regions and Availability Domains (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Region struct { + + // The key of the region. + // Allowed values are: + // - `PHX` + // - `IAD` + // - `FRA` + Key *string `mandatory:"false" json:"key"` + + // The name of the region. + // Allowed values are: + // - `us-phoenix-1` + // - `us-ashburn-1` + // - `eu-frankfurt-1` + Name *string `mandatory:"false" json:"name"` +} + +func (m Region) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/region_subscription.go b/vendor/github.com/oracle/oci-go-sdk/identity/region_subscription.go new file mode 100644 index 0000000000..dfa9f26b63 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/region_subscription.go @@ -0,0 +1,68 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// RegionSubscription An object that represents your tenancy's access to a particular region (i.e., a subscription), the status of that +// access, and whether that region is the home region. For more information, see Managing Regions (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingregions.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type RegionSubscription struct { + + // The region's key. + // Allowed values are: + // - `PHX` + // - `IAD` + // - `FRA` + RegionKey *string `mandatory:"true" json:"regionKey"` + + // The region's name. + // Allowed values are: + // - `us-phoenix-1` + // - `us-ashburn-1` + // - `eu-frankurt-1` + RegionName *string `mandatory:"true" json:"regionName"` + + // The region subscription status. + Status RegionSubscriptionStatusEnum `mandatory:"true" json:"status"` + + // Indicates if the region is the home region or not. + IsHomeRegion *bool `mandatory:"true" json:"isHomeRegion"` +} + +func (m RegionSubscription) String() string { + return common.PointerString(m) +} + +// RegionSubscriptionStatusEnum Enum with underlying type: string +type RegionSubscriptionStatusEnum string + +// Set of constants representing the allowable values for RegionSubscriptionStatus +const ( + RegionSubscriptionStatusReady RegionSubscriptionStatusEnum = "READY" + RegionSubscriptionStatusInProgress RegionSubscriptionStatusEnum = "IN_PROGRESS" +) + +var mappingRegionSubscriptionStatus = map[string]RegionSubscriptionStatusEnum{ + "READY": RegionSubscriptionStatusReady, + "IN_PROGRESS": RegionSubscriptionStatusInProgress, +} + +// GetRegionSubscriptionStatusEnumValues Enumerates the set of values for RegionSubscriptionStatus +func GetRegionSubscriptionStatusEnumValues() []RegionSubscriptionStatusEnum { + values := make([]RegionSubscriptionStatusEnum, 0) + for _, v := range mappingRegionSubscriptionStatus { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/remove_user_from_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/remove_user_from_group_request_response.go new file mode 100644 index 0000000000..afed269d0f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/remove_user_from_group_request_response.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// RemoveUserFromGroupRequest wrapper for the RemoveUserFromGroup operation +type RemoveUserFromGroupRequest struct { + + // The OCID of the userGroupMembership. + UserGroupMembershipId *string `mandatory:"true" contributesTo:"path" name:"userGroupMembershipId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request RemoveUserFromGroupRequest) String() string { + return common.PointerString(request) +} + +// RemoveUserFromGroupResponse wrapper for the RemoveUserFromGroup operation +type RemoveUserFromGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response RemoveUserFromGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/saml2_identity_provider.go b/vendor/github.com/oracle/oci-go-sdk/identity/saml2_identity_provider.go new file mode 100644 index 0000000000..0ef2511b3d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/saml2_identity_provider.go @@ -0,0 +1,127 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// Saml2IdentityProvider A special type of IdentityProvider that +// supports the SAML 2.0 protocol. For more information, see +// Identity Providers and Federation (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/federation.htm). +type Saml2IdentityProvider struct { + + // The OCID of the `IdentityProvider`. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the tenancy containing the `IdentityProvider`. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the `IdentityProvider` during creation. The name + // must be unique across all `IdentityProvider` objects in the tenancy and + // cannot be changed. This is the name federated users see when choosing + // which identity provider to use when signing in to the Oracle Cloud Infrastructure + // Console. + Name *string `mandatory:"true" json:"name"` + + // The description you assign to the `IdentityProvider` during creation. Does + // not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` + + // The identity provider service or product. + // Supported identity providers are Oracle Identity Cloud Service (IDCS) and Microsoft + // Active Directory Federation Services (ADFS). + // Allowed values are: + // - `ADFS` + // - `IDCS` + // Example: `IDCS` + ProductType *string `mandatory:"true" json:"productType"` + + // Date and time the `IdentityProvider` was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The URL for retrieving the identity provider's metadata, which + // contains information required for federating. + MetadataUrl *string `mandatory:"true" json:"metadataUrl"` + + // The identity provider's signing certificate used by the IAM Service + // to validate the SAML2 token. + SigningCertificate *string `mandatory:"true" json:"signingCertificate"` + + // The URL to redirect federated users to for authentication with the + // identity provider. + RedirectUrl *string `mandatory:"true" json:"redirectUrl"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` + + // The current state. After creating an `IdentityProvider`, make sure its + // `lifecycleState` changes from CREATING to ACTIVE before using it. + LifecycleState IdentityProviderLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` +} + +//GetId returns Id +func (m Saml2IdentityProvider) GetId() *string { + return m.Id +} + +//GetCompartmentId returns CompartmentId +func (m Saml2IdentityProvider) GetCompartmentId() *string { + return m.CompartmentId +} + +//GetName returns Name +func (m Saml2IdentityProvider) GetName() *string { + return m.Name +} + +//GetDescription returns Description +func (m Saml2IdentityProvider) GetDescription() *string { + return m.Description +} + +//GetProductType returns ProductType +func (m Saml2IdentityProvider) GetProductType() *string { + return m.ProductType +} + +//GetTimeCreated returns TimeCreated +func (m Saml2IdentityProvider) GetTimeCreated() *common.SDKTime { + return m.TimeCreated +} + +//GetLifecycleState returns LifecycleState +func (m Saml2IdentityProvider) GetLifecycleState() IdentityProviderLifecycleStateEnum { + return m.LifecycleState +} + +//GetInactiveStatus returns InactiveStatus +func (m Saml2IdentityProvider) GetInactiveStatus() *int { + return m.InactiveStatus +} + +func (m Saml2IdentityProvider) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m Saml2IdentityProvider) MarshalJSON() (buff []byte, e error) { + type MarshalTypeSaml2IdentityProvider Saml2IdentityProvider + s := struct { + DiscriminatorParam string `json:"protocol"` + MarshalTypeSaml2IdentityProvider + }{ + "SAML2", + (MarshalTypeSaml2IdentityProvider)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/swift_password.go b/vendor/github.com/oracle/oci-go-sdk/identity/swift_password.go new file mode 100644 index 0000000000..89a37c63c1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/swift_password.go @@ -0,0 +1,83 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// SwiftPassword Swift is the OpenStack object storage service. A `SwiftPassword` is an Oracle-provided password for using a +// Swift client with the Oracle Cloud Infrastructure Object Storage Service. This password is associated with +// the user's Console login. Swift passwords never expire. A user can have up to two Swift passwords at a time. +// **Note:** The password is always an Oracle-generated string; you can't change it to a string of your choice. +// For more information, see Managing User Credentials (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingcredentials.htm). +type SwiftPassword struct { + + // The Swift password. The value is available only in the response for `CreateSwiftPassword`, and not + // for `ListSwiftPasswords` or `UpdateSwiftPassword`. + Password *string `mandatory:"false" json:"password"` + + // The OCID of the Swift password. + Id *string `mandatory:"false" json:"id"` + + // The OCID of the user the password belongs to. + UserId *string `mandatory:"false" json:"userId"` + + // The description you assign to the Swift password. Does not have to be unique, and it's changeable. + Description *string `mandatory:"false" json:"description"` + + // Date and time the `SwiftPassword` object was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // Date and time when this password will expire, in the format defined by RFC3339. + // Null if it never expires. + // Example: `2016-08-25T21:10:29.600Z` + ExpiresOn *common.SDKTime `mandatory:"false" json:"expiresOn"` + + // The password's current state. After creating a password, make sure its `lifecycleState` changes from + // CREATING to ACTIVE before using it. + LifecycleState SwiftPasswordLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m SwiftPassword) String() string { + return common.PointerString(m) +} + +// SwiftPasswordLifecycleStateEnum Enum with underlying type: string +type SwiftPasswordLifecycleStateEnum string + +// Set of constants representing the allowable values for SwiftPasswordLifecycleState +const ( + SwiftPasswordLifecycleStateCreating SwiftPasswordLifecycleStateEnum = "CREATING" + SwiftPasswordLifecycleStateActive SwiftPasswordLifecycleStateEnum = "ACTIVE" + SwiftPasswordLifecycleStateInactive SwiftPasswordLifecycleStateEnum = "INACTIVE" + SwiftPasswordLifecycleStateDeleting SwiftPasswordLifecycleStateEnum = "DELETING" + SwiftPasswordLifecycleStateDeleted SwiftPasswordLifecycleStateEnum = "DELETED" +) + +var mappingSwiftPasswordLifecycleState = map[string]SwiftPasswordLifecycleStateEnum{ + "CREATING": SwiftPasswordLifecycleStateCreating, + "ACTIVE": SwiftPasswordLifecycleStateActive, + "INACTIVE": SwiftPasswordLifecycleStateInactive, + "DELETING": SwiftPasswordLifecycleStateDeleting, + "DELETED": SwiftPasswordLifecycleStateDeleted, +} + +// GetSwiftPasswordLifecycleStateEnumValues Enumerates the set of values for SwiftPasswordLifecycleState +func GetSwiftPasswordLifecycleStateEnumValues() []SwiftPasswordLifecycleStateEnum { + values := make([]SwiftPasswordLifecycleStateEnum, 0) + for _, v := range mappingSwiftPasswordLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/tenancy.go b/vendor/github.com/oracle/oci-go-sdk/identity/tenancy.go new file mode 100644 index 0000000000..676b91b9ab --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/tenancy.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Tenancy The root compartment that contains all of your organization's compartments and other +// Oracle Cloud Infrastructure cloud resources. When you sign up for Oracle Cloud Infrastructure, +// Oracle creates a tenancy for your company, which is a secure and isolated partition +// where you can create, organize, and administer your cloud resources. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Tenancy struct { + + // The OCID of the tenancy. + Id *string `mandatory:"false" json:"id"` + + // The name of the tenancy. + Name *string `mandatory:"false" json:"name"` + + // The description of the tenancy. + Description *string `mandatory:"false" json:"description"` + + // The region key for the tenancy's home region. + // Allowed values are: + // - `IAD` + // - `PHX` + // - `FRA` + HomeRegionKey *string `mandatory:"false" json:"homeRegionKey"` +} + +func (m Tenancy) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/ui_password.go b/vendor/github.com/oracle/oci-go-sdk/identity/ui_password.go new file mode 100644 index 0000000000..d0ff899977 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/ui_password.go @@ -0,0 +1,69 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UiPassword A text password that enables a user to sign in to the Console, the user interface for interacting with Oracle +// Cloud Infrastructure. +// For more information about user credentials, see User Credentials (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/usercredentials.htm). +type UiPassword struct { + + // The user's password for the Console. + Password *string `mandatory:"false" json:"password"` + + // The OCID of the user. + UserId *string `mandatory:"false" json:"userId"` + + // Date and time the password was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The password's current state. After creating a password, make sure its `lifecycleState` changes from + // CREATING to ACTIVE before using it. + LifecycleState UiPasswordLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m UiPassword) String() string { + return common.PointerString(m) +} + +// UiPasswordLifecycleStateEnum Enum with underlying type: string +type UiPasswordLifecycleStateEnum string + +// Set of constants representing the allowable values for UiPasswordLifecycleState +const ( + UiPasswordLifecycleStateCreating UiPasswordLifecycleStateEnum = "CREATING" + UiPasswordLifecycleStateActive UiPasswordLifecycleStateEnum = "ACTIVE" + UiPasswordLifecycleStateInactive UiPasswordLifecycleStateEnum = "INACTIVE" + UiPasswordLifecycleStateDeleting UiPasswordLifecycleStateEnum = "DELETING" + UiPasswordLifecycleStateDeleted UiPasswordLifecycleStateEnum = "DELETED" +) + +var mappingUiPasswordLifecycleState = map[string]UiPasswordLifecycleStateEnum{ + "CREATING": UiPasswordLifecycleStateCreating, + "ACTIVE": UiPasswordLifecycleStateActive, + "INACTIVE": UiPasswordLifecycleStateInactive, + "DELETING": UiPasswordLifecycleStateDeleting, + "DELETED": UiPasswordLifecycleStateDeleted, +} + +// GetUiPasswordLifecycleStateEnumValues Enumerates the set of values for UiPasswordLifecycleState +func GetUiPasswordLifecycleStateEnumValues() []UiPasswordLifecycleStateEnum { + values := make([]UiPasswordLifecycleStateEnum, 0) + for _, v := range mappingUiPasswordLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_compartment_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_compartment_details.go new file mode 100644 index 0000000000..0e064808c4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_compartment_details.go @@ -0,0 +1,27 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateCompartmentDetails The representation of UpdateCompartmentDetails +type UpdateCompartmentDetails struct { + + // The description you assign to the compartment. Does not have to be unique, and it's changeable. + Description *string `mandatory:"false" json:"description"` + + // The new name you assign to the compartment. The name must be unique across all compartments in the tenancy. + Name *string `mandatory:"false" json:"name"` +} + +func (m UpdateCompartmentDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_compartment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_compartment_request_response.go new file mode 100644 index 0000000000..217bc68778 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_compartment_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateCompartmentRequest wrapper for the UpdateCompartment operation +type UpdateCompartmentRequest struct { + + // The OCID of the compartment. + CompartmentId *string `mandatory:"true" contributesTo:"path" name:"compartmentId"` + + // Request object for updating a compartment. + UpdateCompartmentDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateCompartmentRequest) String() string { + return common.PointerString(request) +} + +// UpdateCompartmentResponse wrapper for the UpdateCompartment operation +type UpdateCompartmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Compartment instance + Compartment `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateCompartmentResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_customer_secret_key_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_customer_secret_key_details.go new file mode 100644 index 0000000000..397e183963 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_customer_secret_key_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateCustomerSecretKeyDetails The representation of UpdateCustomerSecretKeyDetails +type UpdateCustomerSecretKeyDetails struct { + + // The description you assign to the secret key. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` +} + +func (m UpdateCustomerSecretKeyDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_customer_secret_key_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_customer_secret_key_request_response.go new file mode 100644 index 0000000000..e722571e79 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_customer_secret_key_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateCustomerSecretKeyRequest wrapper for the UpdateCustomerSecretKey operation +type UpdateCustomerSecretKeyRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // The OCID of the secret key. + CustomerSecretKeyId *string `mandatory:"true" contributesTo:"path" name:"customerSecretKeyId"` + + // Request object for updating a secret key. + UpdateCustomerSecretKeyDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateCustomerSecretKeyRequest) String() string { + return common.PointerString(request) +} + +// UpdateCustomerSecretKeyResponse wrapper for the UpdateCustomerSecretKey operation +type UpdateCustomerSecretKeyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The CustomerSecretKeySummary instance + CustomerSecretKeySummary `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateCustomerSecretKeyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_group_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_group_details.go new file mode 100644 index 0000000000..35a082a90a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_group_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateGroupDetails The representation of UpdateGroupDetails +type UpdateGroupDetails struct { + + // The description you assign to the group. Does not have to be unique, and it's changeable. + Description *string `mandatory:"false" json:"description"` +} + +func (m UpdateGroupDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_group_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_group_request_response.go new file mode 100644 index 0000000000..75840e1c0a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_group_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateGroupRequest wrapper for the UpdateGroup operation +type UpdateGroupRequest struct { + + // The OCID of the group. + GroupId *string `mandatory:"true" contributesTo:"path" name:"groupId"` + + // Request object for updating a group. + UpdateGroupDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateGroupRequest) String() string { + return common.PointerString(request) +} + +// UpdateGroupResponse wrapper for the UpdateGroup operation +type UpdateGroupResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Group instance + Group `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateGroupResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_identity_provider_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_identity_provider_details.go new file mode 100644 index 0000000000..976c40edf6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_identity_provider_details.go @@ -0,0 +1,67 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateIdentityProviderDetails The representation of UpdateIdentityProviderDetails +type UpdateIdentityProviderDetails interface { + + // The description you assign to the `IdentityProvider`. Does not have to + // be unique, and it's changeable. + GetDescription() *string +} + +type updateidentityproviderdetails struct { + JsonData []byte + Description *string `mandatory:"false" json:"description"` + Protocol string `json:"protocol"` +} + +// UnmarshalJSON unmarshals json +func (m *updateidentityproviderdetails) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerupdateidentityproviderdetails updateidentityproviderdetails + s := struct { + Model Unmarshalerupdateidentityproviderdetails + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.Description = s.Model.Description + m.Protocol = s.Model.Protocol + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *updateidentityproviderdetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + var err error + switch m.Protocol { + case "SAML2": + mm := UpdateSaml2IdentityProviderDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + return m, nil + } +} + +//GetDescription returns Description +func (m updateidentityproviderdetails) GetDescription() *string { + return m.Description +} + +func (m updateidentityproviderdetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_identity_provider_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_identity_provider_request_response.go new file mode 100644 index 0000000000..e092b59f41 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_identity_provider_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateIdentityProviderRequest wrapper for the UpdateIdentityProvider operation +type UpdateIdentityProviderRequest struct { + + // The OCID of the identity provider. + IdentityProviderId *string `mandatory:"true" contributesTo:"path" name:"identityProviderId"` + + // Request object for updating a identity provider. + UpdateIdentityProviderDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateIdentityProviderRequest) String() string { + return common.PointerString(request) +} + +// UpdateIdentityProviderResponse wrapper for the UpdateIdentityProvider operation +type UpdateIdentityProviderResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IdentityProvider instance + IdentityProvider `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateIdentityProviderResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_idp_group_mapping_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_idp_group_mapping_details.go new file mode 100644 index 0000000000..bf7716f615 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_idp_group_mapping_details.go @@ -0,0 +1,27 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateIdpGroupMappingDetails The representation of UpdateIdpGroupMappingDetails +type UpdateIdpGroupMappingDetails struct { + + // The idp group name. + IdpGroupName *string `mandatory:"false" json:"idpGroupName"` + + // The OCID of the group. + GroupId *string `mandatory:"false" json:"groupId"` +} + +func (m UpdateIdpGroupMappingDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_idp_group_mapping_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_idp_group_mapping_request_response.go new file mode 100644 index 0000000000..be9dbd3dfc --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_idp_group_mapping_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateIdpGroupMappingRequest wrapper for the UpdateIdpGroupMapping operation +type UpdateIdpGroupMappingRequest struct { + + // The OCID of the identity provider. + IdentityProviderId *string `mandatory:"true" contributesTo:"path" name:"identityProviderId"` + + // The OCID of the group mapping. + MappingId *string `mandatory:"true" contributesTo:"path" name:"mappingId"` + + // Request object for updating an identity provider group mapping + UpdateIdpGroupMappingDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateIdpGroupMappingRequest) String() string { + return common.PointerString(request) +} + +// UpdateIdpGroupMappingResponse wrapper for the UpdateIdpGroupMapping operation +type UpdateIdpGroupMappingResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The IdpGroupMapping instance + IdpGroupMapping `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateIdpGroupMappingResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_policy_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_policy_details.go new file mode 100644 index 0000000000..3fd45b64eb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_policy_details.go @@ -0,0 +1,34 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdatePolicyDetails The representation of UpdatePolicyDetails +type UpdatePolicyDetails struct { + + // The description you assign to the policy. Does not have to be unique, and it's changeable. + Description *string `mandatory:"false" json:"description"` + + // An array of policy statements written in the policy language. See + // How Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policies.htm) and + // Common Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/commonpolicies.htm). + Statements []string `mandatory:"false" json:"statements"` + + // The version of the policy. If null or set to an empty string, when a request comes in for authorization, the + // policy will be evaluated according to the current behavior of the services at that moment. If set to a particular + // date (YYYY-MM-DD), the policy will be evaluated according to the behavior of the services on that date. + VersionDate *common.SDKTime `mandatory:"false" json:"versionDate"` +} + +func (m UpdatePolicyDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_policy_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_policy_request_response.go new file mode 100644 index 0000000000..198afbecd8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_policy_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdatePolicyRequest wrapper for the UpdatePolicy operation +type UpdatePolicyRequest struct { + + // The OCID of the policy. + PolicyId *string `mandatory:"true" contributesTo:"path" name:"policyId"` + + // Request object for updating a policy. + UpdatePolicyDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdatePolicyRequest) String() string { + return common.PointerString(request) +} + +// UpdatePolicyResponse wrapper for the UpdatePolicy operation +type UpdatePolicyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Policy instance + Policy `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdatePolicyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_saml2_identity_provider_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_saml2_identity_provider_details.go new file mode 100644 index 0000000000..f83217f2b6 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_saml2_identity_provider_details.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "encoding/json" + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateSaml2IdentityProviderDetails The representation of UpdateSaml2IdentityProviderDetails +type UpdateSaml2IdentityProviderDetails struct { + + // The description you assign to the `IdentityProvider`. Does not have to + // be unique, and it's changeable. + Description *string `mandatory:"false" json:"description"` + + // The URL for retrieving the identity provider's metadata, + // which contains information required for federating. + MetadataUrl *string `mandatory:"false" json:"metadataUrl"` + + // The XML that contains the information required for federating. + Metadata *string `mandatory:"false" json:"metadata"` +} + +//GetDescription returns Description +func (m UpdateSaml2IdentityProviderDetails) GetDescription() *string { + return m.Description +} + +func (m UpdateSaml2IdentityProviderDetails) String() string { + return common.PointerString(m) +} + +// MarshalJSON marshals to json representation +func (m UpdateSaml2IdentityProviderDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeUpdateSaml2IdentityProviderDetails UpdateSaml2IdentityProviderDetails + s := struct { + DiscriminatorParam string `json:"protocol"` + MarshalTypeUpdateSaml2IdentityProviderDetails + }{ + "SAML2", + (MarshalTypeUpdateSaml2IdentityProviderDetails)(m), + } + + return json.Marshal(&s) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_state_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_state_details.go new file mode 100644 index 0000000000..3c920d786c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_state_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateStateDetails The representation of UpdateStateDetails +type UpdateStateDetails struct { + + // Update state to blocked or unblocked. Only "false" is supported (for changing the state to unblocked). + Blocked *bool `mandatory:"false" json:"blocked"` +} + +func (m UpdateStateDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_swift_password_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_swift_password_details.go new file mode 100644 index 0000000000..7f987bf707 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_swift_password_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateSwiftPasswordDetails The representation of UpdateSwiftPasswordDetails +type UpdateSwiftPasswordDetails struct { + + // The description you assign to the Swift password. Does not have to be unique, and it's changeable. + Description *string `mandatory:"false" json:"description"` +} + +func (m UpdateSwiftPasswordDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_swift_password_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_swift_password_request_response.go new file mode 100644 index 0000000000..0ec212ff8f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_swift_password_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateSwiftPasswordRequest wrapper for the UpdateSwiftPassword operation +type UpdateSwiftPasswordRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // The OCID of the Swift password. + SwiftPasswordId *string `mandatory:"true" contributesTo:"path" name:"swiftPasswordId"` + + // Request object for updating a Swift password. + UpdateSwiftPasswordDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateSwiftPasswordRequest) String() string { + return common.PointerString(request) +} + +// UpdateSwiftPasswordResponse wrapper for the UpdateSwiftPassword operation +type UpdateSwiftPasswordResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The SwiftPassword instance + SwiftPassword `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateSwiftPasswordResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_user_details.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_user_details.go new file mode 100644 index 0000000000..07b2ce2a4c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_user_details.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateUserDetails The representation of UpdateUserDetails +type UpdateUserDetails struct { + + // The description you assign to the user. Does not have to be unique, and it's changeable. + Description *string `mandatory:"false" json:"description"` +} + +func (m UpdateUserDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_user_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_user_request_response.go new file mode 100644 index 0000000000..41565565e4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_user_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateUserRequest wrapper for the UpdateUser operation +type UpdateUserRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // Request object for updating a user. + UpdateUserDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateUserRequest) String() string { + return common.PointerString(request) +} + +// UpdateUserResponse wrapper for the UpdateUser operation +type UpdateUserResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The User instance + User `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateUserResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/update_user_state_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/update_user_state_request_response.go new file mode 100644 index 0000000000..f1e2c75142 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/update_user_state_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateUserStateRequest wrapper for the UpdateUserState operation +type UpdateUserStateRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // Request object for updating a user state. + UpdateStateDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + // parameter to the value of the etag from a previous GET or POST response for that resource. The resource + // will be updated or deleted only if the etag you provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` +} + +func (request UpdateUserStateRequest) String() string { + return common.PointerString(request) +} + +// UpdateUserStateResponse wrapper for the UpdateUserState operation +type UpdateUserStateResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The User instance + User `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateUserStateResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/upload_api_key_request_response.go b/vendor/github.com/oracle/oci-go-sdk/identity/upload_api_key_request_response.go new file mode 100644 index 0000000000..4a971b5262 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/upload_api_key_request_response.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UploadApiKeyRequest wrapper for the UploadApiKey operation +type UploadApiKeyRequest struct { + + // The OCID of the user. + UserId *string `mandatory:"true" contributesTo:"path" name:"userId"` + + // Request object for uploading an API key for a user. + CreateApiKeyDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request UploadApiKeyRequest) String() string { + return common.PointerString(request) +} + +// UploadApiKeyResponse wrapper for the UploadApiKey operation +type UploadApiKeyResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The ApiKey instance + ApiKey `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UploadApiKeyResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/user.go b/vendor/github.com/oracle/oci-go-sdk/identity/user.go new file mode 100644 index 0000000000..945e672e47 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/user.go @@ -0,0 +1,91 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// User An individual employee or system that needs to manage or use your company's Oracle Cloud Infrastructure +// resources. Users might need to launch instances, manage remote disks, work with your cloud network, etc. Users +// have one or more IAM Service credentials (ApiKey, +// UIPassword, and SwiftPassword). +// For more information, see User Credentials (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usercredentials.htm)). End users of your +// application are not typically IAM Service users. For conceptual information about users and other IAM Service +// components, see Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// These users are created directly within the Oracle Cloud Infrastructure system, via the IAM service. +// They are different from *federated users*, who authenticate themselves to the Oracle Cloud Infrastructure +// Console via an identity provider. For more information, see +// Identity Providers and Federation (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/federation.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, +// see Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type User struct { + + // The OCID of the user. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the tenancy containing the user. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The name you assign to the user during creation. This is the user's login for the Console. + // The name must be unique across all users in the tenancy and cannot be changed. + Name *string `mandatory:"true" json:"name"` + + // The description you assign to the user. Does not have to be unique, and it's changeable. + Description *string `mandatory:"true" json:"description"` + + // Date and time the user was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The user's current state. After creating a user, make sure its `lifecycleState` changes from CREATING to + // ACTIVE before using it. + LifecycleState UserLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // Returned only if the user's `lifecycleState` is INACTIVE. A 16-bit value showing the reason why the user + // is inactive: + // - bit 0: SUSPENDED (reserved for future use) + // - bit 1: DISABLED (reserved for future use) + // - bit 2: BLOCKED (the user has exceeded the maximum number of failed login attempts for the Console) + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m User) String() string { + return common.PointerString(m) +} + +// UserLifecycleStateEnum Enum with underlying type: string +type UserLifecycleStateEnum string + +// Set of constants representing the allowable values for UserLifecycleState +const ( + UserLifecycleStateCreating UserLifecycleStateEnum = "CREATING" + UserLifecycleStateActive UserLifecycleStateEnum = "ACTIVE" + UserLifecycleStateInactive UserLifecycleStateEnum = "INACTIVE" + UserLifecycleStateDeleting UserLifecycleStateEnum = "DELETING" + UserLifecycleStateDeleted UserLifecycleStateEnum = "DELETED" +) + +var mappingUserLifecycleState = map[string]UserLifecycleStateEnum{ + "CREATING": UserLifecycleStateCreating, + "ACTIVE": UserLifecycleStateActive, + "INACTIVE": UserLifecycleStateInactive, + "DELETING": UserLifecycleStateDeleting, + "DELETED": UserLifecycleStateDeleted, +} + +// GetUserLifecycleStateEnumValues Enumerates the set of values for UserLifecycleState +func GetUserLifecycleStateEnumValues() []UserLifecycleStateEnum { + values := make([]UserLifecycleStateEnum, 0) + for _, v := range mappingUserLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/identity/user_group_membership.go b/vendor/github.com/oracle/oci-go-sdk/identity/user_group_membership.go new file mode 100644 index 0000000000..f2b1a3aee7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/identity/user_group_membership.go @@ -0,0 +1,74 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Identity and Access Management Service API +// +// APIs for managing users, groups, compartments, and policies. +// + +package identity + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UserGroupMembership An object that represents the membership of a user in a group. When you add a user to a group, the result is a +// `UserGroupMembership` with its own OCID. To remove a user from a group, you delete the `UserGroupMembership` object. +type UserGroupMembership struct { + + // The OCID of the membership. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the tenancy containing the user, group, and membership object. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the group. + GroupId *string `mandatory:"true" json:"groupId"` + + // The OCID of the user. + UserId *string `mandatory:"true" json:"userId"` + + // Date and time the membership was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The membership's current state. After creating a membership object, make sure its `lifecycleState` changes + // from CREATING to ACTIVE before using it. + LifecycleState UserGroupMembershipLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The detailed status of INACTIVE lifecycleState. + InactiveStatus *int `mandatory:"false" json:"inactiveStatus"` +} + +func (m UserGroupMembership) String() string { + return common.PointerString(m) +} + +// UserGroupMembershipLifecycleStateEnum Enum with underlying type: string +type UserGroupMembershipLifecycleStateEnum string + +// Set of constants representing the allowable values for UserGroupMembershipLifecycleState +const ( + UserGroupMembershipLifecycleStateCreating UserGroupMembershipLifecycleStateEnum = "CREATING" + UserGroupMembershipLifecycleStateActive UserGroupMembershipLifecycleStateEnum = "ACTIVE" + UserGroupMembershipLifecycleStateInactive UserGroupMembershipLifecycleStateEnum = "INACTIVE" + UserGroupMembershipLifecycleStateDeleting UserGroupMembershipLifecycleStateEnum = "DELETING" + UserGroupMembershipLifecycleStateDeleted UserGroupMembershipLifecycleStateEnum = "DELETED" +) + +var mappingUserGroupMembershipLifecycleState = map[string]UserGroupMembershipLifecycleStateEnum{ + "CREATING": UserGroupMembershipLifecycleStateCreating, + "ACTIVE": UserGroupMembershipLifecycleStateActive, + "INACTIVE": UserGroupMembershipLifecycleStateInactive, + "DELETING": UserGroupMembershipLifecycleStateDeleting, + "DELETED": UserGroupMembershipLifecycleStateDeleted, +} + +// GetUserGroupMembershipLifecycleStateEnumValues Enumerates the set of values for UserGroupMembershipLifecycleState +func GetUserGroupMembershipLifecycleStateEnumValues() []UserGroupMembershipLifecycleStateEnum { + values := make([]UserGroupMembershipLifecycleStateEnum, 0) + for _, v := range mappingUserGroupMembershipLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend.go new file mode 100644 index 0000000000..ecca968c35 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Backend The configuration of a backend server that is a member of a load balancer backend set. +// For more information, see Managing Backend Servers (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/managingbackendservers.htm). +type Backend struct { + + // Whether the load balancer should treat this server as a backup unit. If `true`, the load balancer forwards no ingress + // traffic to this backend server unless all other backend servers not marked as "backup" fail the health check policy. + // Example: `true` + Backup *bool `mandatory:"true" json:"backup"` + + // Whether the load balancer should drain this server. Servers marked "drain" receive no new + // incoming traffic. + // Example: `true` + Drain *bool `mandatory:"true" json:"drain"` + + // The IP address of the backend server. + // Example: `10.10.10.4` + IpAddress *string `mandatory:"true" json:"ipAddress"` + + // A read-only field showing the IP address and port that uniquely identify this backend server in the backend set. + // Example: `10.10.10.4:8080` + Name *string `mandatory:"true" json:"name"` + + // Whether the load balancer should treat this server as offline. Offline servers receive no incoming + // traffic. + // Example: `true` + Offline *bool `mandatory:"true" json:"offline"` + + // The communication port for the backend server. + // Example: `8080` + Port *int `mandatory:"true" json:"port"` + + // The load balancing policy weight assigned to the server. Backend servers with a higher weight receive a larger + // proportion of incoming traffic. For example, a server weighted '3' receives 3 times the number of new connections + // as a server weighted '1'. + // For more information on load balancing policies, see + // How Load Balancing Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Reference/lbpolicies.htm). + // Example: `3` + Weight *int `mandatory:"true" json:"weight"` +} + +func (m Backend) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_details.go new file mode 100644 index 0000000000..a65e538e36 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_details.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BackendDetails The load balancing configuration details of a backend server. +type BackendDetails struct { + + // The IP address of the backend server. + // Example: `10.10.10.4` + IpAddress *string `mandatory:"true" json:"ipAddress"` + + // The communication port for the backend server. + // Example: `8080` + Port *int `mandatory:"true" json:"port"` + + // Whether the load balancer should treat this server as a backup unit. If `true`, the load balancer forwards no ingress + // traffic to this backend server unless all other backend servers not marked as "backup" fail the health check policy. + // Example: `true` + Backup *bool `mandatory:"false" json:"backup"` + + // Whether the load balancer should drain this server. Servers marked "drain" receive no new + // incoming traffic. + // Example: `true` + Drain *bool `mandatory:"false" json:"drain"` + + // Whether the load balancer should treat this server as offline. Offline servers receive no incoming + // traffic. + // Example: `true` + Offline *bool `mandatory:"false" json:"offline"` + + // The load balancing policy weight assigned to the server. Backend servers with a higher weight receive a larger + // proportion of incoming traffic. For example, a server weighted '3' receives 3 times the number of new connections + // as a server weighted '1'. + // For more information on load balancing policies, see + // How Load Balancing Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Reference/lbpolicies.htm). + // Example: `3` + Weight *int `mandatory:"false" json:"weight"` +} + +func (m BackendDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_health.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_health.go new file mode 100644 index 0000000000..ca8cbc42c8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_health.go @@ -0,0 +1,58 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BackendHealth The health status of the specified backend server as reported by the primary and standby load balancers. +type BackendHealth struct { + + // A list of the most recent health check results returned for the specified backend server. + HealthCheckResults []HealthCheckResult `mandatory:"true" json:"healthCheckResults"` + + // The general health status of the specified backend server as reported by the primary and standby load balancers. + // * **OK:** Both health checks returned `OK`. + // * **WARNING:** One health check returned `OK` and one did not. + // * **CRITICAL:** Neither health check returned `OK`. + // * **UNKNOWN:** One or both health checks returned `UNKNOWN`, or the system was unable to retrieve metrics at this time. + Status BackendHealthStatusEnum `mandatory:"true" json:"status"` +} + +func (m BackendHealth) String() string { + return common.PointerString(m) +} + +// BackendHealthStatusEnum Enum with underlying type: string +type BackendHealthStatusEnum string + +// Set of constants representing the allowable values for BackendHealthStatus +const ( + BackendHealthStatusOk BackendHealthStatusEnum = "OK" + BackendHealthStatusWarning BackendHealthStatusEnum = "WARNING" + BackendHealthStatusCritical BackendHealthStatusEnum = "CRITICAL" + BackendHealthStatusUnknown BackendHealthStatusEnum = "UNKNOWN" +) + +var mappingBackendHealthStatus = map[string]BackendHealthStatusEnum{ + "OK": BackendHealthStatusOk, + "WARNING": BackendHealthStatusWarning, + "CRITICAL": BackendHealthStatusCritical, + "UNKNOWN": BackendHealthStatusUnknown, +} + +// GetBackendHealthStatusEnumValues Enumerates the set of values for BackendHealthStatus +func GetBackendHealthStatusEnumValues() []BackendHealthStatusEnum { + values := make([]BackendHealthStatusEnum, 0) + for _, v := range mappingBackendHealthStatus { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_set.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_set.go new file mode 100644 index 0000000000..c47097c7a4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_set.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BackendSet The configuration of a load balancer backend set. +// For more information on backend set configuration, see +// Managing Backend Sets (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/tasks/managingbackendsets.htm). +type BackendSet struct { + Backends []Backend `mandatory:"true" json:"backends"` + + HealthChecker *HealthChecker `mandatory:"true" json:"healthChecker"` + + // A friendly name for the backend set. It must be unique and it cannot be changed. + // Valid backend set names include only alphanumeric characters, dashes, and underscores. Backend set names cannot + // contain spaces. Avoid entering confidential information. + // Example: `My_backend_set` + Name *string `mandatory:"true" json:"name"` + + // The load balancer policy for the backend set. To get a list of available policies, use the + // ListPolicies operation. + // Example: `LEAST_CONNECTIONS` + Policy *string `mandatory:"true" json:"policy"` + + SessionPersistenceConfiguration *SessionPersistenceConfigurationDetails `mandatory:"false" json:"sessionPersistenceConfiguration"` + + SslConfiguration *SslConfiguration `mandatory:"false" json:"sslConfiguration"` +} + +func (m BackendSet) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_set_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_set_details.go new file mode 100644 index 0000000000..dad4d65910 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_set_details.go @@ -0,0 +1,35 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BackendSetDetails The configuration details for a load balancer backend set. +// For more information on backend set configuration, see +// Managing Backend Sets (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/tasks/managingbackendsets.htm). +type BackendSetDetails struct { + HealthChecker *HealthCheckerDetails `mandatory:"true" json:"healthChecker"` + + // The load balancer policy for the backend set. To get a list of available policies, use the + // ListPolicies operation. + // Example: `LEAST_CONNECTIONS` + Policy *string `mandatory:"true" json:"policy"` + + Backends []BackendDetails `mandatory:"false" json:"backends"` + + SessionPersistenceConfiguration *SessionPersistenceConfigurationDetails `mandatory:"false" json:"sessionPersistenceConfiguration"` + + SslConfiguration *SslConfigurationDetails `mandatory:"false" json:"sslConfiguration"` +} + +func (m BackendSetDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_set_health.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_set_health.go new file mode 100644 index 0000000000..1ef0629968 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/backend_set_health.go @@ -0,0 +1,78 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BackendSetHealth The health status details for a backend set. +// This object does not explicitly enumerate backend servers with a status of `OK`. However, they are included in the +// `totalBackendCount` sum. +type BackendSetHealth struct { + + // A list of backend servers that are currently in the `CRITICAL` health state. The list identifies each backend server by + // IP address and port. + // Example: `1.1.1.1:80` + CriticalStateBackendNames []string `mandatory:"true" json:"criticalStateBackendNames"` + + // Overall health status of the backend set. + // * **OK:** All backend servers in the backend set return a status of `OK`. + // * **WARNING:** Half or more of the backend set's backend servers return a status of `OK` and at least one backend + // server returns a status of `WARNING`, `CRITICAL`, or `UNKNOWN`. + // * **CRITICAL:** Fewer than half of the backend set's backend servers return a status of `OK`. + // * **UNKNOWN:** More than half of the backend set's backend servers return a status of `UNKNOWN`, the system was + // unable to retrieve metrics, or the backend set does not have a listener attached. + Status BackendSetHealthStatusEnum `mandatory:"true" json:"status"` + + // The total number of backend servers in this backend set. + // Example: `5` + TotalBackendCount *int `mandatory:"true" json:"totalBackendCount"` + + // A list of backend servers that are currently in the `UNKNOWN` health state. The list identifies each backend server by + // IP address and port. + // Example: `1.1.1.5:80` + UnknownStateBackendNames []string `mandatory:"true" json:"unknownStateBackendNames"` + + // A list of backend servers that are currently in the `WARNING` health state. The list identifies each backend server by + // IP address and port. + // Example: `1.1.1.7:42` + WarningStateBackendNames []string `mandatory:"true" json:"warningStateBackendNames"` +} + +func (m BackendSetHealth) String() string { + return common.PointerString(m) +} + +// BackendSetHealthStatusEnum Enum with underlying type: string +type BackendSetHealthStatusEnum string + +// Set of constants representing the allowable values for BackendSetHealthStatus +const ( + BackendSetHealthStatusOk BackendSetHealthStatusEnum = "OK" + BackendSetHealthStatusWarning BackendSetHealthStatusEnum = "WARNING" + BackendSetHealthStatusCritical BackendSetHealthStatusEnum = "CRITICAL" + BackendSetHealthStatusUnknown BackendSetHealthStatusEnum = "UNKNOWN" +) + +var mappingBackendSetHealthStatus = map[string]BackendSetHealthStatusEnum{ + "OK": BackendSetHealthStatusOk, + "WARNING": BackendSetHealthStatusWarning, + "CRITICAL": BackendSetHealthStatusCritical, + "UNKNOWN": BackendSetHealthStatusUnknown, +} + +// GetBackendSetHealthStatusEnumValues Enumerates the set of values for BackendSetHealthStatus +func GetBackendSetHealthStatusEnumValues() []BackendSetHealthStatusEnum { + values := make([]BackendSetHealthStatusEnum, 0) + for _, v := range mappingBackendSetHealthStatus { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/certificate.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/certificate.go new file mode 100644 index 0000000000..e2d038de73 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/certificate.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Certificate The configuration details of a listener certificate bundle. +// For more information on SSL certficate configuration, see +// Managing SSL Certificates (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/managingcertificates.htm). +type Certificate struct { + + // The Certificate Authority certificate, or any interim certificate, that you received from your SSL certificate provider. + // Example: + // -----BEGIN CERTIFICATE----- + // MIIEczCCA1ugAwIBAgIBADANBgkqhkiG9w0BAQQFAD..AkGA1UEBhMCR0Ix + // EzARBgNVBAgTClNvbWUtU3RhdGUxFDASBgNVBAoTC0..0EgTHRkMTcwNQYD + // VQQLEy5DbGFzcyAxIFB1YmxpYyBQcmltYXJ5IENlcn..XRpb24gQXV0aG9y + // aXR5MRQwEgYDVQQDEwtCZXN0IENBIEx0ZDAeFw0wMD..TUwMTZaFw0wMTAy + // ... + // -----END CERTIFICATE----- + CaCertificate *string `mandatory:"true" json:"caCertificate"` + + // A friendly name for the certificate bundle. It must be unique and it cannot be changed. + // Valid certificate bundle names include only alphanumeric characters, dashes, and underscores. + // Certificate bundle names cannot contain spaces. Avoid entering confidential information. + // Example: `My_certificate_bundle` + CertificateName *string `mandatory:"true" json:"certificateName"` + + // The public certificate, in PEM format, that you received from your SSL certificate provider. + // Example: + // -----BEGIN CERTIFICATE----- + // MIIC2jCCAkMCAg38MA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG + // A1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE + // MRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl + // YiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTIw + // ... + // -----END CERTIFICATE----- + PublicCertificate *string `mandatory:"true" json:"publicCertificate"` +} + +func (m Certificate) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/certificate_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/certificate_details.go new file mode 100644 index 0000000000..d63af94d98 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/certificate_details.go @@ -0,0 +1,66 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CertificateDetails The configuration details for a listener certificate bundle. +// For more information on SSL certficate configuration, see +// Managing SSL Certificates (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/managingcertificates.htm). +type CertificateDetails struct { + + // A friendly name for the certificate bundle. It must be unique and it cannot be changed. + // Valid certificate bundle names include only alphanumeric characters, dashes, and underscores. + // Certificate bundle names cannot contain spaces. Avoid entering confidential information. + // Example: `My_certificate_bundle` + CertificateName *string `mandatory:"true" json:"certificateName"` + + // The Certificate Authority certificate, or any interim certificate, that you received from your SSL certificate provider. + // Example: + // -----BEGIN CERTIFICATE----- + // MIIEczCCA1ugAwIBAgIBADANBgkqhkiG9w0BAQQFAD..AkGA1UEBhMCR0Ix + // EzARBgNVBAgTClNvbWUtU3RhdGUxFDASBgNVBAoTC0..0EgTHRkMTcwNQYD + // VQQLEy5DbGFzcyAxIFB1YmxpYyBQcmltYXJ5IENlcn..XRpb24gQXV0aG9y + // aXR5MRQwEgYDVQQDEwtCZXN0IENBIEx0ZDAeFw0wMD..TUwMTZaFw0wMTAy + // ... + // -----END CERTIFICATE----- + CaCertificate *string `mandatory:"false" json:"caCertificate"` + + // A passphrase for encrypted private keys. This is needed only if you created your certificate with a passphrase. + // Example: `Mysecretunlockingcode42!1!` + Passphrase *string `mandatory:"false" json:"passphrase"` + + // The SSL private key for your certificate, in PEM format. + // Example: + // -----BEGIN RSA PRIVATE KEY----- + // jO1O1v2ftXMsawM90tnXwc6xhOAT1gDBC9S8DKeca..JZNUgYYwNS0dP2UK + // tmyN+XqVcAKw4HqVmChXy5b5msu8eIq3uc2NqNVtR..2ksSLukP8pxXcHyb + // +sEwvM4uf8qbnHAqwnOnP9+KV9vds6BaH1eRA4CHz..n+NVZlzBsTxTlS16 + // /Umr7wJzVrMqK5sDiSu4WuaaBdqMGfL5hLsTjcBFD..Da2iyQmSKuVD4lIZ + // ... + // -----END RSA PRIVATE KEY----- + PrivateKey *string `mandatory:"false" json:"privateKey"` + + // The public certificate, in PEM format, that you received from your SSL certificate provider. + // Example: + // -----BEGIN CERTIFICATE----- + // MIIC2jCCAkMCAg38MA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG + // A1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE + // MRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl + // YiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTIw + // ... + // -----END CERTIFICATE----- + PublicCertificate *string `mandatory:"false" json:"publicCertificate"` +} + +func (m CertificateDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_details.go new file mode 100644 index 0000000000..b47a042c01 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_details.go @@ -0,0 +1,54 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateBackendDetails The configuration details for creating a backend server in a backend set. +// For more information on backend server configuration, see +// Managing Backend Servers (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/tasks/managingbackendservers.htm). +type CreateBackendDetails struct { + + // The IP address of the backend server. + // Example: `10.10.10.4` + IpAddress *string `mandatory:"true" json:"ipAddress"` + + // The communication port for the backend server. + // Example: `8080` + Port *int `mandatory:"true" json:"port"` + + // Whether the load balancer should treat this server as a backup unit. If `true`, the load balancer forwards no ingress + // traffic to this backend server unless all other backend servers not marked as "backup" fail the health check policy. + // Example: `true` + Backup *bool `mandatory:"false" json:"backup"` + + // Whether the load balancer should drain this server. Servers marked "drain" receive no new + // incoming traffic. + // Example: `true` + Drain *bool `mandatory:"false" json:"drain"` + + // Whether the load balancer should treat this server as offline. Offline servers receive no incoming + // traffic. + // Example: `true` + Offline *bool `mandatory:"false" json:"offline"` + + // The load balancing policy weight assigned to the server. Backend servers with a higher weight receive a larger + // proportion of incoming traffic. For example, a server weighted '3' receives 3 times the number of new connections + // as a server weighted '1'. + // For more information on load balancing policies, see + // How Load Balancing Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Reference/lbpolicies.htm). + // Example: `3` + Weight *int `mandatory:"false" json:"weight"` +} + +func (m CreateBackendDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_request_response.go new file mode 100644 index 0000000000..3d14273cef --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateBackendRequest wrapper for the CreateBackend operation +type CreateBackendRequest struct { + + // The details to add a backend server to a backend set. + CreateBackendDetails `contributesTo:"body"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend set and servers. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set to add the backend server to. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateBackendRequest) String() string { + return common.PointerString(request) +} + +// CreateBackendResponse wrapper for the CreateBackend operation +type CreateBackendResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response CreateBackendResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_set_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_set_details.go new file mode 100644 index 0000000000..2bf3acb40c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_set_details.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateBackendSetDetails The configuration details for creating a backend set in a load balancer. +// For more information on backend set configuration, see +// Managing Backend Sets (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/tasks/managingbackendsets.htm). +type CreateBackendSetDetails struct { + HealthChecker *HealthCheckerDetails `mandatory:"true" json:"healthChecker"` + + // A friendly name for the backend set. It must be unique and it cannot be changed. + // Valid backend set names include only alphanumeric characters, dashes, and underscores. Backend set names cannot + // contain spaces. Avoid entering confidential information. + // Example: `My_backend_set` + Name *string `mandatory:"true" json:"name"` + + // The load balancer policy for the backend set. To get a list of available policies, use the + // ListPolicies operation. + // Example: `LEAST_CONNECTIONS` + Policy *string `mandatory:"true" json:"policy"` + + Backends []BackendDetails `mandatory:"false" json:"backends"` + + SessionPersistenceConfiguration *SessionPersistenceConfigurationDetails `mandatory:"false" json:"sessionPersistenceConfiguration"` + + SslConfiguration *SslConfigurationDetails `mandatory:"false" json:"sslConfiguration"` +} + +func (m CreateBackendSetDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_set_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_set_request_response.go new file mode 100644 index 0000000000..7617987a47 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_backend_set_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateBackendSetRequest wrapper for the CreateBackendSet operation +type CreateBackendSetRequest struct { + + // The details for adding a backend set. + CreateBackendSetDetails `contributesTo:"body"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer on which to add a backend set. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateBackendSetRequest) String() string { + return common.PointerString(request) +} + +// CreateBackendSetResponse wrapper for the CreateBackendSet operation +type CreateBackendSetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response CreateBackendSetResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_certificate_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_certificate_details.go new file mode 100644 index 0000000000..c7f4789bf4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_certificate_details.go @@ -0,0 +1,66 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateCertificateDetails The configuration details for adding a certificate bundle to a listener. +// For more information on SSL certficate configuration, see +// Managing SSL Certificates (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/managingcertificates.htm). +type CreateCertificateDetails struct { + + // A friendly name for the certificate bundle. It must be unique and it cannot be changed. + // Valid certificate bundle names include only alphanumeric characters, dashes, and underscores. + // Certificate bundle names cannot contain spaces. Avoid entering confidential information. + // Example: `My_certificate_bundle` + CertificateName *string `mandatory:"true" json:"certificateName"` + + // The Certificate Authority certificate, or any interim certificate, that you received from your SSL certificate provider. + // Example: + // -----BEGIN CERTIFICATE----- + // MIIEczCCA1ugAwIBAgIBADANBgkqhkiG9w0BAQQFAD..AkGA1UEBhMCR0Ix + // EzARBgNVBAgTClNvbWUtU3RhdGUxFDASBgNVBAoTC0..0EgTHRkMTcwNQYD + // VQQLEy5DbGFzcyAxIFB1YmxpYyBQcmltYXJ5IENlcn..XRpb24gQXV0aG9y + // aXR5MRQwEgYDVQQDEwtCZXN0IENBIEx0ZDAeFw0wMD..TUwMTZaFw0wMTAy + // ... + // -----END CERTIFICATE----- + CaCertificate *string `mandatory:"false" json:"caCertificate"` + + // A passphrase for encrypted private keys. This is needed only if you created your certificate with a passphrase. + // Example: `Mysecretunlockingcode42!1!` + Passphrase *string `mandatory:"false" json:"passphrase"` + + // The SSL private key for your certificate, in PEM format. + // Example: + // -----BEGIN RSA PRIVATE KEY----- + // jO1O1v2ftXMsawM90tnXwc6xhOAT1gDBC9S8DKeca..JZNUgYYwNS0dP2UK + // tmyN+XqVcAKw4HqVmChXy5b5msu8eIq3uc2NqNVtR..2ksSLukP8pxXcHyb + // +sEwvM4uf8qbnHAqwnOnP9+KV9vds6BaH1eRA4CHz..n+NVZlzBsTxTlS16 + // /Umr7wJzVrMqK5sDiSu4WuaaBdqMGfL5hLsTjcBFD..Da2iyQmSKuVD4lIZ + // ... + // -----END RSA PRIVATE KEY----- + PrivateKey *string `mandatory:"false" json:"privateKey"` + + // The public certificate, in PEM format, that you received from your SSL certificate provider. + // Example: + // -----BEGIN CERTIFICATE----- + // MIIC2jCCAkMCAg38MA0GCSqGSIb3DQEBBQUAMIGbMQswCQYDVQQGEwJKUDEOMAwG + // A1UECBMFVG9reW8xEDAOBgNVBAcTB0NodW8ta3UxETAPBgNVBAoTCEZyYW5rNERE + // MRgwFgYDVQQLEw9XZWJDZXJ0IFN1cHBvcnQxGDAWBgNVBAMTD0ZyYW5rNEREIFdl + // YiBDQTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEBmcmFuazRkZC5jb20wHhcNMTIw + // ... + // -----END CERTIFICATE----- + PublicCertificate *string `mandatory:"false" json:"publicCertificate"` +} + +func (m CreateCertificateDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_certificate_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_certificate_request_response.go new file mode 100644 index 0000000000..f92bd347e2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_certificate_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateCertificateRequest wrapper for the CreateCertificate operation +type CreateCertificateRequest struct { + + // The details of the certificate to add. + CreateCertificateDetails `contributesTo:"body"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer on which to add the certificate. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateCertificateRequest) String() string { + return common.PointerString(request) +} + +// CreateCertificateResponse wrapper for the CreateCertificate operation +type CreateCertificateResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response CreateCertificateResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_listener_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_listener_details.go new file mode 100644 index 0000000000..58e7b30d67 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_listener_details.go @@ -0,0 +1,43 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateListenerDetails The configuration details for adding a listener to a backend set. +// For more information on listener configuration, see +// Managing Load Balancer Listeners (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/tasks/managinglisteners.htm). +type CreateListenerDetails struct { + + // The name of the associated backend set. + DefaultBackendSetName *string `mandatory:"true" json:"defaultBackendSetName"` + + // A friendly name for the listener. It must be unique and it cannot be changed. + // Avoid entering confidential information. + // Example: `My listener` + Name *string `mandatory:"true" json:"name"` + + // The communication port for the listener. + // Example: `80` + Port *int `mandatory:"true" json:"port"` + + // The protocol on which the listener accepts connection requests. + // To get a list of valid protocols, use the ListProtocols + // operation. + // Example: `HTTP` + Protocol *string `mandatory:"true" json:"protocol"` + + SslConfiguration *SslConfigurationDetails `mandatory:"false" json:"sslConfiguration"` +} + +func (m CreateListenerDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_listener_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_listener_request_response.go new file mode 100644 index 0000000000..9c9c9f5704 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_listener_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateListenerRequest wrapper for the CreateListener operation +type CreateListenerRequest struct { + + // Details to add a listener. + CreateListenerDetails `contributesTo:"body"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer on which to add a listener. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateListenerRequest) String() string { + return common.PointerString(request) +} + +// CreateListenerResponse wrapper for the CreateListener operation +type CreateListenerResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response CreateListenerResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_load_balancer_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_load_balancer_details.go new file mode 100644 index 0000000000..5b08bf52a1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_load_balancer_details.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateLoadBalancerDetails The configuration details for creating a load balancer. +type CreateLoadBalancerDetails struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment in which to create the load balancer. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name. It does not have to be unique, and it is changeable. + // Avoid entering confidential information. + // Example: `My load balancer` + DisplayName *string `mandatory:"true" json:"displayName"` + + // A template that determines the total pre-provisioned bandwidth (ingress plus egress). + // To get a list of available shapes, use the ListShapes + // operation. + // Example: `100Mbps` + ShapeName *string `mandatory:"true" json:"shapeName"` + + // An array of subnet OCIDs (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + SubnetIds []string `mandatory:"true" json:"subnetIds"` + + BackendSets map[string]BackendSetDetails `mandatory:"false" json:"backendSets"` + + Certificates map[string]CertificateDetails `mandatory:"false" json:"certificates"` + + // Whether the load balancer has a VCN-local (private) IP address. + // If "true", the service assigns a private IP address to the load balancer. The load balancer requires only one subnet + // to host both the primary and secondary load balancers. The private IP address is local to the subnet. The load balancer + // is accessible only from within the VCN that contains the associated subnet, or as further restricted by your security + // list rules. The load balancer can route traffic to any backend server that is reachable from the VCN. + // For a private load balancer, both the primary and secondary load balancer hosts are within the same Availability Domain. + // If "false", the service assigns a public IP address to the load balancer. A load balancer with a public IP address + // requires two subnets, each in a different Availability Domain. One subnet hosts the primary load balancer and the other + // hosts the secondary (standby) load balancer. A public load balancer is accessible from the internet, depending on your + // VCN's security list rules (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/securitylists.htm). + // Example: `false` + IsPrivate *bool `mandatory:"false" json:"isPrivate"` + + Listeners map[string]ListenerDetails `mandatory:"false" json:"listeners"` +} + +func (m CreateLoadBalancerDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_load_balancer_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_load_balancer_request_response.go new file mode 100644 index 0000000000..0ff053e4e0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/create_load_balancer_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateLoadBalancerRequest wrapper for the CreateLoadBalancer operation +type CreateLoadBalancerRequest struct { + + // The configuration details for creating a load balancer. + CreateLoadBalancerDetails `contributesTo:"body"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request CreateLoadBalancerRequest) String() string { + return common.PointerString(request) +} + +// CreateLoadBalancerResponse wrapper for the CreateLoadBalancer operation +type CreateLoadBalancerResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response CreateLoadBalancerResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_backend_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_backend_request_response.go new file mode 100644 index 0000000000..acc746c90c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_backend_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteBackendRequest wrapper for the DeleteBackend operation +type DeleteBackendRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend set and server. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set associated with the backend server. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The IP address and port of the backend server to remove. + // Example: `1.1.1.7:42` + BackendName *string `mandatory:"true" contributesTo:"path" name:"backendName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request DeleteBackendRequest) String() string { + return common.PointerString(request) +} + +// DeleteBackendResponse wrapper for the DeleteBackend operation +type DeleteBackendResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response DeleteBackendResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_backend_set_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_backend_set_request_response.go new file mode 100644 index 0000000000..6a73967a26 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_backend_set_request_response.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteBackendSetRequest wrapper for the DeleteBackendSet operation +type DeleteBackendSetRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend set. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set to delete. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request DeleteBackendSetRequest) String() string { + return common.PointerString(request) +} + +// DeleteBackendSetResponse wrapper for the DeleteBackendSet operation +type DeleteBackendSetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response DeleteBackendSetResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_certificate_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_certificate_request_response.go new file mode 100644 index 0000000000..db86b06373 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_certificate_request_response.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteCertificateRequest wrapper for the DeleteCertificate operation +type DeleteCertificateRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the certificate to be deleted. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the certificate to delete. + // Example: `My_certificate_bundle` + CertificateName *string `mandatory:"true" contributesTo:"path" name:"certificateName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request DeleteCertificateRequest) String() string { + return common.PointerString(request) +} + +// DeleteCertificateResponse wrapper for the DeleteCertificate operation +type DeleteCertificateResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response DeleteCertificateResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_listener_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_listener_request_response.go new file mode 100644 index 0000000000..b5496e0298 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_listener_request_response.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteListenerRequest wrapper for the DeleteListener operation +type DeleteListenerRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the listener to delete. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the listener to delete. + // Example: `My listener` + ListenerName *string `mandatory:"true" contributesTo:"path" name:"listenerName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request DeleteListenerRequest) String() string { + return common.PointerString(request) +} + +// DeleteListenerResponse wrapper for the DeleteListener operation +type DeleteListenerResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response DeleteListenerResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_load_balancer_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_load_balancer_request_response.go new file mode 100644 index 0000000000..3e39b143ca --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/delete_load_balancer_request_response.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteLoadBalancerRequest wrapper for the DeleteLoadBalancer operation +type DeleteLoadBalancerRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer to delete. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request DeleteLoadBalancerRequest) String() string { + return common.PointerString(request) +} + +// DeleteLoadBalancerResponse wrapper for the DeleteLoadBalancer operation +type DeleteLoadBalancerResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response DeleteLoadBalancerResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_health_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_health_request_response.go new file mode 100644 index 0000000000..6216d7aa9a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_health_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetBackendHealthRequest wrapper for the GetBackendHealth operation +type GetBackendHealthRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend server health status to be retrieved. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set associated with the backend server to retrieve the health status for. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The IP address and port of the backend server to retrieve the health status for. + // Example: `1.1.1.7:42` + BackendName *string `mandatory:"true" contributesTo:"path" name:"backendName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request GetBackendHealthRequest) String() string { + return common.PointerString(request) +} + +// GetBackendHealthResponse wrapper for the GetBackendHealth operation +type GetBackendHealthResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The BackendHealth instance + BackendHealth `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetBackendHealthResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_request_response.go new file mode 100644 index 0000000000..b795f0a4fd --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_request_response.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetBackendRequest wrapper for the GetBackend operation +type GetBackendRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend set and server. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set that includes the backend server. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The IP address and port of the backend server to retrieve. + // Example: `1.1.1.7:42` + BackendName *string `mandatory:"true" contributesTo:"path" name:"backendName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request GetBackendRequest) String() string { + return common.PointerString(request) +} + +// GetBackendResponse wrapper for the GetBackend operation +type GetBackendResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Backend instance + Backend `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetBackendResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_set_health_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_set_health_request_response.go new file mode 100644 index 0000000000..9c1952f17a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_set_health_request_response.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetBackendSetHealthRequest wrapper for the GetBackendSetHealth operation +type GetBackendSetHealthRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend set health status to be retrieved. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set to retrieve the health status for. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request GetBackendSetHealthRequest) String() string { + return common.PointerString(request) +} + +// GetBackendSetHealthResponse wrapper for the GetBackendSetHealth operation +type GetBackendSetHealthResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The BackendSetHealth instance + BackendSetHealth `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetBackendSetHealthResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_set_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_set_request_response.go new file mode 100644 index 0000000000..19b461368a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_backend_set_request_response.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetBackendSetRequest wrapper for the GetBackendSet operation +type GetBackendSetRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the specified load balancer. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set to retrieve. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request GetBackendSetRequest) String() string { + return common.PointerString(request) +} + +// GetBackendSetResponse wrapper for the GetBackendSet operation +type GetBackendSetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The BackendSet instance + BackendSet `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetBackendSetResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_health_checker_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_health_checker_request_response.go new file mode 100644 index 0000000000..70cfdc6f6e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_health_checker_request_response.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetHealthCheckerRequest wrapper for the GetHealthChecker operation +type GetHealthCheckerRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the health check policy to be retrieved. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set associated with the health check policy to be retrieved. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request GetHealthCheckerRequest) String() string { + return common.PointerString(request) +} + +// GetHealthCheckerResponse wrapper for the GetHealthChecker operation +type GetHealthCheckerResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The HealthChecker instance + HealthChecker `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetHealthCheckerResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_load_balancer_health_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_load_balancer_health_request_response.go new file mode 100644 index 0000000000..03783ea3a8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_load_balancer_health_request_response.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetLoadBalancerHealthRequest wrapper for the GetLoadBalancerHealth operation +type GetLoadBalancerHealthRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer to return health status for. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request GetLoadBalancerHealthRequest) String() string { + return common.PointerString(request) +} + +// GetLoadBalancerHealthResponse wrapper for the GetLoadBalancerHealth operation +type GetLoadBalancerHealthResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The LoadBalancerHealth instance + LoadBalancerHealth `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetLoadBalancerHealthResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_load_balancer_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_load_balancer_request_response.go new file mode 100644 index 0000000000..4f63477946 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_load_balancer_request_response.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetLoadBalancerRequest wrapper for the GetLoadBalancer operation +type GetLoadBalancerRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer to retrieve. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request GetLoadBalancerRequest) String() string { + return common.PointerString(request) +} + +// GetLoadBalancerResponse wrapper for the GetLoadBalancer operation +type GetLoadBalancerResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The LoadBalancer instance + LoadBalancer `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetLoadBalancerResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_work_request_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_work_request_request_response.go new file mode 100644 index 0000000000..5159bf9c7d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/get_work_request_request_response.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetWorkRequestRequest wrapper for the GetWorkRequest operation +type GetWorkRequestRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request to retrieve. + WorkRequestId *string `mandatory:"true" contributesTo:"path" name:"workRequestId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request GetWorkRequestRequest) String() string { + return common.PointerString(request) +} + +// GetWorkRequestResponse wrapper for the GetWorkRequest operation +type GetWorkRequestResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The WorkRequest instance + WorkRequest `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetWorkRequestResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/health_check_result.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/health_check_result.go new file mode 100644 index 0000000000..8c7a04152a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/health_check_result.go @@ -0,0 +1,71 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// HealthCheckResult Information about a single backend server health check result reported by a load balancer. +type HealthCheckResult struct { + + // The result of the most recent health check. + HealthCheckStatus HealthCheckResultHealthCheckStatusEnum `mandatory:"true" json:"healthCheckStatus"` + + // The IP address of the health check status report provider. This identifier helps you differentiate same-subnet + // (private) load balancers that report health check status. + // Example: `10.2.0.1` + SourceIpAddress *string `mandatory:"true" json:"sourceIpAddress"` + + // The OCID of the subnet hosting the load balancer that reported this health check status. + SubnetId *string `mandatory:"true" json:"subnetId"` + + // The date and time the data was retrieved, in the format defined by RFC3339. + // Example: `2017-06-02T18:28:11+00:00` + Timestamp *common.SDKTime `mandatory:"true" json:"timestamp"` +} + +func (m HealthCheckResult) String() string { + return common.PointerString(m) +} + +// HealthCheckResultHealthCheckStatusEnum Enum with underlying type: string +type HealthCheckResultHealthCheckStatusEnum string + +// Set of constants representing the allowable values for HealthCheckResultHealthCheckStatus +const ( + HealthCheckResultHealthCheckStatusOk HealthCheckResultHealthCheckStatusEnum = "OK" + HealthCheckResultHealthCheckStatusInvalidStatusCode HealthCheckResultHealthCheckStatusEnum = "INVALID_STATUS_CODE" + HealthCheckResultHealthCheckStatusTimedOut HealthCheckResultHealthCheckStatusEnum = "TIMED_OUT" + HealthCheckResultHealthCheckStatusRegexMismatch HealthCheckResultHealthCheckStatusEnum = "REGEX_MISMATCH" + HealthCheckResultHealthCheckStatusConnectFailed HealthCheckResultHealthCheckStatusEnum = "CONNECT_FAILED" + HealthCheckResultHealthCheckStatusIoError HealthCheckResultHealthCheckStatusEnum = "IO_ERROR" + HealthCheckResultHealthCheckStatusOffline HealthCheckResultHealthCheckStatusEnum = "OFFLINE" + HealthCheckResultHealthCheckStatusUnknown HealthCheckResultHealthCheckStatusEnum = "UNKNOWN" +) + +var mappingHealthCheckResultHealthCheckStatus = map[string]HealthCheckResultHealthCheckStatusEnum{ + "OK": HealthCheckResultHealthCheckStatusOk, + "INVALID_STATUS_CODE": HealthCheckResultHealthCheckStatusInvalidStatusCode, + "TIMED_OUT": HealthCheckResultHealthCheckStatusTimedOut, + "REGEX_MISMATCH": HealthCheckResultHealthCheckStatusRegexMismatch, + "CONNECT_FAILED": HealthCheckResultHealthCheckStatusConnectFailed, + "IO_ERROR": HealthCheckResultHealthCheckStatusIoError, + "OFFLINE": HealthCheckResultHealthCheckStatusOffline, + "UNKNOWN": HealthCheckResultHealthCheckStatusUnknown, +} + +// GetHealthCheckResultHealthCheckStatusEnumValues Enumerates the set of values for HealthCheckResultHealthCheckStatus +func GetHealthCheckResultHealthCheckStatusEnumValues() []HealthCheckResultHealthCheckStatusEnum { + values := make([]HealthCheckResultHealthCheckStatusEnum, 0) + for _, v := range mappingHealthCheckResultHealthCheckStatus { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/health_checker.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/health_checker.go new file mode 100644 index 0000000000..5f51500764 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/health_checker.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// HealthChecker The health check policy configuration. +// For more information, see Editing Health Check Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/editinghealthcheck.htm). +type HealthChecker struct { + + // The backend server port against which to run the health check. If the port is not specified, the load balancer uses the + // port information from the `Backend` object. + // Example: `8080` + Port *int `mandatory:"true" json:"port"` + + // The protocol the health check must use; either HTTP or TCP. + // Example: `HTTP` + Protocol *string `mandatory:"true" json:"protocol"` + + // A regular expression for parsing the response body from the backend server. + // Example: `^(500|40[1348])$` + ResponseBodyRegex *string `mandatory:"true" json:"responseBodyRegex"` + + // The status code a healthy backend server should return. If you configure the health check policy to use the HTTP protocol, + // you can use common HTTP status codes such as "200". + // Example: `200` + ReturnCode *int `mandatory:"true" json:"returnCode"` + + // The interval between health checks, in milliseconds. The default is 10000 (10 seconds). + // Example: `30000` + IntervalInMillis *int `mandatory:"false" json:"intervalInMillis"` + + // The number of retries to attempt before a backend server is considered "unhealthy". Defaults to 3. + // Example: `3` + Retries *int `mandatory:"false" json:"retries"` + + // The maximum time, in milliseconds, to wait for a reply to a health check. A health check is successful only if a reply + // returns within this timeout period. Defaults to 3000 (3 seconds). + // Example: `6000` + TimeoutInMillis *int `mandatory:"false" json:"timeoutInMillis"` + + // The path against which to run the health check. + // Example: `/healthcheck` + UrlPath *string `mandatory:"false" json:"urlPath"` +} + +func (m HealthChecker) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/health_checker_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/health_checker_details.go new file mode 100644 index 0000000000..29f9a90c8d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/health_checker_details.go @@ -0,0 +1,55 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// HealthCheckerDetails The health check policy's configuration details. +type HealthCheckerDetails struct { + + // The protocol the health check must use; either HTTP or TCP. + // Example: `HTTP` + Protocol *string `mandatory:"true" json:"protocol"` + + // The interval between health checks, in milliseconds. + // Example: `30000` + IntervalInMillis *int `mandatory:"false" json:"intervalInMillis"` + + // The backend server port against which to run the health check. If the port is not specified, the load balancer uses the + // port information from the `Backend` object. + // Example: `8080` + Port *int `mandatory:"false" json:"port"` + + // A regular expression for parsing the response body from the backend server. + // Example: `^(500|40[1348])$` + ResponseBodyRegex *string `mandatory:"false" json:"responseBodyRegex"` + + // The number of retries to attempt before a backend server is considered "unhealthy". + // Example: `3` + Retries *int `mandatory:"false" json:"retries"` + + // The status code a healthy backend server should return. + // Example: `200` + ReturnCode *int `mandatory:"false" json:"returnCode"` + + // The maximum time, in milliseconds, to wait for a reply to a health check. A health check is successful only if a reply + // returns within this timeout period. + // Example: `6000` + TimeoutInMillis *int `mandatory:"false" json:"timeoutInMillis"` + + // The path against which to run the health check. + // Example: `/healthcheck` + UrlPath *string `mandatory:"false" json:"urlPath"` +} + +func (m HealthCheckerDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/ip_address.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/ip_address.go new file mode 100644 index 0000000000..04892809e2 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/ip_address.go @@ -0,0 +1,30 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// IpAddress A load balancer IP address. +type IpAddress struct { + + // An IP address. + // Example: `128.148.10.20` + IpAddress *string `mandatory:"true" json:"ipAddress"` + + // Whether the IP address is public or private. + // If "true", the IP address is public and accessible from the internet. + // If "false", the IP address is private and accessible only from within the associated VCN. + IsPublic *bool `mandatory:"false" json:"isPublic"` +} + +func (m IpAddress) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_backend_sets_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_backend_sets_request_response.go new file mode 100644 index 0000000000..240a498117 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_backend_sets_request_response.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListBackendSetsRequest wrapper for the ListBackendSets operation +type ListBackendSetsRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend sets to retrieve. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request ListBackendSetsRequest) String() string { + return common.PointerString(request) +} + +// ListBackendSetsResponse wrapper for the ListBackendSets operation +type ListBackendSetsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []BackendSet instance + Items []BackendSet `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListBackendSetsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_backends_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_backends_request_response.go new file mode 100644 index 0000000000..dd68c498a5 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_backends_request_response.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListBackendsRequest wrapper for the ListBackends operation +type ListBackendsRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend set and servers. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set associated with the backend servers. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request ListBackendsRequest) String() string { + return common.PointerString(request) +} + +// ListBackendsResponse wrapper for the ListBackends operation +type ListBackendsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Backend instance + Items []Backend `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListBackendsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_certificates_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_certificates_request_response.go new file mode 100644 index 0000000000..b5e62bc070 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_certificates_request_response.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListCertificatesRequest wrapper for the ListCertificates operation +type ListCertificatesRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the certificates to be listed. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` +} + +func (request ListCertificatesRequest) String() string { + return common.PointerString(request) +} + +// ListCertificatesResponse wrapper for the ListCertificates operation +type ListCertificatesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []Certificate instance + Items []Certificate `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListCertificatesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_load_balancer_healths_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_load_balancer_healths_request_response.go new file mode 100644 index 0000000000..959153da0a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_load_balancer_healths_request_response.go @@ -0,0 +1,55 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListLoadBalancerHealthsRequest wrapper for the ListLoadBalancerHealths operation +type ListLoadBalancerHealthsRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment containing the load balancers to return health status information for. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + // Example: `3` + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListLoadBalancerHealthsRequest) String() string { + return common.PointerString(request) +} + +// ListLoadBalancerHealthsResponse wrapper for the ListLoadBalancerHealths operation +type ListLoadBalancerHealthsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []LoadBalancerHealthSummary instance + Items []LoadBalancerHealthSummary `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListLoadBalancerHealthsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_load_balancers_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_load_balancers_request_response.go new file mode 100644 index 0000000000..6086976855 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_load_balancers_request_response.go @@ -0,0 +1,117 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListLoadBalancersRequest wrapper for the ListLoadBalancers operation +type ListLoadBalancersRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment containing the load balancers to list. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + // Example: `3` + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The level of detail to return for each result. Can be `full` or `simple`. + // Example: `full` + Detail *string `mandatory:"false" contributesTo:"query" name:"detail"` + + // The field to sort by. Only one sort order may be provided. Time created is default ordered as descending. Display name is default ordered as ascending. + SortBy ListLoadBalancersSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either 'asc' or 'desc' + SortOrder ListLoadBalancersSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // A filter to only return resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // A filter to only return resources that match the given lifecycle state. + LifecycleState LoadBalancerLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` +} + +func (request ListLoadBalancersRequest) String() string { + return common.PointerString(request) +} + +// ListLoadBalancersResponse wrapper for the ListLoadBalancers operation +type ListLoadBalancersResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []LoadBalancer instance + Items []LoadBalancer `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListLoadBalancersResponse) String() string { + return common.PointerString(response) +} + +// ListLoadBalancersSortByEnum Enum with underlying type: string +type ListLoadBalancersSortByEnum string + +// Set of constants representing the allowable values for ListLoadBalancersSortBy +const ( + ListLoadBalancersSortByTimecreated ListLoadBalancersSortByEnum = "TIMECREATED" + ListLoadBalancersSortByDisplayname ListLoadBalancersSortByEnum = "DISPLAYNAME" +) + +var mappingListLoadBalancersSortBy = map[string]ListLoadBalancersSortByEnum{ + "TIMECREATED": ListLoadBalancersSortByTimecreated, + "DISPLAYNAME": ListLoadBalancersSortByDisplayname, +} + +// GetListLoadBalancersSortByEnumValues Enumerates the set of values for ListLoadBalancersSortBy +func GetListLoadBalancersSortByEnumValues() []ListLoadBalancersSortByEnum { + values := make([]ListLoadBalancersSortByEnum, 0) + for _, v := range mappingListLoadBalancersSortBy { + values = append(values, v) + } + return values +} + +// ListLoadBalancersSortOrderEnum Enum with underlying type: string +type ListLoadBalancersSortOrderEnum string + +// Set of constants representing the allowable values for ListLoadBalancersSortOrder +const ( + ListLoadBalancersSortOrderAsc ListLoadBalancersSortOrderEnum = "ASC" + ListLoadBalancersSortOrderDesc ListLoadBalancersSortOrderEnum = "DESC" +) + +var mappingListLoadBalancersSortOrder = map[string]ListLoadBalancersSortOrderEnum{ + "ASC": ListLoadBalancersSortOrderAsc, + "DESC": ListLoadBalancersSortOrderDesc, +} + +// GetListLoadBalancersSortOrderEnumValues Enumerates the set of values for ListLoadBalancersSortOrder +func GetListLoadBalancersSortOrderEnumValues() []ListLoadBalancersSortOrderEnum { + values := make([]ListLoadBalancersSortOrderEnum, 0) + for _, v := range mappingListLoadBalancersSortOrder { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_policies_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_policies_request_response.go new file mode 100644 index 0000000000..197f32e5aa --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_policies_request_response.go @@ -0,0 +1,55 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListPoliciesRequest wrapper for the ListPolicies operation +type ListPoliciesRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment containing the load balancer policies to list. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + // Example: `3` + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListPoliciesRequest) String() string { + return common.PointerString(request) +} + +// ListPoliciesResponse wrapper for the ListPolicies operation +type ListPoliciesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []LoadBalancerPolicy instance + Items []LoadBalancerPolicy `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListPoliciesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_protocols_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_protocols_request_response.go new file mode 100644 index 0000000000..d6e9c4e30e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_protocols_request_response.go @@ -0,0 +1,55 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListProtocolsRequest wrapper for the ListProtocols operation +type ListProtocolsRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment containing the load balancer protocols to list. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + // Example: `3` + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListProtocolsRequest) String() string { + return common.PointerString(request) +} + +// ListProtocolsResponse wrapper for the ListProtocols operation +type ListProtocolsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []LoadBalancerProtocol instance + Items []LoadBalancerProtocol `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListProtocolsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_shapes_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_shapes_request_response.go new file mode 100644 index 0000000000..0db13f6175 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_shapes_request_response.go @@ -0,0 +1,55 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListShapesRequest wrapper for the ListShapes operation +type ListShapesRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment containing the load balancer shapes to list. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + // Example: `3` + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListShapesRequest) String() string { + return common.PointerString(request) +} + +// ListShapesResponse wrapper for the ListShapes operation +type ListShapesResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []LoadBalancerShape instance + Items []LoadBalancerShape `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListShapesResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_work_requests_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_work_requests_request_response.go new file mode 100644 index 0000000000..13018c150d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/list_work_requests_request_response.go @@ -0,0 +1,55 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListWorkRequestsRequest wrapper for the ListWorkRequests operation +type ListWorkRequestsRequest struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the work requests to retrieve. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The maximum number of items to return in a paginated "List" call. + // Example: `500` + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The value of the `opc-next-page` response header from the previous "List" call. + // Example: `3` + Page *string `mandatory:"false" contributesTo:"query" name:"page"` +} + +func (request ListWorkRequestsRequest) String() string { + return common.PointerString(request) +} + +// ListWorkRequestsResponse wrapper for the ListWorkRequests operation +type ListWorkRequestsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []WorkRequest instance + Items []WorkRequest `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListWorkRequestsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/listener.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/listener.go new file mode 100644 index 0000000000..31110fd5eb --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/listener.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Listener The listener's configuration. +// For more information on backend set configuration, see +// Managing Load Balancer Listeners (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/tasks/managinglisteners.htm). +type Listener struct { + + // The name of the associated backend set. + DefaultBackendSetName *string `mandatory:"true" json:"defaultBackendSetName"` + + // A friendly name for the listener. It must be unique and it cannot be changed. + // Example: `My listener` + Name *string `mandatory:"true" json:"name"` + + // The communication port for the listener. + // Example: `80` + Port *int `mandatory:"true" json:"port"` + + // The protocol on which the listener accepts connection requests. + // To get a list of valid protocols, use the ListProtocols + // operation. + // Example: `HTTP` + Protocol *string `mandatory:"true" json:"protocol"` + + SslConfiguration *SslConfiguration `mandatory:"false" json:"sslConfiguration"` +} + +func (m Listener) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/listener_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/listener_details.go new file mode 100644 index 0000000000..15b4e5d9a7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/listener_details.go @@ -0,0 +1,36 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// ListenerDetails The listener's configuration details. +type ListenerDetails struct { + + // The name of the associated backend set. + DefaultBackendSetName *string `mandatory:"true" json:"defaultBackendSetName"` + + // The communication port for the listener. + // Example: `80` + Port *int `mandatory:"true" json:"port"` + + // The protocol on which the listener accepts connection requests. + // To get a list of valid protocols, use the ListProtocols + // operation. + // Example: `HTTP` + Protocol *string `mandatory:"true" json:"protocol"` + + SslConfiguration *SslConfigurationDetails `mandatory:"false" json:"sslConfiguration"` +} + +func (m ListenerDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer.go new file mode 100644 index 0000000000..bf621e4a97 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer.go @@ -0,0 +1,104 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// LoadBalancer The properties that define a load balancer. For more information, see +// Managing a Load Balancer (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/managingloadbalancer.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +// For information about endpoints and signing API requests, see +// About the API (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm). For information about available SDKs and tools, see +// SDKS and Other Tools (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdks.htm). +type LoadBalancer struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the compartment containing the load balancer. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // A user-friendly name. It does not have to be unique, and it is changeable. + // Example: `My load balancer` + DisplayName *string `mandatory:"true" json:"displayName"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer. + Id *string `mandatory:"true" json:"id"` + + // The current state of the load balancer. + LifecycleState LoadBalancerLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // A template that determines the total pre-provisioned bandwidth (ingress plus egress). + // To get a list of available shapes, use the ListShapes + // operation. + // Example: `100Mbps` + ShapeName *string `mandatory:"true" json:"shapeName"` + + // The date and time the load balancer was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + BackendSets map[string]BackendSet `mandatory:"false" json:"backendSets"` + + Certificates map[string]Certificate `mandatory:"false" json:"certificates"` + + // An array of IP addresses. + IpAddresses []IpAddress `mandatory:"false" json:"ipAddresses"` + + // Whether the load balancer has a VCN-local (private) IP address. + // If "true", the service assigns a private IP address to the load balancer. The load balancer requires only one subnet + // to host both the primary and secondary load balancers. The private IP address is local to the subnet. The load balancer + // is accessible only from within the VCN that contains the associated subnet, or as further restricted by your security + // list rules. The load balancer can route traffic to any backend server that is reachable from the VCN. + // For a private load balancer, both the primary and secondary load balancer hosts are within the same Availability Domain. + // If "false", the service assigns a public IP address to the load balancer. A load balancer with a public IP address + // requires two subnets, each in a different Availability Domain. One subnet hosts the primary load balancer and the other + // hosts the secondary (standby) load balancer. A public load balancer is accessible from the internet, depending on your + // VCN's security list rules (https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/securitylists.htm). + IsPrivate *bool `mandatory:"false" json:"isPrivate"` + + Listeners map[string]Listener `mandatory:"false" json:"listeners"` + + // An array of subnet OCIDs (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). + SubnetIds []string `mandatory:"false" json:"subnetIds"` +} + +func (m LoadBalancer) String() string { + return common.PointerString(m) +} + +// LoadBalancerLifecycleStateEnum Enum with underlying type: string +type LoadBalancerLifecycleStateEnum string + +// Set of constants representing the allowable values for LoadBalancerLifecycleState +const ( + LoadBalancerLifecycleStateCreating LoadBalancerLifecycleStateEnum = "CREATING" + LoadBalancerLifecycleStateFailed LoadBalancerLifecycleStateEnum = "FAILED" + LoadBalancerLifecycleStateActive LoadBalancerLifecycleStateEnum = "ACTIVE" + LoadBalancerLifecycleStateDeleting LoadBalancerLifecycleStateEnum = "DELETING" + LoadBalancerLifecycleStateDeleted LoadBalancerLifecycleStateEnum = "DELETED" +) + +var mappingLoadBalancerLifecycleState = map[string]LoadBalancerLifecycleStateEnum{ + "CREATING": LoadBalancerLifecycleStateCreating, + "FAILED": LoadBalancerLifecycleStateFailed, + "ACTIVE": LoadBalancerLifecycleStateActive, + "DELETING": LoadBalancerLifecycleStateDeleting, + "DELETED": LoadBalancerLifecycleStateDeleted, +} + +// GetLoadBalancerLifecycleStateEnumValues Enumerates the set of values for LoadBalancerLifecycleState +func GetLoadBalancerLifecycleStateEnumValues() []LoadBalancerLifecycleStateEnum { + values := make([]LoadBalancerLifecycleStateEnum, 0) + for _, v := range mappingLoadBalancerLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_health.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_health.go new file mode 100644 index 0000000000..ab7de4a9d8 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_health.go @@ -0,0 +1,82 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// LoadBalancerHealth The health status details for the specified load balancer. +// This object does not explicitly enumerate backend sets with a status of `OK`. However, they are included in the +// `totalBackendSetCount` sum. +type LoadBalancerHealth struct { + + // A list of backend sets that are currently in the `CRITICAL` health state. The list identifies each backend set by the + // friendly name you assigned when you created it. + // Example: `My_backend_set` + CriticalStateBackendSetNames []string `mandatory:"true" json:"criticalStateBackendSetNames"` + + // The overall health status of the load balancer. + // * **OK:** All backend sets associated with the load balancer return a status of `OK`. + // * **WARNING:** At least one of the backend sets associated with the load balancer returns a status of `WARNING`, + // no backend sets return a status of `CRITICAL`, and the load balancer life cycle state is `ACTIVE`. + // * **CRITICAL:** One or more of the backend sets associated with the load balancer return a status of `CRITICAL`. + // * **UNKNOWN:** If any one of the following conditions is true: + // * The load balancer life cycle state is not `ACTIVE`. + // * No backend sets are defined for the load balancer. + // * More than half of the backend sets associated with the load balancer return a status of `UNKNOWN`, none of the backend + // sets return a status of `WARNING` or `CRITICAL`, and the load balancer life cycle state is `ACTIVE`. + // * The system could not retrieve metrics for any reason. + Status LoadBalancerHealthStatusEnum `mandatory:"true" json:"status"` + + // The total number of backend sets associated with this load balancer. + // Example: `4` + TotalBackendSetCount *int `mandatory:"true" json:"totalBackendSetCount"` + + // A list of backend sets that are currently in the `UNKNOWN` health state. The list identifies each backend set by the + // friendly name you assigned when you created it. + // Example: `Backend_set2` + UnknownStateBackendSetNames []string `mandatory:"true" json:"unknownStateBackendSetNames"` + + // A list of backend sets that are currently in the `WARNING` health state. The list identifies each backend set by the + // friendly name you assigned when you created it. + // Example: `Backend_set3` + WarningStateBackendSetNames []string `mandatory:"true" json:"warningStateBackendSetNames"` +} + +func (m LoadBalancerHealth) String() string { + return common.PointerString(m) +} + +// LoadBalancerHealthStatusEnum Enum with underlying type: string +type LoadBalancerHealthStatusEnum string + +// Set of constants representing the allowable values for LoadBalancerHealthStatus +const ( + LoadBalancerHealthStatusOk LoadBalancerHealthStatusEnum = "OK" + LoadBalancerHealthStatusWarning LoadBalancerHealthStatusEnum = "WARNING" + LoadBalancerHealthStatusCritical LoadBalancerHealthStatusEnum = "CRITICAL" + LoadBalancerHealthStatusUnknown LoadBalancerHealthStatusEnum = "UNKNOWN" +) + +var mappingLoadBalancerHealthStatus = map[string]LoadBalancerHealthStatusEnum{ + "OK": LoadBalancerHealthStatusOk, + "WARNING": LoadBalancerHealthStatusWarning, + "CRITICAL": LoadBalancerHealthStatusCritical, + "UNKNOWN": LoadBalancerHealthStatusUnknown, +} + +// GetLoadBalancerHealthStatusEnumValues Enumerates the set of values for LoadBalancerHealthStatus +func GetLoadBalancerHealthStatusEnumValues() []LoadBalancerHealthStatusEnum { + values := make([]LoadBalancerHealthStatusEnum, 0) + for _, v := range mappingLoadBalancerHealthStatus { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_health_summary.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_health_summary.go new file mode 100644 index 0000000000..0ff51e894b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_health_summary.go @@ -0,0 +1,64 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// LoadBalancerHealthSummary A health status summary for the specified load balancer. +type LoadBalancerHealthSummary struct { + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer the health status is associated with. + LoadBalancerId *string `mandatory:"true" json:"loadBalancerId"` + + // The overall health status of the load balancer. + // * **OK:** All backend sets associated with the load balancer return a status of `OK`. + // * **WARNING:** At least one of the backend sets associated with the load balancer returns a status of `WARNING`, + // no backend sets return a status of `CRITICAL`, and the load balancer life cycle state is `ACTIVE`. + // * **CRITICAL:** One or more of the backend sets associated with the load balancer return a status of `CRITICAL`. + // * **UNKNOWN:** If any one of the following conditions is true: + // * The load balancer life cycle state is not `ACTIVE`. + // * No backend sets are defined for the load balancer. + // * More than half of the backend sets associated with the load balancer return a status of `UNKNOWN`, none of the backend + // sets return a status of `WARNING` or `CRITICAL`, and the load balancer life cycle state is `ACTIVE`. + // * The system could not retrieve metrics for any reason. + Status LoadBalancerHealthSummaryStatusEnum `mandatory:"true" json:"status"` +} + +func (m LoadBalancerHealthSummary) String() string { + return common.PointerString(m) +} + +// LoadBalancerHealthSummaryStatusEnum Enum with underlying type: string +type LoadBalancerHealthSummaryStatusEnum string + +// Set of constants representing the allowable values for LoadBalancerHealthSummaryStatus +const ( + LoadBalancerHealthSummaryStatusOk LoadBalancerHealthSummaryStatusEnum = "OK" + LoadBalancerHealthSummaryStatusWarning LoadBalancerHealthSummaryStatusEnum = "WARNING" + LoadBalancerHealthSummaryStatusCritical LoadBalancerHealthSummaryStatusEnum = "CRITICAL" + LoadBalancerHealthSummaryStatusUnknown LoadBalancerHealthSummaryStatusEnum = "UNKNOWN" +) + +var mappingLoadBalancerHealthSummaryStatus = map[string]LoadBalancerHealthSummaryStatusEnum{ + "OK": LoadBalancerHealthSummaryStatusOk, + "WARNING": LoadBalancerHealthSummaryStatusWarning, + "CRITICAL": LoadBalancerHealthSummaryStatusCritical, + "UNKNOWN": LoadBalancerHealthSummaryStatusUnknown, +} + +// GetLoadBalancerHealthSummaryStatusEnumValues Enumerates the set of values for LoadBalancerHealthSummaryStatus +func GetLoadBalancerHealthSummaryStatusEnumValues() []LoadBalancerHealthSummaryStatusEnum { + values := make([]LoadBalancerHealthSummaryStatusEnum, 0) + for _, v := range mappingLoadBalancerHealthSummaryStatus { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_policy.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_policy.go new file mode 100644 index 0000000000..610a970b85 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_policy.go @@ -0,0 +1,26 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// LoadBalancerPolicy A policy that determines how traffic is distributed among backend servers. +// For more information on load balancing policies, see +// How Load Balancing Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Reference/lbpolicies.htm). +type LoadBalancerPolicy struct { + + // The name of the load balancing policy. + Name *string `mandatory:"true" json:"name"` +} + +func (m LoadBalancerPolicy) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_protocol.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_protocol.go new file mode 100644 index 0000000000..91be70bb75 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_protocol.go @@ -0,0 +1,24 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// LoadBalancerProtocol The protocol that defines the type of traffic accepted by a listener. +type LoadBalancerProtocol struct { + + // The name of the protocol. + Name *string `mandatory:"true" json:"name"` +} + +func (m LoadBalancerProtocol) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_shape.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_shape.go new file mode 100644 index 0000000000..de82ebb470 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/load_balancer_shape.go @@ -0,0 +1,27 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// LoadBalancerShape A 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. +type LoadBalancerShape struct { + + // The name of the shape. + Name *string `mandatory:"true" json:"name"` +} + +func (m LoadBalancerShape) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/loadbalancer_client.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/loadbalancer_client.go new file mode 100644 index 0000000000..cb408565e1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/loadbalancer_client.go @@ -0,0 +1,656 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +//LoadBalancerClient a client for LoadBalancer +type LoadBalancerClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewLoadBalancerClientWithConfigurationProvider Creates a new default LoadBalancer client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewLoadBalancerClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client LoadBalancerClient, err error) { + baseClient, err := common.NewClientWithConfig(configProvider) + if err != nil { + return + } + + client = LoadBalancerClient{BaseClient: baseClient} + client.BasePath = "20170115" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *LoadBalancerClient) SetRegion(region string) { + client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "iaas", region) +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *LoadBalancerClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.config = &configProvider + client.SetRegion(region) + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *LoadBalancerClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// CreateBackend Adds a backend server to a backend set. +func (client LoadBalancerClient) CreateBackend(ctx context.Context, request CreateBackendRequest) (response CreateBackendResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}/backends", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateBackendSet Adds a backend set to a load balancer. +func (client LoadBalancerClient) CreateBackendSet(ctx context.Context, request CreateBackendSetRequest) (response CreateBackendSetResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/loadBalancers/{loadBalancerId}/backendSets", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateCertificate Creates an asynchronous request to add an SSL certificate. +func (client LoadBalancerClient) CreateCertificate(ctx context.Context, request CreateCertificateRequest) (response CreateCertificateResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/loadBalancers/{loadBalancerId}/certificates", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateListener Adds a listener to a load balancer. +func (client LoadBalancerClient) CreateListener(ctx context.Context, request CreateListenerRequest) (response CreateListenerResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/loadBalancers/{loadBalancerId}/listeners", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateLoadBalancer Creates a new load balancer in the specified compartment. For general information about load balancers, +// see Overview of the Load Balancing Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Concepts/balanceoverview.htm). +// For the purposes of access control, you must provide the OCID of the compartment where you want +// the load balancer to reside. Notice that the load balancer doesn't have to be in the same compartment as the VCN +// or backend set. If you're not sure which compartment to use, put the load balancer in the same compartment as the VCN. +// For information about access control and compartments, see +// Overview of the IAM Service (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm). +// You must specify a display name for the load balancer. It does not have to be unique, and you can change it. +// For information about Availability Domains, see +// Regions and Availability Domains (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). +// To get a list of Availability Domains, use the `ListAvailabilityDomains` operation +// in the Identity and Access Management Service API. +// All Oracle Cloud Infrastructure resources, including load balancers, get an Oracle-assigned, +// unique ID called an Oracle Cloud Identifier (OCID). When you create a resource, you can find its OCID +// in the response. You can also retrieve a resource's OCID by using a List API operation on that resource type, +// or by viewing the resource in the Console. Fore more information, see +// Resource Identifiers (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm). +// After you send your request, the new object's state will temporarily be PROVISIONING. Before using the +// object, first make sure its state has changed to RUNNING. +// When you create a load balancer, the system assigns an IP address. +// To get the IP address, use the GetLoadBalancer operation. +func (client LoadBalancerClient) CreateLoadBalancer(ctx context.Context, request CreateLoadBalancerRequest) (response CreateLoadBalancerResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/loadBalancers", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteBackend Removes a backend server from a given load balancer and backend set. +func (client LoadBalancerClient) DeleteBackend(ctx context.Context, request DeleteBackendRequest) (response DeleteBackendResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}/backends/{backendName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteBackendSet Deletes the specified backend set. Note that deleting a backend set removes its backend servers from the load balancer. +// Before you can delete a backend set, you must remove it from any active listeners. +func (client LoadBalancerClient) DeleteBackendSet(ctx context.Context, request DeleteBackendSetRequest) (response DeleteBackendSetResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteCertificate Deletes an SSL certificate from a load balancer. +func (client LoadBalancerClient) DeleteCertificate(ctx context.Context, request DeleteCertificateRequest) (response DeleteCertificateResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/loadBalancers/{loadBalancerId}/certificates/{certificateName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteListener Deletes a listener from a load balancer. +func (client LoadBalancerClient) DeleteListener(ctx context.Context, request DeleteListenerRequest) (response DeleteListenerResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/loadBalancers/{loadBalancerId}/listeners/{listenerName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteLoadBalancer Stops a load balancer and removes it from service. +func (client LoadBalancerClient) DeleteLoadBalancer(ctx context.Context, request DeleteLoadBalancerRequest) (response DeleteLoadBalancerResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/loadBalancers/{loadBalancerId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetBackend Gets the specified backend server's configuration information. +func (client LoadBalancerClient) GetBackend(ctx context.Context, request GetBackendRequest) (response GetBackendResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}/backends/{backendName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetBackendHealth Gets the current health status of the specified backend server. +func (client LoadBalancerClient) GetBackendHealth(ctx context.Context, request GetBackendHealthRequest) (response GetBackendHealthResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}/backends/{backendName}/health", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetBackendSet Gets the specified backend set's configuration information. +func (client LoadBalancerClient) GetBackendSet(ctx context.Context, request GetBackendSetRequest) (response GetBackendSetResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetBackendSetHealth Gets the health status for the specified backend set. +func (client LoadBalancerClient) GetBackendSetHealth(ctx context.Context, request GetBackendSetHealthRequest) (response GetBackendSetHealthResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}/health", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetHealthChecker Gets the health check policy information for a given load balancer and backend set. +func (client LoadBalancerClient) GetHealthChecker(ctx context.Context, request GetHealthCheckerRequest) (response GetHealthCheckerResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}/healthChecker", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetLoadBalancer Gets the specified load balancer's configuration information. +func (client LoadBalancerClient) GetLoadBalancer(ctx context.Context, request GetLoadBalancerRequest) (response GetLoadBalancerResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetLoadBalancerHealth Gets the health status for the specified load balancer. +func (client LoadBalancerClient) GetLoadBalancerHealth(ctx context.Context, request GetLoadBalancerHealthRequest) (response GetLoadBalancerHealthResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/health", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetWorkRequest Gets the details of a work request. +func (client LoadBalancerClient) GetWorkRequest(ctx context.Context, request GetWorkRequestRequest) (response GetWorkRequestResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancerWorkRequests/{workRequestId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListBackendSets Lists all backend sets associated with a given load balancer. +func (client LoadBalancerClient) ListBackendSets(ctx context.Context, request ListBackendSetsRequest) (response ListBackendSetsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/backendSets", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListBackends Lists the backend servers for a given load balancer and backend set. +func (client LoadBalancerClient) ListBackends(ctx context.Context, request ListBackendsRequest) (response ListBackendsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}/backends", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListCertificates Lists all SSL certificates associated with a given load balancer. +func (client LoadBalancerClient) ListCertificates(ctx context.Context, request ListCertificatesRequest) (response ListCertificatesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/certificates", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListLoadBalancerHealths Lists the summary health statuses for all load balancers in the specified compartment. +func (client LoadBalancerClient) ListLoadBalancerHealths(ctx context.Context, request ListLoadBalancerHealthsRequest) (response ListLoadBalancerHealthsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancerHealths", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListLoadBalancers Lists all load balancers in the specified compartment. +func (client LoadBalancerClient) ListLoadBalancers(ctx context.Context, request ListLoadBalancersRequest) (response ListLoadBalancersResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListPolicies Lists the available load balancer policies. +func (client LoadBalancerClient) ListPolicies(ctx context.Context, request ListPoliciesRequest) (response ListPoliciesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancerPolicies", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListProtocols Lists all supported traffic protocols. +func (client LoadBalancerClient) ListProtocols(ctx context.Context, request ListProtocolsRequest) (response ListProtocolsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancerProtocols", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListShapes Lists the valid load balancer shapes. +func (client LoadBalancerClient) ListShapes(ctx context.Context, request ListShapesRequest) (response ListShapesResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancerShapes", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListWorkRequests Lists the work requests for a given load balancer. +func (client LoadBalancerClient) ListWorkRequests(ctx context.Context, request ListWorkRequestsRequest) (response ListWorkRequestsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/loadBalancers/{loadBalancerId}/workRequests", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateBackend Updates the configuration of a backend server within the specified backend set. +func (client LoadBalancerClient) UpdateBackend(ctx context.Context, request UpdateBackendRequest) (response UpdateBackendResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}/backends/{backendName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateBackendSet Updates a backend set. +func (client LoadBalancerClient) UpdateBackendSet(ctx context.Context, request UpdateBackendSetRequest) (response UpdateBackendSetResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateHealthChecker Updates the health check policy for a given load balancer and backend set. +func (client LoadBalancerClient) UpdateHealthChecker(ctx context.Context, request UpdateHealthCheckerRequest) (response UpdateHealthCheckerResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/loadBalancers/{loadBalancerId}/backendSets/{backendSetName}/healthChecker", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateListener Updates a listener for a given load balancer. +func (client LoadBalancerClient) UpdateListener(ctx context.Context, request UpdateListenerRequest) (response UpdateListenerResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/loadBalancers/{loadBalancerId}/listeners/{listenerName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateLoadBalancer Updates a load balancer's configuration. +func (client LoadBalancerClient) UpdateLoadBalancer(ctx context.Context, request UpdateLoadBalancerRequest) (response UpdateLoadBalancerResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/loadBalancers/{loadBalancerId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/session_persistence_configuration_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/session_persistence_configuration_details.go new file mode 100644 index 0000000000..a83e81d99c --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/session_persistence_configuration_details.go @@ -0,0 +1,37 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// SessionPersistenceConfigurationDetails The configuration details for implementing session persistence. Session persistence enables the Load Balancing +// Service to direct any number of requests that originate from a single logical client to a single backend web server. +// For more information, see Session Persistence (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Reference/sessionpersistence.htm). +// To disable session persistence on a running load balancer, use the +// UpdateBackendSet operation and specify "null" for the +// `SessionPersistenceConfigurationDetails` object. +// Example: `SessionPersistenceConfigurationDetails: null` +type SessionPersistenceConfigurationDetails struct { + + // The name of the cookie used to detect a session initiated by the backend server. Use '*' to specify + // that any cookie set by the backend causes the session to persist. + // Example: `myCookieName` + CookieName *string `mandatory:"true" json:"cookieName"` + + // Whether the load balancer is prevented from directing traffic from a persistent session client to + // a different backend server if the original server is unavailable. Defaults to false. + // Example: `true` + DisableFallback *bool `mandatory:"false" json:"disableFallback"` +} + +func (m SessionPersistenceConfigurationDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/ssl_configuration.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/ssl_configuration.go new file mode 100644 index 0000000000..5f9c102dca --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/ssl_configuration.go @@ -0,0 +1,36 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// SslConfiguration A listener's SSL handling configuration. +// To use SSL, a listener must be associated with a Certificate. +type SslConfiguration struct { + + // A friendly name for the certificate bundle. It must be unique and it cannot be changed. + // Valid certificate bundle names include only alphanumeric characters, dashes, and underscores. + // Certificate bundle names cannot contain spaces. Avoid entering confidential information. + // Example: `My_certificate_bundle` + CertificateName *string `mandatory:"true" json:"certificateName"` + + // The maximum depth for peer certificate chain verification. + // Example: `3` + VerifyDepth *int `mandatory:"true" json:"verifyDepth"` + + // Whether the load balancer listener should verify peer certificates. + // Example: `true` + VerifyPeerCertificate *bool `mandatory:"true" json:"verifyPeerCertificate"` +} + +func (m SslConfiguration) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/ssl_configuration_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/ssl_configuration_details.go new file mode 100644 index 0000000000..7b083fcf7a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/ssl_configuration_details.go @@ -0,0 +1,35 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// SslConfigurationDetails The load balancer's SSL handling configuration details. +type SslConfigurationDetails struct { + + // A friendly name for the certificate bundle. It must be unique and it cannot be changed. + // Valid certificate bundle names include only alphanumeric characters, dashes, and underscores. + // Certificate bundle names cannot contain spaces. Avoid entering confidential information. + // Example: `My_certificate_bundle` + CertificateName *string `mandatory:"true" json:"certificateName"` + + // The maximum depth for peer certificate chain verification. + // Example: `3` + VerifyDepth *int `mandatory:"false" json:"verifyDepth"` + + // Whether the load balancer listener should verify peer certificates. + // Example: `true` + VerifyPeerCertificate *bool `mandatory:"false" json:"verifyPeerCertificate"` +} + +func (m SslConfigurationDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_details.go new file mode 100644 index 0000000000..56efca6d9e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_details.go @@ -0,0 +1,44 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateBackendDetails The configuration details for updating a backend server. +type UpdateBackendDetails struct { + + // Whether the load balancer should treat this server as a backup unit. If `true`, the load balancer forwards no ingress + // traffic to this backend server unless all other backend servers not marked as "backup" fail the health check policy. + // Example: `true` + Backup *bool `mandatory:"true" json:"backup"` + + // Whether the load balancer should drain this server. Servers marked "drain" receive no new + // incoming traffic. + // Example: `true` + Drain *bool `mandatory:"true" json:"drain"` + + // Whether the load balancer should treat this server as offline. Offline servers receive no incoming + // traffic. + // Example: `true` + Offline *bool `mandatory:"true" json:"offline"` + + // The load balancing policy weight assigned to the server. Backend servers with a higher weight receive a larger + // proportion of incoming traffic. For example, a server weighted '3' receives 3 times the number of new connections + // as a server weighted '1'. + // For more information on load balancing policies, see + // How Load Balancing Policies Work (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Reference/lbpolicies.htm). + // Example: `3` + Weight *int `mandatory:"true" json:"weight"` +} + +func (m UpdateBackendDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_request_response.go new file mode 100644 index 0000000000..0d9915a196 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_request_response.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateBackendRequest wrapper for the UpdateBackend operation +type UpdateBackendRequest struct { + + // Details for updating a backend server. + UpdateBackendDetails `contributesTo:"body"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend set and server. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set associated with the backend server. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The IP address and port of the backend server to update. + // Example: `1.1.1.7:42` + BackendName *string `mandatory:"true" contributesTo:"path" name:"backendName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request UpdateBackendRequest) String() string { + return common.PointerString(request) +} + +// UpdateBackendResponse wrapper for the UpdateBackend operation +type UpdateBackendResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response UpdateBackendResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_set_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_set_details.go new file mode 100644 index 0000000000..4da009e979 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_set_details.go @@ -0,0 +1,35 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateBackendSetDetails The configuration details for updating a load balancer backend set. +// For more information on backend set configuration, see +// Managing Backend Sets (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/tasks/managingbackendsets.htm). +type UpdateBackendSetDetails struct { + Backends []BackendDetails `mandatory:"true" json:"backends"` + + HealthChecker *HealthCheckerDetails `mandatory:"true" json:"healthChecker"` + + // The load balancer policy for the backend set. To get a list of available policies, use the + // ListPolicies operation. + // Example: `LEAST_CONNECTIONS` + Policy *string `mandatory:"true" json:"policy"` + + SessionPersistenceConfiguration *SessionPersistenceConfigurationDetails `mandatory:"false" json:"sessionPersistenceConfiguration"` + + SslConfiguration *SslConfigurationDetails `mandatory:"false" json:"sslConfiguration"` +} + +func (m UpdateBackendSetDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_set_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_set_request_response.go new file mode 100644 index 0000000000..e099e1db47 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_backend_set_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateBackendSetRequest wrapper for the UpdateBackendSet operation +type UpdateBackendSetRequest struct { + + // The details to update a backend set. + UpdateBackendSetDetails `contributesTo:"body"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend set. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set to update. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request UpdateBackendSetRequest) String() string { + return common.PointerString(request) +} + +// UpdateBackendSetResponse wrapper for the UpdateBackendSet operation +type UpdateBackendSetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response UpdateBackendSetResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_health_checker_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_health_checker_details.go new file mode 100644 index 0000000000..5e2e8cda8d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_health_checker_details.go @@ -0,0 +1,54 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateHealthCheckerDetails The health checker's configuration details. +type UpdateHealthCheckerDetails struct { + + // The interval between health checks, in milliseconds. + // Example: `30000` + IntervalInMillis *int `mandatory:"true" json:"intervalInMillis"` + + // The backend server port against which to run the health check. + // Example: `8080` + Port *int `mandatory:"true" json:"port"` + + // The protocol the health check must use; either HTTP or TCP. + // Example: `HTTP` + Protocol *string `mandatory:"true" json:"protocol"` + + // A regular expression for parsing the response body from the backend server. + // Example: `^(500|40[1348])$` + ResponseBodyRegex *string `mandatory:"true" json:"responseBodyRegex"` + + // The number of retries to attempt before a backend server is considered "unhealthy". + // Example: `3` + Retries *int `mandatory:"true" json:"retries"` + + // The status code a healthy backend server should return. + // Example: `200` + ReturnCode *int `mandatory:"true" json:"returnCode"` + + // The maximum time, in milliseconds, to wait for a reply to a health check. A health check is successful only if a reply + // returns within this timeout period. + // Example: `6000` + TimeoutInMillis *int `mandatory:"true" json:"timeoutInMillis"` + + // The path against which to run the health check. + // Example: `/healthcheck` + UrlPath *string `mandatory:"false" json:"urlPath"` +} + +func (m UpdateHealthCheckerDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_health_checker_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_health_checker_request_response.go new file mode 100644 index 0000000000..54ddccbbe0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_health_checker_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateHealthCheckerRequest wrapper for the UpdateHealthChecker operation +type UpdateHealthCheckerRequest struct { + + // The health check policy configuration details. + UpdateHealthCheckerDetails `contributesTo:"body"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the health check policy to be updated. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the backend set associated with the health check policy to be retrieved. + // Example: `My_backend_set` + BackendSetName *string `mandatory:"true" contributesTo:"path" name:"backendSetName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request UpdateHealthCheckerRequest) String() string { + return common.PointerString(request) +} + +// UpdateHealthCheckerResponse wrapper for the UpdateHealthChecker operation +type UpdateHealthCheckerResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response UpdateHealthCheckerResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_listener_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_listener_details.go new file mode 100644 index 0000000000..c935eac546 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_listener_details.go @@ -0,0 +1,36 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateListenerDetails The configuration details for updating a listener. +type UpdateListenerDetails struct { + + // The name of the associated backend set. + DefaultBackendSetName *string `mandatory:"true" json:"defaultBackendSetName"` + + // The communication port for the listener. + // Example: `80` + Port *int `mandatory:"true" json:"port"` + + // The protocol on which the listener accepts connection requests. + // To get a list of valid protocols, use the ListProtocols + // operation. + // Example: `HTTP` + Protocol *string `mandatory:"true" json:"protocol"` + + SslConfiguration *SslConfigurationDetails `mandatory:"false" json:"sslConfiguration"` +} + +func (m UpdateListenerDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_listener_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_listener_request_response.go new file mode 100644 index 0000000000..b07a7a2500 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_listener_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateListenerRequest wrapper for the UpdateListener operation +type UpdateListenerRequest struct { + + // Details to update a listener. + UpdateListenerDetails `contributesTo:"body"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer associated with the listener to update. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The name of the listener to update. + // Example: `My listener` + ListenerName *string `mandatory:"true" contributesTo:"path" name:"listenerName"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request UpdateListenerRequest) String() string { + return common.PointerString(request) +} + +// UpdateListenerResponse wrapper for the UpdateListener operation +type UpdateListenerResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response UpdateListenerResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_load_balancer_details.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_load_balancer_details.go new file mode 100644 index 0000000000..8a66761f46 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_load_balancer_details.go @@ -0,0 +1,26 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateLoadBalancerDetails Configuration details to update a load balancer. +type UpdateLoadBalancerDetails struct { + + // The user-friendly display name for the load balancer. It does not have to be unique, and it is changeable. + // Avoid entering confidential information. + // Example: `My load balancer` + DisplayName *string `mandatory:"true" json:"displayName"` +} + +func (m UpdateLoadBalancerDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_load_balancer_request_response.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_load_balancer_request_response.go new file mode 100644 index 0000000000..15101ba1c0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/update_load_balancer_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateLoadBalancerRequest wrapper for the UpdateLoadBalancer operation +type UpdateLoadBalancerRequest struct { + + // The details for updating a load balancer's configuration. + UpdateLoadBalancerDetails `contributesTo:"body"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer to update. + LoadBalancerId *string `mandatory:"true" contributesTo:"path" name:"loadBalancerId"` + + // The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations (e.g., if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // may be rejected). + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` +} + +func (request UpdateLoadBalancerRequest) String() string { + return common.PointerString(request) +} + +// UpdateLoadBalancerResponse wrapper for the UpdateLoadBalancer operation +type UpdateLoadBalancerResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + // a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` +} + +func (response UpdateLoadBalancerResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/work_request.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/work_request.go new file mode 100644 index 0000000000..0a8a007f44 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/work_request.go @@ -0,0 +1,82 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// WorkRequest 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. +// For more information about work requests, see Viewing the State of a Work Request (https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/viewingworkrequest.htm). +type WorkRequest struct { + ErrorDetails []WorkRequestError `mandatory:"true" json:"errorDetails"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the work request. + Id *string `mandatory:"true" json:"id"` + + // The current state of the work request. + LifecycleState WorkRequestLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the load balancer with which the work request + // is associated. + LoadBalancerId *string `mandatory:"true" json:"loadBalancerId"` + + // A collection of data, related to the load balancer provisioning process, that helps with debugging in the event of failure. + // Possible data elements include: + // - workflow name + // - event ID + // - work request ID + // - load balancer ID + // - workflow completion message + Message *string `mandatory:"true" json:"message"` + + // The date and time the work request was created, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeAccepted *common.SDKTime `mandatory:"true" json:"timeAccepted"` + + // The type of action the work request represents. + Type *string `mandatory:"true" json:"type"` + + // The date and time the work request was completed, in the format defined by RFC3339. + // Example: `2016-08-25T21:10:29.600Z` + TimeFinished *common.SDKTime `mandatory:"false" json:"timeFinished"` +} + +func (m WorkRequest) String() string { + return common.PointerString(m) +} + +// WorkRequestLifecycleStateEnum Enum with underlying type: string +type WorkRequestLifecycleStateEnum string + +// Set of constants representing the allowable values for WorkRequestLifecycleState +const ( + WorkRequestLifecycleStateAccepted WorkRequestLifecycleStateEnum = "ACCEPTED" + WorkRequestLifecycleStateInProgress WorkRequestLifecycleStateEnum = "IN_PROGRESS" + WorkRequestLifecycleStateFailed WorkRequestLifecycleStateEnum = "FAILED" + WorkRequestLifecycleStateSucceeded WorkRequestLifecycleStateEnum = "SUCCEEDED" +) + +var mappingWorkRequestLifecycleState = map[string]WorkRequestLifecycleStateEnum{ + "ACCEPTED": WorkRequestLifecycleStateAccepted, + "IN_PROGRESS": WorkRequestLifecycleStateInProgress, + "FAILED": WorkRequestLifecycleStateFailed, + "SUCCEEDED": WorkRequestLifecycleStateSucceeded, +} + +// GetWorkRequestLifecycleStateEnumValues Enumerates the set of values for WorkRequestLifecycleState +func GetWorkRequestLifecycleStateEnumValues() []WorkRequestLifecycleStateEnum { + values := make([]WorkRequestLifecycleStateEnum, 0) + for _, v := range mappingWorkRequestLifecycleState { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/loadbalancer/work_request_error.go b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/work_request_error.go new file mode 100644 index 0000000000..6b755f4b1b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/loadbalancer/work_request_error.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Load Balancing Service API +// +// API for the Load Balancing Service +// + +package loadbalancer + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// WorkRequestError An object returned in the event of a work request error. +type WorkRequestError struct { + ErrorCode WorkRequestErrorErrorCodeEnum `mandatory:"true" json:"errorCode"` + + // A human-readable error string. + Message *string `mandatory:"true" json:"message"` +} + +func (m WorkRequestError) String() string { + return common.PointerString(m) +} + +// WorkRequestErrorErrorCodeEnum Enum with underlying type: string +type WorkRequestErrorErrorCodeEnum string + +// Set of constants representing the allowable values for WorkRequestErrorErrorCode +const ( + WorkRequestErrorErrorCodeBadInput WorkRequestErrorErrorCodeEnum = "BAD_INPUT" + WorkRequestErrorErrorCodeInternalError WorkRequestErrorErrorCodeEnum = "INTERNAL_ERROR" +) + +var mappingWorkRequestErrorErrorCode = map[string]WorkRequestErrorErrorCodeEnum{ + "BAD_INPUT": WorkRequestErrorErrorCodeBadInput, + "INTERNAL_ERROR": WorkRequestErrorErrorCodeInternalError, +} + +// GetWorkRequestErrorErrorCodeEnumValues Enumerates the set of values for WorkRequestErrorErrorCode +func GetWorkRequestErrorErrorCodeEnumValues() []WorkRequestErrorErrorCodeEnum { + values := make([]WorkRequestErrorErrorCodeEnum, 0) + for _, v := range mappingWorkRequestErrorErrorCode { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/abort_multipart_upload_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/abort_multipart_upload_request_response.go new file mode 100644 index 0000000000..8858e10666 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/abort_multipart_upload_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// AbortMultipartUploadRequest wrapper for the AbortMultipartUpload operation +type AbortMultipartUploadRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The name of the object. + // Example: `test/object1.log` + ObjectName *string `mandatory:"true" contributesTo:"path" name:"objectName"` + + // The upload ID for a multipart upload. + UploadId *string `mandatory:"true" contributesTo:"query" name:"uploadId"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request AbortMultipartUploadRequest) String() string { + return common.PointerString(request) +} + +// AbortMultipartUploadResponse wrapper for the AbortMultipartUpload operation +type AbortMultipartUploadResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response AbortMultipartUploadResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/bucket.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/bucket.go new file mode 100644 index 0000000000..81462ba1a1 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/bucket.go @@ -0,0 +1,73 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// Bucket To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type Bucket struct { + + // The namespace in which the bucket lives. + Namespace *string `mandatory:"true" json:"namespace"` + + // The name of the bucket. + Name *string `mandatory:"true" json:"name"` + + // The compartment ID in which the bucket is authorized. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Arbitrary string keys and values for user-defined metadata. + Metadata map[string]string `mandatory:"true" json:"metadata"` + + // The OCID of the user who created the bucket. + CreatedBy *string `mandatory:"true" json:"createdBy"` + + // The date and time at which the bucket was created. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The entity tag for the bucket. + Etag *string `mandatory:"true" json:"etag"` + + // The type of public access available on this bucket. Allows authenticated caller to access the bucket or + // contents of this bucket. By default a bucket is set to NoPublicAccess. It is treated as NoPublicAccess + // when this value is not specified. When the type is NoPublicAccess the bucket does not allow any public access. + // When the type is ObjectRead the bucket allows public access to the GetObject, HeadObject, ListObjects. + PublicAccessType BucketPublicAccessTypeEnum `mandatory:"false" json:"publicAccessType,omitempty"` +} + +func (m Bucket) String() string { + return common.PointerString(m) +} + +// BucketPublicAccessTypeEnum Enum with underlying type: string +type BucketPublicAccessTypeEnum string + +// Set of constants representing the allowable values for BucketPublicAccessType +const ( + BucketPublicAccessTypeNopublicaccess BucketPublicAccessTypeEnum = "NoPublicAccess" + BucketPublicAccessTypeObjectread BucketPublicAccessTypeEnum = "ObjectRead" +) + +var mappingBucketPublicAccessType = map[string]BucketPublicAccessTypeEnum{ + "NoPublicAccess": BucketPublicAccessTypeNopublicaccess, + "ObjectRead": BucketPublicAccessTypeObjectread, +} + +// GetBucketPublicAccessTypeEnumValues Enumerates the set of values for BucketPublicAccessType +func GetBucketPublicAccessTypeEnumValues() []BucketPublicAccessTypeEnum { + values := make([]BucketPublicAccessTypeEnum, 0) + for _, v := range mappingBucketPublicAccessType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/bucket_summary.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/bucket_summary.go new file mode 100644 index 0000000000..028177a527 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/bucket_summary.go @@ -0,0 +1,41 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// BucketSummary To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type BucketSummary struct { + + // The namespace in which the bucket lives. + Namespace *string `mandatory:"true" json:"namespace"` + + // The name of the bucket. + Name *string `mandatory:"true" json:"name"` + + // The compartment ID in which the bucket is authorized. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the user who created the bucket. + CreatedBy *string `mandatory:"true" json:"createdBy"` + + // The date and time at which the bucket was created. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The entity tag for the bucket. + Etag *string `mandatory:"true" json:"etag"` +} + +func (m BucketSummary) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/commit_multipart_upload_details.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/commit_multipart_upload_details.go new file mode 100644 index 0000000000..c285f73832 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/commit_multipart_upload_details.go @@ -0,0 +1,30 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CommitMultipartUploadDetails To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type CommitMultipartUploadDetails struct { + + // The part numbers and ETags for the parts to be committed. + PartsToCommit []CommitMultipartUploadPartDetails `mandatory:"true" json:"partsToCommit"` + + // The part numbers for the parts to be excluded from the completed object. + // Each part created for this upload must be in either partsToExclude or partsToCommit, but cannot be in both. + PartsToExclude []int `mandatory:"false" json:"partsToExclude"` +} + +func (m CommitMultipartUploadDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/commit_multipart_upload_part_details.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/commit_multipart_upload_part_details.go new file mode 100644 index 0000000000..a4d053b377 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/commit_multipart_upload_part_details.go @@ -0,0 +1,29 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CommitMultipartUploadPartDetails To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type CommitMultipartUploadPartDetails struct { + + // The part number for this part. + PartNum *int `mandatory:"true" json:"partNum"` + + // The ETag returned when this part was uploaded. + Etag *string `mandatory:"true" json:"etag"` +} + +func (m CommitMultipartUploadPartDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/commit_multipart_upload_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/commit_multipart_upload_request_response.go new file mode 100644 index 0000000000..1018342549 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/commit_multipart_upload_request_response.go @@ -0,0 +1,76 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CommitMultipartUploadRequest wrapper for the CommitMultipartUpload operation +type CommitMultipartUploadRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The name of the object. + // Example: `test/object1.log` + ObjectName *string `mandatory:"true" contributesTo:"path" name:"objectName"` + + // The upload ID for a multipart upload. + UploadId *string `mandatory:"true" contributesTo:"query" name:"uploadId"` + + // The part numbers and ETags for the parts you want to commit. + CommitMultipartUploadDetails `contributesTo:"body"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The entity tag to avoid matching. The only valid value is ‘*’, which indicates that the request should fail if the object already exists. + // For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag + // of the target part. + IfNoneMatch *string `mandatory:"false" contributesTo:"header" name:"if-none-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request CommitMultipartUploadRequest) String() string { + return common.PointerString(request) +} + +// CommitMultipartUploadResponse wrapper for the CommitMultipartUpload operation +type CommitMultipartUploadResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // Base-64 representation of the multipart object hash. + // The multipart object hash is calculated by taking the MD5 hashes of the parts passed to this call, + // concatenating the binary representation of those hashes in order of their part numbers, + // and then calculating the MD5 hash of the concatenated values. + OpcMultipartMd5 *string `presentIn:"header" name:"opc-multipart-md5"` + + // The entity tag for the object. + ETag *string `presentIn:"header" name:"etag"` + + // The time the object was last modified, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.29. + LastModified *common.SDKTime `presentIn:"header" name:"last-modified"` +} + +func (response CommitMultipartUploadResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_bucket_details.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_bucket_details.go new file mode 100644 index 0000000000..b6be2982c4 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_bucket_details.go @@ -0,0 +1,62 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateBucketDetails To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type CreateBucketDetails struct { + + // The name of the bucket. Valid characters are uppercase or lowercase letters, + // numbers, and dashes. Bucket names must be unique within the namespace. + Name *string `mandatory:"true" json:"name"` + + // The ID of the compartment in which to create the bucket. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Arbitrary string, up to 4KB, of keys and values for user-defined metadata. + Metadata map[string]string `mandatory:"false" json:"metadata"` + + // The type of public access available on this bucket. Allows authenticated caller to access the bucket or + // contents of this bucket. By default a bucket is set to NoPublicAccess. It is treated as NoPublicAccess + // when this value is not specified. When the type is NoPublicAccess the bucket does not allow any public access. + // When the type is ObjectRead the bucket allows public access to the GetObject, HeadObject, ListObjects. + PublicAccessType CreateBucketDetailsPublicAccessTypeEnum `mandatory:"false" json:"publicAccessType,omitempty"` +} + +func (m CreateBucketDetails) String() string { + return common.PointerString(m) +} + +// CreateBucketDetailsPublicAccessTypeEnum Enum with underlying type: string +type CreateBucketDetailsPublicAccessTypeEnum string + +// Set of constants representing the allowable values for CreateBucketDetailsPublicAccessType +const ( + CreateBucketDetailsPublicAccessTypeNopublicaccess CreateBucketDetailsPublicAccessTypeEnum = "NoPublicAccess" + CreateBucketDetailsPublicAccessTypeObjectread CreateBucketDetailsPublicAccessTypeEnum = "ObjectRead" +) + +var mappingCreateBucketDetailsPublicAccessType = map[string]CreateBucketDetailsPublicAccessTypeEnum{ + "NoPublicAccess": CreateBucketDetailsPublicAccessTypeNopublicaccess, + "ObjectRead": CreateBucketDetailsPublicAccessTypeObjectread, +} + +// GetCreateBucketDetailsPublicAccessTypeEnumValues Enumerates the set of values for CreateBucketDetailsPublicAccessType +func GetCreateBucketDetailsPublicAccessTypeEnumValues() []CreateBucketDetailsPublicAccessTypeEnum { + values := make([]CreateBucketDetailsPublicAccessTypeEnum, 0) + for _, v := range mappingCreateBucketDetailsPublicAccessType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_bucket_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_bucket_request_response.go new file mode 100644 index 0000000000..00a7aa13cd --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_bucket_request_response.go @@ -0,0 +1,53 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateBucketRequest wrapper for the CreateBucket operation +type CreateBucketRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // Request object for creating a bucket. + CreateBucketDetails `contributesTo:"body"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request CreateBucketRequest) String() string { + return common.PointerString(request) +} + +// CreateBucketResponse wrapper for the CreateBucket operation +type CreateBucketResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Bucket instance + Bucket `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The entity tag for the bucket that was created. + ETag *string `presentIn:"header" name:"etag"` + + // The full path to the bucket that was created. + Location *string `presentIn:"header" name:"location"` +} + +func (response CreateBucketResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_multipart_upload_details.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_multipart_upload_details.go new file mode 100644 index 0000000000..f21262d546 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_multipart_upload_details.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreateMultipartUploadDetails To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type CreateMultipartUploadDetails struct { + + // the name of the object to which this multi-part upload is targetted. + Object *string `mandatory:"true" json:"object"` + + // the content type of the object to upload. + ContentType *string `mandatory:"false" json:"contentType"` + + // the content language of the object to upload. + ContentLanguage *string `mandatory:"false" json:"contentLanguage"` + + // the content encoding of the object to upload. + ContentEncoding *string `mandatory:"false" json:"contentEncoding"` + + // Arbitrary string keys and values for the user-defined metadata for the object. + // Keys must be in "opc-meta-*" format. + Metadata map[string]string `mandatory:"false" json:"metadata"` +} + +func (m CreateMultipartUploadDetails) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_multipart_upload_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_multipart_upload_request_response.go new file mode 100644 index 0000000000..ca790ade05 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_multipart_upload_request_response.go @@ -0,0 +1,63 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreateMultipartUploadRequest wrapper for the CreateMultipartUpload operation +type CreateMultipartUploadRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // Request object for creating a multi-part upload. + CreateMultipartUploadDetails `contributesTo:"body"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The entity tag to avoid matching. The only valid value is ‘*’, which indicates that the request should fail if the object already exists. + // For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag + // of the target part. + IfNoneMatch *string `mandatory:"false" contributesTo:"header" name:"if-none-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request CreateMultipartUploadRequest) String() string { + return common.PointerString(request) +} + +// CreateMultipartUploadResponse wrapper for the CreateMultipartUpload operation +type CreateMultipartUploadResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The MultipartUpload instance + MultipartUpload `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The full path to the new upload. + Location *string `presentIn:"header" name:"location"` +} + +func (response CreateMultipartUploadResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_preauthenticated_request_details.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_preauthenticated_request_details.go new file mode 100644 index 0000000000..498dc6dd4a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_preauthenticated_request_details.go @@ -0,0 +1,61 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// CreatePreauthenticatedRequestDetails The representation of CreatePreauthenticatedRequestDetails +type CreatePreauthenticatedRequestDetails struct { + + // user specified name for pre-authenticated request. Helpful for management purposes. + Name *string `mandatory:"true" json:"name"` + + // the operation that can be performed on this resource e.g PUT or GET. + AccessType CreatePreauthenticatedRequestDetailsAccessTypeEnum `mandatory:"true" json:"accessType"` + + // The expiration date after which the pre-authenticated request will no longer be valid per spec + // RFC 3339 (https://tools.ietf.org/rfc/rfc3339) + TimeExpires *common.SDKTime `mandatory:"true" json:"timeExpires"` + + // Name of object that is being granted access to by the pre-authenticated request. This can be null and that would mean that the pre-authenticated request is granting access to the entire bucket + ObjectName *string `mandatory:"false" json:"objectName"` +} + +func (m CreatePreauthenticatedRequestDetails) String() string { + return common.PointerString(m) +} + +// CreatePreauthenticatedRequestDetailsAccessTypeEnum Enum with underlying type: string +type CreatePreauthenticatedRequestDetailsAccessTypeEnum string + +// Set of constants representing the allowable values for CreatePreauthenticatedRequestDetailsAccessType +const ( + CreatePreauthenticatedRequestDetailsAccessTypeObjectread CreatePreauthenticatedRequestDetailsAccessTypeEnum = "ObjectRead" + CreatePreauthenticatedRequestDetailsAccessTypeObjectwrite CreatePreauthenticatedRequestDetailsAccessTypeEnum = "ObjectWrite" + CreatePreauthenticatedRequestDetailsAccessTypeObjectreadwrite CreatePreauthenticatedRequestDetailsAccessTypeEnum = "ObjectReadWrite" + CreatePreauthenticatedRequestDetailsAccessTypeAnyobjectwrite CreatePreauthenticatedRequestDetailsAccessTypeEnum = "AnyObjectWrite" +) + +var mappingCreatePreauthenticatedRequestDetailsAccessType = map[string]CreatePreauthenticatedRequestDetailsAccessTypeEnum{ + "ObjectRead": CreatePreauthenticatedRequestDetailsAccessTypeObjectread, + "ObjectWrite": CreatePreauthenticatedRequestDetailsAccessTypeObjectwrite, + "ObjectReadWrite": CreatePreauthenticatedRequestDetailsAccessTypeObjectreadwrite, + "AnyObjectWrite": CreatePreauthenticatedRequestDetailsAccessTypeAnyobjectwrite, +} + +// GetCreatePreauthenticatedRequestDetailsAccessTypeEnumValues Enumerates the set of values for CreatePreauthenticatedRequestDetailsAccessType +func GetCreatePreauthenticatedRequestDetailsAccessTypeEnumValues() []CreatePreauthenticatedRequestDetailsAccessTypeEnum { + values := make([]CreatePreauthenticatedRequestDetailsAccessTypeEnum, 0) + for _, v := range mappingCreatePreauthenticatedRequestDetailsAccessType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_preauthenticated_request_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_preauthenticated_request_request_response.go new file mode 100644 index 0000000000..f0580b6d18 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/create_preauthenticated_request_request_response.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// CreatePreauthenticatedRequestRequest wrapper for the CreatePreauthenticatedRequest operation +type CreatePreauthenticatedRequestRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // details for creating the pre-authenticated request. + CreatePreauthenticatedRequestDetails `contributesTo:"body"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request CreatePreauthenticatedRequestRequest) String() string { + return common.PointerString(request) +} + +// CreatePreauthenticatedRequestResponse wrapper for the CreatePreauthenticatedRequest operation +type CreatePreauthenticatedRequestResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The PreauthenticatedRequest instance + PreauthenticatedRequest `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreatePreauthenticatedRequestResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/delete_bucket_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/delete_bucket_request_response.go new file mode 100644 index 0000000000..71385a147f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/delete_bucket_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteBucketRequest wrapper for the DeleteBucket operation +type DeleteBucketRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request DeleteBucketRequest) String() string { + return common.PointerString(request) +} + +// DeleteBucketResponse wrapper for the DeleteBucket operation +type DeleteBucketResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteBucketResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/delete_object_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/delete_object_request_response.go new file mode 100644 index 0000000000..ae33f3a610 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/delete_object_request_response.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeleteObjectRequest wrapper for the DeleteObject operation +type DeleteObjectRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The name of the object. + // Example: `test/object1.log` + ObjectName *string `mandatory:"true" contributesTo:"path" name:"objectName"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request DeleteObjectRequest) String() string { + return common.PointerString(request) +} + +// DeleteObjectResponse wrapper for the DeleteObject operation +type DeleteObjectResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The time the object was deleted, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.29. + LastModified *common.SDKTime `presentIn:"header" name:"last-modified"` +} + +func (response DeleteObjectResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/delete_preauthenticated_request_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/delete_preauthenticated_request_request_response.go new file mode 100644 index 0000000000..675d24927d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/delete_preauthenticated_request_request_response.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// DeletePreauthenticatedRequestRequest wrapper for the DeletePreauthenticatedRequest operation +type DeletePreauthenticatedRequestRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The unique identifier for the pre-authenticated request (PAR). This can be used to manage the PAR + // such as GET or DELETE the PAR + ParId *string `mandatory:"true" contributesTo:"path" name:"parId"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request DeletePreauthenticatedRequestRequest) String() string { + return common.PointerString(request) +} + +// DeletePreauthenticatedRequestResponse wrapper for the DeletePreauthenticatedRequest operation +type DeletePreauthenticatedRequestResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeletePreauthenticatedRequestResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_bucket_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_bucket_request_response.go new file mode 100644 index 0000000000..4284a4a56b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_bucket_request_response.go @@ -0,0 +1,66 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetBucketRequest wrapper for the GetBucket operation +type GetBucketRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The entity tag to avoid matching. The only valid value is ‘*’, which indicates that the request should fail if the object already exists. + // For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag + // of the target part. + IfNoneMatch *string `mandatory:"false" contributesTo:"header" name:"if-none-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request GetBucketRequest) String() string { + return common.PointerString(request) +} + +// GetBucketResponse wrapper for the GetBucket operation +type GetBucketResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Bucket instance + Bucket `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The current entity tag for the bucket. + ETag *string `presentIn:"header" name:"etag"` + + // Flag to indicate whether or not the object was modified. If this is true, + // the getter for the object itself will return null. Callers should check this + // if they specified one of the request params that might result in a conditional + // response (like 'if-match'/'if-none-match'). + IsNotModified bool +} + +func (response GetBucketResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_namespace_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_namespace_request_response.go new file mode 100644 index 0000000000..043ae9c99a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_namespace_request_response.go @@ -0,0 +1,34 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetNamespaceRequest wrapper for the GetNamespace operation +type GetNamespaceRequest struct { + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request GetNamespaceRequest) String() string { + return common.PointerString(request) +} + +// GetNamespaceResponse wrapper for the GetNamespace operation +type GetNamespaceResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The string instance + Value *string `presentIn:"body"` +} + +func (response GetNamespaceResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_object_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_object_request_response.go new file mode 100644 index 0000000000..f75e36b74b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_object_request_response.go @@ -0,0 +1,107 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "io" + "net/http" +) + +// GetObjectRequest wrapper for the GetObject operation +type GetObjectRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The name of the object. + // Example: `test/object1.log` + ObjectName *string `mandatory:"true" contributesTo:"path" name:"objectName"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The entity tag to avoid matching. The only valid value is ‘*’, which indicates that the request should fail if the object already exists. + // For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag + // of the target part. + IfNoneMatch *string `mandatory:"false" contributesTo:"header" name:"if-none-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` + + // Optional byte range to fetch, as described in RFC 7233 (https://tools.ietf.org/rfc/rfc7233), section 2.1. + // Note, only a single range of bytes is supported. + Range *string `mandatory:"false" contributesTo:"header" name:"range"` +} + +func (request GetObjectRequest) String() string { + return common.PointerString(request) +} + +// GetObjectResponse wrapper for the GetObject operation +type GetObjectResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The io.ReadCloser instance + Content io.ReadCloser `presentIn:"body" encoding:"binary"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The entity tag for the object. + ETag *string `presentIn:"header" name:"etag"` + + // The user-defined metadata for the object. + OpcMeta map[string]string `presentIn:"header-collection" prefix:"opc-meta-"` + + // The object size in bytes. + ContentLength *int `presentIn:"header" name:"content-length"` + + // Content-Range header for range requests, per RFC 7233 (https://tools.ietf.org/rfc/rfc7233), section 4.2. + ContentRange *string `presentIn:"header" name:"content-range"` + + // Content-MD5 header, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.15. + // Unavailable for objects uploaded using multipart upload. + ContentMd5 *string `presentIn:"header" name:"content-md5"` + + // Only applicable to objects uploaded using multipart upload. + // Base-64 representation of the multipart object hash. + // The multipart object hash is calculated by taking the MD5 hashes of the parts, + // concatenating the binary representation of those hashes in order of their part numbers, + // and then calculating the MD5 hash of the concatenated values. + OpcMultipartMd5 *string `presentIn:"header" name:"opc-multipart-md5"` + + // Content-Type header, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.17. + ContentType *string `presentIn:"header" name:"content-type"` + + // Content-Language header, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.12. + ContentLanguage *string `presentIn:"header" name:"content-language"` + + // Content-Encoding header, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.11. + ContentEncoding *string `presentIn:"header" name:"content-encoding"` + + // The object modification time, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.29. + LastModified *common.SDKTime `presentIn:"header" name:"last-modified"` + + // Flag to indicate whether or not the object was modified. If this is true, + // the getter for the object itself will return null. Callers should check this + // if they specified one of the request params that might result in a conditional + // response (like 'if-match'/'if-none-match'). + IsNotModified bool +} + +func (response GetObjectResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_preauthenticated_request_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_preauthenticated_request_request_response.go new file mode 100644 index 0000000000..0e41fff80b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/get_preauthenticated_request_request_response.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// GetPreauthenticatedRequestRequest wrapper for the GetPreauthenticatedRequest operation +type GetPreauthenticatedRequestRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The unique identifier for the pre-authenticated request (PAR). This can be used to manage the PAR + // such as GET or DELETE the PAR + ParId *string `mandatory:"true" contributesTo:"path" name:"parId"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request GetPreauthenticatedRequestRequest) String() string { + return common.PointerString(request) +} + +// GetPreauthenticatedRequestResponse wrapper for the GetPreauthenticatedRequest operation +type GetPreauthenticatedRequestResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The PreauthenticatedRequestSummary instance + PreauthenticatedRequestSummary `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetPreauthenticatedRequestResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/head_bucket_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/head_bucket_request_response.go new file mode 100644 index 0000000000..cca2efc723 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/head_bucket_request_response.go @@ -0,0 +1,63 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// HeadBucketRequest wrapper for the HeadBucket operation +type HeadBucketRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The entity tag to avoid matching. The only valid value is ‘*’, which indicates that the request should fail if the object already exists. + // For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag + // of the target part. + IfNoneMatch *string `mandatory:"false" contributesTo:"header" name:"if-none-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request HeadBucketRequest) String() string { + return common.PointerString(request) +} + +// HeadBucketResponse wrapper for the HeadBucket operation +type HeadBucketResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The current entity tag for the bucket. + ETag *string `presentIn:"header" name:"etag"` + + // Flag to indicate whether or not the object was modified. If this is true, + // the getter for the object itself will return null. Callers should check this + // if they specified one of the request params that might result in a conditional + // response (like 'if-match'/'if-none-match'). + IsNotModified bool +} + +func (response HeadBucketResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/head_object_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/head_object_request_response.go new file mode 100644 index 0000000000..b058a2d01a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/head_object_request_response.go @@ -0,0 +1,96 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// HeadObjectRequest wrapper for the HeadObject operation +type HeadObjectRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The name of the object. + // Example: `test/object1.log` + ObjectName *string `mandatory:"true" contributesTo:"path" name:"objectName"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The entity tag to avoid matching. The only valid value is ‘*’, which indicates that the request should fail if the object already exists. + // For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag + // of the target part. + IfNoneMatch *string `mandatory:"false" contributesTo:"header" name:"if-none-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request HeadObjectRequest) String() string { + return common.PointerString(request) +} + +// HeadObjectResponse wrapper for the HeadObject operation +type HeadObjectResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The entity tag for the object. + ETag *string `presentIn:"header" name:"etag"` + + // The user-defined metadata for the object. + OpcMeta map[string]string `presentIn:"header-collection" prefix:"opc-meta-"` + + // The object size in bytes. + ContentLength *int `presentIn:"header" name:"content-length"` + + // Content-MD5 header, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.15. + // Unavailable for objects uploaded using multipart upload. + ContentMd5 *string `presentIn:"header" name:"content-md5"` + + // Only applicable to objects uploaded using multipart upload. + // Base-64 representation of the multipart object hash. + // The multipart object hash is calculated by taking the MD5 hashes of the parts, + // concatenating the binary representation of those hashes in order of their part numbers, + // and then calculating the MD5 hash of the concatenated values. + OpcMultipartMd5 *string `presentIn:"header" name:"opc-multipart-md5"` + + // Content-Type header, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.17. + ContentType *string `presentIn:"header" name:"content-type"` + + // Content-Language header, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.12. + ContentLanguage *string `presentIn:"header" name:"content-language"` + + // Content-Encoding header, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.11. + ContentEncoding *string `presentIn:"header" name:"content-encoding"` + + // The object modification time, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.29. + LastModified *common.SDKTime `presentIn:"header" name:"last-modified"` + + // Flag to indicate whether or not the object was modified. If this is true, + // the getter for the object itself will return null. Callers should check this + // if they specified one of the request params that might result in a conditional + // response (like 'if-match'/'if-none-match'). + IsNotModified bool +} + +func (response HeadObjectResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_buckets_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_buckets_request_response.go new file mode 100644 index 0000000000..09474ba93e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_buckets_request_response.go @@ -0,0 +1,59 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListBucketsRequest wrapper for the ListBuckets operation +type ListBucketsRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The ID of the compartment in which to create the bucket. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The page at which to start retrieving results. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request ListBucketsRequest) String() string { + return common.PointerString(request) +} + +// ListBucketsResponse wrapper for the ListBuckets operation +type ListBucketsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []BucketSummary instance + Items []BucketSummary `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of `Bucket`s. If this header appears in the response, then this + // is a partial list of buckets. Include this value as the `page` parameter in a subsequent + // GET request to get the next batch of buckets. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#nine). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListBucketsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_multipart_upload_parts_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_multipart_upload_parts_request_response.go new file mode 100644 index 0000000000..367ea7af79 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_multipart_upload_parts_request_response.go @@ -0,0 +1,67 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListMultipartUploadPartsRequest wrapper for the ListMultipartUploadParts operation +type ListMultipartUploadPartsRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The name of the object. + // Example: `test/object1.log` + ObjectName *string `mandatory:"true" contributesTo:"path" name:"objectName"` + + // The upload ID for a multipart upload. + UploadId *string `mandatory:"true" contributesTo:"query" name:"uploadId"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The page at which to start retrieving results. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request ListMultipartUploadPartsRequest) String() string { + return common.PointerString(request) +} + +// ListMultipartUploadPartsResponse wrapper for the ListMultipartUploadParts operation +type ListMultipartUploadPartsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []MultipartUploadPartSummary instance + Items []MultipartUploadPartSummary `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of `MultipartUploadPartSummary`s. If this header appears in the response, + // then this is a partial list of object parts. Include this value as the `page` parameter in a subsequent + // GET request to get the next batch of object parts. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListMultipartUploadPartsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_multipart_uploads_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_multipart_uploads_request_response.go new file mode 100644 index 0000000000..259e0630ee --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_multipart_uploads_request_response.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListMultipartUploadsRequest wrapper for the ListMultipartUploads operation +type ListMultipartUploadsRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The page at which to start retrieving results. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request ListMultipartUploadsRequest) String() string { + return common.PointerString(request) +} + +// ListMultipartUploadsResponse wrapper for the ListMultipartUploads operation +type ListMultipartUploadsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []MultipartUpload instance + Items []MultipartUpload `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of `MultipartUpload`s. If this header appears in the response, then + // this is a partial list of multipart uploads. Include this value as the `page` parameter in a subsequent + // GET request. For information about pagination, see + // List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListMultipartUploadsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_objects.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_objects.go new file mode 100644 index 0000000000..aa216e61d9 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_objects.go @@ -0,0 +1,33 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// ListObjects To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type ListObjects struct { + + // An array of object summaries. + Objects []ObjectSummary `mandatory:"true" json:"objects"` + + // Prefixes that are common to the results returned by the request if the request specified a delimiter. + Prefixes []string `mandatory:"false" json:"prefixes"` + + // The name of the object to use in the 'startWith' parameter to obtain the next page of + // a truncated ListObjects response. + NextStartWith *string `mandatory:"false" json:"nextStartWith"` +} + +func (m ListObjects) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_objects_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_objects_request_response.go new file mode 100644 index 0000000000..0cca1b1c6a --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_objects_request_response.go @@ -0,0 +1,73 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListObjectsRequest wrapper for the ListObjects operation +type ListObjectsRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The string to use for matching against the start of object names in a list query. + Prefix *string `mandatory:"false" contributesTo:"query" name:"prefix"` + + // Object names returned by a list query must be greater or equal to this parameter. + Start *string `mandatory:"false" contributesTo:"query" name:"start"` + + // Object names returned by a list query must be strictly less than this parameter. + End *string `mandatory:"false" contributesTo:"query" name:"end"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // When this parameter is set, only objects whose names do not contain the delimiter character + // (after an optionally specified prefix) are returned. Scanned objects whose names contain the + // delimiter have part of their name up to the last occurrence of the delimiter (after the optional + // prefix) returned as a set of prefixes. Note that only '/' is a supported delimiter character at + // this time. + Delimiter *string `mandatory:"false" contributesTo:"query" name:"delimiter"` + + // Object summary in list of objects includes the 'name' field. This parameter can also include 'size' + // (object size in bytes), 'md5', and 'timeCreated' (object creation date and time) fields. + // Value of this parameter should be a comma-separated, case-insensitive list of those field names. + // For example 'name,timeCreated,md5'. + Fields *string `mandatory:"false" contributesTo:"query" name:"fields" omitEmpty:"true"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request ListObjectsRequest) String() string { + return common.PointerString(request) +} + +// ListObjectsResponse wrapper for the ListObjects operation +type ListObjectsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The ListObjects instance + ListObjects `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListObjectsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_preauthenticated_requests_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_preauthenticated_requests_request_response.go new file mode 100644 index 0000000000..4adcbe26ae --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/list_preauthenticated_requests_request_response.go @@ -0,0 +1,63 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// ListPreauthenticatedRequestsRequest wrapper for the ListPreauthenticatedRequests operation +type ListPreauthenticatedRequestsRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // Pre-authenticated requests returned by the list must have object names starting with prefix + ObjectNamePrefix *string `mandatory:"false" contributesTo:"query" name:"objectNamePrefix"` + + // The maximum number of items to return. + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The page at which to start retrieving results. + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request ListPreauthenticatedRequestsRequest) String() string { + return common.PointerString(request) +} + +// ListPreauthenticatedRequestsResponse wrapper for the ListPreauthenticatedRequests operation +type ListPreauthenticatedRequestsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The []PreauthenticatedRequestSummary instance + Items []PreauthenticatedRequestSummary `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For pagination of a list of pre-authenticated requests, if this header appears in the response, + // then this is a partial list. Include this value as the `page` parameter in a subsequent + // GET request to get the next batch of pre-authenticated requests. + // For information about pagination, see List Pagination (https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/usingapi.htm#nine). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListPreauthenticatedRequestsResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/multipart_upload.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/multipart_upload.go new file mode 100644 index 0000000000..00cad6055d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/multipart_upload.go @@ -0,0 +1,38 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// MultipartUpload To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type MultipartUpload struct { + + // The namespace in which the in-progress multipart upload is stored. + Namespace *string `mandatory:"true" json:"namespace"` + + // The bucket in which the in-progress multipart upload is stored. + Bucket *string `mandatory:"true" json:"bucket"` + + // The object name of the in-progress multipart upload. + Object *string `mandatory:"true" json:"object"` + + // The unique identifier for the in-progress multipart upload. + UploadId *string `mandatory:"true" json:"uploadId"` + + // The date and time when the upload was created. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` +} + +func (m MultipartUpload) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/multipart_upload_part_summary.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/multipart_upload_part_summary.go new file mode 100644 index 0000000000..05f9aff44e --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/multipart_upload_part_summary.go @@ -0,0 +1,35 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// MultipartUploadPartSummary To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type MultipartUploadPartSummary struct { + + // the current entity tag for the part. + Etag *string `mandatory:"true" json:"etag"` + + // the MD5 hash of the bytes of the part. + Md5 *string `mandatory:"true" json:"md5"` + + // the size of the part in bytes. + Size *int `mandatory:"true" json:"size"` + + // the part number for this part. + PartNumber *int `mandatory:"true" json:"partNumber"` +} + +func (m MultipartUploadPartSummary) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/object_summary.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/object_summary.go new file mode 100644 index 0000000000..c1cf92ba8d --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/object_summary.go @@ -0,0 +1,35 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// ObjectSummary To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type ObjectSummary struct { + + // The name of the object. + Name *string `mandatory:"true" json:"name"` + + // Size of the object in bytes. + Size *int `mandatory:"false" json:"size"` + + // Base64-encoded MD5 hash of the object data. + Md5 *string `mandatory:"false" json:"md5"` + + // Date and time of object creation. + TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` +} + +func (m ObjectSummary) String() string { + return common.PointerString(m) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/objectstorage_client.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/objectstorage_client.go new file mode 100644 index 0000000000..eaf8bdfb63 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/objectstorage_client.go @@ -0,0 +1,478 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +//ObjectStorageClient a client for ObjectStorage +type ObjectStorageClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +func buildSigner(configProvider common.ConfigurationProvider) common.HTTPRequestSigner { + objStorageHeaders := []string{"date", "(request-target)", "host"} + defaultBodyHeaders := []string{"content-length", "content-type", "x-content-sha256"} + shouldHashBody := func(r *http.Request) bool { + return r.Method == http.MethodPost + } + signer := common.RequestSignerWithBodyHashingPredicate(configProvider, objStorageHeaders, defaultBodyHeaders, shouldHashBody) + return signer +} + +// NewObjectStorageClientWithConfigurationProvider Creates a new default ObjectStorage client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewObjectStorageClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client ObjectStorageClient, err error) { + baseClient, err := common.NewClientWithConfig(configProvider) + if err != nil { + return + } + baseClient.Signer = buildSigner(configProvider) + + client = ObjectStorageClient{BaseClient: baseClient} + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *ObjectStorageClient) SetRegion(region string) { + client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "objectstorage", region) +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *ObjectStorageClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.config = &configProvider + client.SetRegion(region) + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *ObjectStorageClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// AbortMultipartUpload Aborts an in-progress multipart upload and deletes all parts that have been uploaded. +func (client ObjectStorageClient) AbortMultipartUpload(ctx context.Context, request AbortMultipartUploadRequest) (response AbortMultipartUploadResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/n/{namespaceName}/b/{bucketName}/u/{objectName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CommitMultipartUpload Commits a multipart upload, which involves checking part numbers and ETags of the parts, to create an aggregate object. +func (client ObjectStorageClient) CommitMultipartUpload(ctx context.Context, request CommitMultipartUploadRequest) (response CommitMultipartUploadResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/n/{namespaceName}/b/{bucketName}/u/{objectName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateBucket Creates a bucket in the given namespace with a bucket name and optional user-defined metadata. +// To use this and other API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +func (client ObjectStorageClient) CreateBucket(ctx context.Context, request CreateBucketRequest) (response CreateBucketResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/n/{namespaceName}/b/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreateMultipartUpload Starts a new multipart upload to a specific object in the given bucket in the given namespace. +func (client ObjectStorageClient) CreateMultipartUpload(ctx context.Context, request CreateMultipartUploadRequest) (response CreateMultipartUploadResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/n/{namespaceName}/b/{bucketName}/u", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// CreatePreauthenticatedRequest Create a pre-authenticated request specific to the bucket +func (client ObjectStorageClient) CreatePreauthenticatedRequest(ctx context.Context, request CreatePreauthenticatedRequestRequest) (response CreatePreauthenticatedRequestResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/n/{namespaceName}/b/{bucketName}/p/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteBucket Deletes a bucket if it is already empty. If the bucket is not empty, use DeleteObject first. +func (client ObjectStorageClient) DeleteBucket(ctx context.Context, request DeleteBucketRequest) (response DeleteBucketResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/n/{namespaceName}/b/{bucketName}/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeleteObject Deletes an object. +func (client ObjectStorageClient) DeleteObject(ctx context.Context, request DeleteObjectRequest) (response DeleteObjectResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/n/{namespaceName}/b/{bucketName}/o/{objectName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// DeletePreauthenticatedRequest Deletes the bucket level pre-authenticateted request +func (client ObjectStorageClient) DeletePreauthenticatedRequest(ctx context.Context, request DeletePreauthenticatedRequestRequest) (response DeletePreauthenticatedRequestResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodDelete, "/n/{namespaceName}/b/{bucketName}/p/{parId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetBucket Gets the current representation of the given bucket in the given namespace. +func (client ObjectStorageClient) GetBucket(ctx context.Context, request GetBucketRequest) (response GetBucketResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/n/{namespaceName}/b/{bucketName}/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetNamespace Gets the name of the namespace for the user making the request. An account name must be unique, must start with a +// letter, and can have up to 15 lowercase letters and numbers. You cannot use spaces or special characters. +func (client ObjectStorageClient) GetNamespace(ctx context.Context, request GetNamespaceRequest) (response GetNamespaceResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/n/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetObject Gets the metadata and body of an object. +func (client ObjectStorageClient) GetObject(ctx context.Context, request GetObjectRequest) (response GetObjectResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/n/{namespaceName}/b/{bucketName}/o/{objectName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// GetPreauthenticatedRequest Get the bucket level pre-authenticateted request +func (client ObjectStorageClient) GetPreauthenticatedRequest(ctx context.Context, request GetPreauthenticatedRequestRequest) (response GetPreauthenticatedRequestResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/n/{namespaceName}/b/{bucketName}/p/{parId}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// HeadBucket Efficiently checks if a bucket exists and gets the current ETag for the bucket. +func (client ObjectStorageClient) HeadBucket(ctx context.Context, request HeadBucketRequest) (response HeadBucketResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodHead, "/n/{namespaceName}/b/{bucketName}/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// HeadObject Gets the user-defined metadata and entity tag for an object. +func (client ObjectStorageClient) HeadObject(ctx context.Context, request HeadObjectRequest) (response HeadObjectResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodHead, "/n/{namespaceName}/b/{bucketName}/o/{objectName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListBuckets Gets a list of all `BucketSummary`s in a compartment. A `BucketSummary` contains only summary fields for the bucket +// and does not contain fields like the user-defined metadata. +// To use this and other API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +func (client ObjectStorageClient) ListBuckets(ctx context.Context, request ListBucketsRequest) (response ListBucketsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/n/{namespaceName}/b/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListMultipartUploadParts Lists the parts of an in-progress multipart upload. +func (client ObjectStorageClient) ListMultipartUploadParts(ctx context.Context, request ListMultipartUploadPartsRequest) (response ListMultipartUploadPartsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/n/{namespaceName}/b/{bucketName}/u/{objectName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListMultipartUploads Lists all in-progress multipart uploads for the given bucket in the given namespace. +func (client ObjectStorageClient) ListMultipartUploads(ctx context.Context, request ListMultipartUploadsRequest) (response ListMultipartUploadsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/n/{namespaceName}/b/{bucketName}/u", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListObjects Lists the objects in a bucket. +// To use this and other API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +func (client ObjectStorageClient) ListObjects(ctx context.Context, request ListObjectsRequest) (response ListObjectsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/n/{namespaceName}/b/{bucketName}/o", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// ListPreauthenticatedRequests List pre-authenticated requests for the bucket +func (client ObjectStorageClient) ListPreauthenticatedRequests(ctx context.Context, request ListPreauthenticatedRequestsRequest) (response ListPreauthenticatedRequestsResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, "/n/{namespaceName}/b/{bucketName}/p/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// PutObject Creates a new object or overwrites an existing one. +// To use this and other API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +func (client ObjectStorageClient) PutObject(ctx context.Context, request PutObjectRequest) (response PutObjectResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/n/{namespaceName}/b/{bucketName}/o/{objectName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UpdateBucket Performs a partial or full update of a bucket's user-defined metadata. +func (client ObjectStorageClient) UpdateBucket(ctx context.Context, request UpdateBucketRequest) (response UpdateBucketResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost, "/n/{namespaceName}/b/{bucketName}/", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} + +// UploadPart Uploads a single part of a multipart upload. +func (client ObjectStorageClient) UploadPart(ctx context.Context, request UploadPartRequest) (response UploadPartResponse, err error) { + httpRequest, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPut, "/n/{namespaceName}/b/{bucketName}/u/{objectName}", request) + if err != nil { + return + } + + httpResponse, err := client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + return + } + + err = common.UnmarshalResponse(httpResponse, &response) + return +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/preauthenticated_request.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/preauthenticated_request.go new file mode 100644 index 0000000000..54e4d2430f --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/preauthenticated_request.go @@ -0,0 +1,71 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// PreauthenticatedRequest The representation of PreauthenticatedRequest +type PreauthenticatedRequest struct { + + // the unique identifier to use when directly addressing the pre-authenticated request + Id *string `mandatory:"true" json:"id"` + + // the user supplied name of the pre-authenticated request. + Name *string `mandatory:"true" json:"name"` + + // the uri to embed in the url when using the pre-authenticated request. + AccessUri *string `mandatory:"true" json:"accessUri"` + + // the operation that can be performed on this resource e.g PUT or GET. + AccessType PreauthenticatedRequestAccessTypeEnum `mandatory:"true" json:"accessType"` + + // the expiration date after which the pre authenticated request will no longer be valid as per spec + // RFC 3339 (https://tools.ietf.org/rfc/rfc3339) + TimeExpires *common.SDKTime `mandatory:"true" json:"timeExpires"` + + // the date when the pre-authenticated request was created as per spec + // RFC 3339 (https://tools.ietf.org/rfc/rfc3339) + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // Name of object that is being granted access to by the pre-authenticated request. This can be null and that would mean that the pre-authenticated request is granting access to the entire bucket + ObjectName *string `mandatory:"false" json:"objectName"` +} + +func (m PreauthenticatedRequest) String() string { + return common.PointerString(m) +} + +// PreauthenticatedRequestAccessTypeEnum Enum with underlying type: string +type PreauthenticatedRequestAccessTypeEnum string + +// Set of constants representing the allowable values for PreauthenticatedRequestAccessType +const ( + PreauthenticatedRequestAccessTypeObjectread PreauthenticatedRequestAccessTypeEnum = "ObjectRead" + PreauthenticatedRequestAccessTypeObjectwrite PreauthenticatedRequestAccessTypeEnum = "ObjectWrite" + PreauthenticatedRequestAccessTypeObjectreadwrite PreauthenticatedRequestAccessTypeEnum = "ObjectReadWrite" + PreauthenticatedRequestAccessTypeAnyobjectwrite PreauthenticatedRequestAccessTypeEnum = "AnyObjectWrite" +) + +var mappingPreauthenticatedRequestAccessType = map[string]PreauthenticatedRequestAccessTypeEnum{ + "ObjectRead": PreauthenticatedRequestAccessTypeObjectread, + "ObjectWrite": PreauthenticatedRequestAccessTypeObjectwrite, + "ObjectReadWrite": PreauthenticatedRequestAccessTypeObjectreadwrite, + "AnyObjectWrite": PreauthenticatedRequestAccessTypeAnyobjectwrite, +} + +// GetPreauthenticatedRequestAccessTypeEnumValues Enumerates the set of values for PreauthenticatedRequestAccessType +func GetPreauthenticatedRequestAccessTypeEnumValues() []PreauthenticatedRequestAccessTypeEnum { + values := make([]PreauthenticatedRequestAccessTypeEnum, 0) + for _, v := range mappingPreauthenticatedRequestAccessType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/preauthenticated_request_summary.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/preauthenticated_request_summary.go new file mode 100644 index 0000000000..f293237bc0 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/preauthenticated_request_summary.go @@ -0,0 +1,68 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// PreauthenticatedRequestSummary The representation of PreauthenticatedRequestSummary +type PreauthenticatedRequestSummary struct { + + // the unique identifier to use when directly addressing the pre-authenticated request + Id *string `mandatory:"true" json:"id"` + + // the user supplied name of the pre-authenticated request + Name *string `mandatory:"true" json:"name"` + + // the operation that can be performed on this resource e.g PUT or GET. + AccessType PreauthenticatedRequestSummaryAccessTypeEnum `mandatory:"true" json:"accessType"` + + // the expiration date after which the pre authenticated request will no longer be valid as per spec + // RFC 3339 (https://tools.ietf.org/rfc/rfc3339) + TimeExpires *common.SDKTime `mandatory:"true" json:"timeExpires"` + + // the date when the pre-authenticated request was created as per spec + // RFC 3339 (https://tools.ietf.org/rfc/rfc3339) + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // Name of object that is being granted access to by the pre-authenticated request. This can be null and that would mean that the pre-authenticated request is granting access to the entire bucket + ObjectName *string `mandatory:"false" json:"objectName"` +} + +func (m PreauthenticatedRequestSummary) String() string { + return common.PointerString(m) +} + +// PreauthenticatedRequestSummaryAccessTypeEnum Enum with underlying type: string +type PreauthenticatedRequestSummaryAccessTypeEnum string + +// Set of constants representing the allowable values for PreauthenticatedRequestSummaryAccessType +const ( + PreauthenticatedRequestSummaryAccessTypeObjectread PreauthenticatedRequestSummaryAccessTypeEnum = "ObjectRead" + PreauthenticatedRequestSummaryAccessTypeObjectwrite PreauthenticatedRequestSummaryAccessTypeEnum = "ObjectWrite" + PreauthenticatedRequestSummaryAccessTypeObjectreadwrite PreauthenticatedRequestSummaryAccessTypeEnum = "ObjectReadWrite" + PreauthenticatedRequestSummaryAccessTypeAnyobjectwrite PreauthenticatedRequestSummaryAccessTypeEnum = "AnyObjectWrite" +) + +var mappingPreauthenticatedRequestSummaryAccessType = map[string]PreauthenticatedRequestSummaryAccessTypeEnum{ + "ObjectRead": PreauthenticatedRequestSummaryAccessTypeObjectread, + "ObjectWrite": PreauthenticatedRequestSummaryAccessTypeObjectwrite, + "ObjectReadWrite": PreauthenticatedRequestSummaryAccessTypeObjectreadwrite, + "AnyObjectWrite": PreauthenticatedRequestSummaryAccessTypeAnyobjectwrite, +} + +// GetPreauthenticatedRequestSummaryAccessTypeEnumValues Enumerates the set of values for PreauthenticatedRequestSummaryAccessType +func GetPreauthenticatedRequestSummaryAccessTypeEnumValues() []PreauthenticatedRequestSummaryAccessTypeEnum { + values := make([]PreauthenticatedRequestSummaryAccessTypeEnum, 0) + for _, v := range mappingPreauthenticatedRequestSummaryAccessType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/put_object_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/put_object_request_response.go new file mode 100644 index 0000000000..3652da5fc7 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/put_object_request_response.go @@ -0,0 +1,92 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "io" + "net/http" +) + +// PutObjectRequest wrapper for the PutObject operation +type PutObjectRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The name of the object. + // Example: `test/object1.log` + ObjectName *string `mandatory:"true" contributesTo:"path" name:"objectName"` + + // The content length of the body. + ContentLength *int `mandatory:"true" contributesTo:"header" name:"Content-Length"` + + // The object to upload to the object store. + PutObjectBody io.ReadCloser `mandatory:"true" contributesTo:"body" encoding:"binary"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The entity tag to avoid matching. The only valid value is ‘*’, which indicates that the request should fail if the object already exists. + // For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag + // of the target part. + IfNoneMatch *string `mandatory:"false" contributesTo:"header" name:"if-none-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` + + // 100-continue + Expect *string `mandatory:"false" contributesTo:"header" name:"Expect"` + + // The base-64 encoded MD5 hash of the body. + ContentMD5 *string `mandatory:"false" contributesTo:"header" name:"Content-MD5"` + + // The content type of the object. Defaults to 'application/octet-stream' if not overridden during the PutObject call. + ContentType *string `mandatory:"false" contributesTo:"header" name:"Content-Type"` + + // The content language of the object. + ContentLanguage *string `mandatory:"false" contributesTo:"header" name:"Content-Language"` + + // The content encoding of the object. + ContentEncoding *string `mandatory:"false" contributesTo:"header" name:"Content-Encoding"` + + // Optional user-defined metadata key and value. + OpcMeta map[string]string `mandatory:"false" contributesTo:"header-collection" prefix:"opc-meta-"` +} + +func (request PutObjectRequest) String() string { + return common.PointerString(request) +} + +// PutObjectResponse wrapper for the PutObject operation +type PutObjectResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The base-64 encoded MD5 hash of the request body as computed by the server. + OpcContentMd5 *string `presentIn:"header" name:"opc-content-md5"` + + // The entity tag for the object. + ETag *string `presentIn:"header" name:"etag"` + + // The time the object was modified, as described in RFC 2616 (https://tools.ietf.org/rfc/rfc2616), section 14.29. + LastModified *common.SDKTime `presentIn:"header" name:"last-modified"` +} + +func (response PutObjectResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/update_bucket_details.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/update_bucket_details.go new file mode 100644 index 0000000000..a3cf083a5b --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/update_bucket_details.go @@ -0,0 +1,61 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +// Object Storage Service API +// +// APIs for managing buckets and objects. +// + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" +) + +// UpdateBucketDetails To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, +// talk to an administrator. If you're an administrator who needs to write policies to give users access, see +// Getting Started with Policies (https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). +type UpdateBucketDetails struct { + + // The namespace in which the bucket lives. + Namespace *string `mandatory:"false" json:"namespace"` + + // The name of the bucket. + Name *string `mandatory:"false" json:"name"` + + // Arbitrary string, up to 4KB, of keys and values for user-defined metadata. + Metadata map[string]string `mandatory:"false" json:"metadata"` + + // The type of public access available on this bucket. Allows authenticated caller to access the bucket or + // contents of this bucket. By default a bucket is set to NoPublicAccess. It is treated as NoPublicAccess + // when this value is not specified. When the type is NoPublicAccess the bucket does not allow any public access. + // When the type is ObjectRead the bucket allows public access to the GetObject, HeadObject, ListObjects. + PublicAccessType UpdateBucketDetailsPublicAccessTypeEnum `mandatory:"false" json:"publicAccessType,omitempty"` +} + +func (m UpdateBucketDetails) String() string { + return common.PointerString(m) +} + +// UpdateBucketDetailsPublicAccessTypeEnum Enum with underlying type: string +type UpdateBucketDetailsPublicAccessTypeEnum string + +// Set of constants representing the allowable values for UpdateBucketDetailsPublicAccessType +const ( + UpdateBucketDetailsPublicAccessTypeNopublicaccess UpdateBucketDetailsPublicAccessTypeEnum = "NoPublicAccess" + UpdateBucketDetailsPublicAccessTypeObjectread UpdateBucketDetailsPublicAccessTypeEnum = "ObjectRead" +) + +var mappingUpdateBucketDetailsPublicAccessType = map[string]UpdateBucketDetailsPublicAccessTypeEnum{ + "NoPublicAccess": UpdateBucketDetailsPublicAccessTypeNopublicaccess, + "ObjectRead": UpdateBucketDetailsPublicAccessTypeObjectread, +} + +// GetUpdateBucketDetailsPublicAccessTypeEnumValues Enumerates the set of values for UpdateBucketDetailsPublicAccessType +func GetUpdateBucketDetailsPublicAccessTypeEnumValues() []UpdateBucketDetailsPublicAccessTypeEnum { + values := make([]UpdateBucketDetailsPublicAccessTypeEnum, 0) + for _, v := range mappingUpdateBucketDetailsPublicAccessType { + values = append(values, v) + } + return values +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/update_bucket_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/update_bucket_request_response.go new file mode 100644 index 0000000000..a352d64fed --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/update_bucket_request_response.go @@ -0,0 +1,58 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "net/http" +) + +// UpdateBucketRequest wrapper for the UpdateBucket operation +type UpdateBucketRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // Request object for updating a bucket. + UpdateBucketDetails `contributesTo:"body"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` +} + +func (request UpdateBucketRequest) String() string { + return common.PointerString(request) +} + +// UpdateBucketResponse wrapper for the UpdateBucket operation +type UpdateBucketResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Bucket instance + Bucket `presentIn:"body"` + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The entity tag for the updated bucket. + ETag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateBucketResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/objectstorage/upload_part_request_response.go b/vendor/github.com/oracle/oci-go-sdk/objectstorage/upload_part_request_response.go new file mode 100644 index 0000000000..9a48fa05ca --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/objectstorage/upload_part_request_response.go @@ -0,0 +1,83 @@ +// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Code generated. DO NOT EDIT. + +package objectstorage + +import ( + "github.com/oracle/oci-go-sdk/common" + "io" + "net/http" +) + +// UploadPartRequest wrapper for the UploadPart operation +type UploadPartRequest struct { + + // The top-level namespace used for the request. + NamespaceName *string `mandatory:"true" contributesTo:"path" name:"namespaceName"` + + // The name of the bucket. + // Example: `my-new-bucket1` + BucketName *string `mandatory:"true" contributesTo:"path" name:"bucketName"` + + // The name of the object. + // Example: `test/object1.log` + ObjectName *string `mandatory:"true" contributesTo:"path" name:"objectName"` + + // The upload ID for a multipart upload. + UploadId *string `mandatory:"true" contributesTo:"query" name:"uploadId"` + + // The part number that identifies the object part currently being uploaded. + UploadPartNum *int `mandatory:"true" contributesTo:"query" name:"uploadPartNum"` + + // The content length of the body. + ContentLength *int `mandatory:"true" contributesTo:"header" name:"Content-Length"` + + // The part being uploaded to the Object Storage Service. + UploadPartBody io.ReadCloser `mandatory:"true" contributesTo:"body" encoding:"binary"` + + // The client request ID for tracing. + OpcClientRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-client-request-id"` + + // The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object. + // For uploading a part, this is the entity tag of the target part. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // The entity tag to avoid matching. The only valid value is ‘*’, which indicates that the request should fail if the object already exists. + // For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag + // of the target part. + IfNoneMatch *string `mandatory:"false" contributesTo:"header" name:"if-none-match"` + + // 100-continue + Expect *string `mandatory:"false" contributesTo:"header" name:"Expect"` + + // The base-64 encoded MD5 hash of the body. + ContentMD5 *string `mandatory:"false" contributesTo:"header" name:"Content-MD5"` +} + +func (request UploadPartRequest) String() string { + return common.PointerString(request) +} + +// UploadPartResponse wrapper for the UploadPart operation +type UploadPartResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Echoes back the value passed in the opc-client-request-id header, for use by clients when debugging. + OpcClientRequestId *string `presentIn:"header" name:"opc-client-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + // request, please provide this request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // The base64-encoded MD5 hash of the request body, as computed by the server. + OpcContentMd5 *string `presentIn:"header" name:"opc-content-md5"` + + // The entity tag for the object. + ETag *string `presentIn:"header" name:"etag"` +} + +func (response UploadPartResponse) String() string { + return common.PointerString(response) +} diff --git a/vendor/github.com/oracle/oci-go-sdk/oci.go b/vendor/github.com/oracle/oci-go-sdk/oci.go new file mode 100644 index 0000000000..47fcef9c67 --- /dev/null +++ b/vendor/github.com/oracle/oci-go-sdk/oci.go @@ -0,0 +1,232 @@ + +/* +This is the official Go SDK for Oracle Cloud Infrastructure + +Installation + +Refer to https://github.com/oracle/oci-go-sdk/blob/master/README.md#installing for installation instructions. + +Configuration + +Refer to https://github.com/oracle/oci-go-sdk/blob/master/README.md#configuring for configuration instructions. + +Quickstart + +The following example shows how to get started with the SDK. The example belows creates an identityClient +struct with the default configuration. It then utilizes the identityClient to list availability domains and prints +them out to stdout + + import ( + "context" + "fmt" + + "github.com/oracle/oci-go-sdk/common" + "github.com/oracle/oci-go-sdk/identity" + ) + + func main() { + c, err := identity.NewIdentityClientWithConfigurationProvider(common.DefaultConfigProvider()) + if err != nil { + fmt.Println("Error:", err) + return + } + + // The OCID of the tenancy containing the compartment. + tenancyID, err := common.DefaultConfigProvider().TenancyOCID() + if err != nil { + fmt.Println("Error:", err) + return + } + + request := identity.ListAvailabilityDomainsRequest{ + CompartmentId: &tenancyID, + } + + r, err := c.ListAvailabilityDomains(context.Background(), request) + if err != nil { + fmt.Println("Error:", err) + return + } + + fmt.Printf("List of available domains: %v", r.Items) + return + } + +More examples can be found in the SDK Github repo: https://github.com/oracle/oci-go-sdk/tree/master/example + +Optional fields in the SDK + +Optional fields are represented with the `mandatory:"false"` tag on input structs. The SDK will omit all optional fields that are nil when making requests. +In the case of enum-type fields, the SDK will omit fields whose value is an empty string. + +Helper functions + +The SDK uses pointers for primitive types in many input structs. To aid in the construction of such structs, the SDK provides +functions that return a pointer for a given value. For example: + + // Given the struct + type CreateVcnDetails struct { + + // Example: `172.16.0.0/16` + CidrBlock *string `mandatory:"true" json:"cidrBlock"` + + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + DisplayName *string `mandatory:"false" json:"displayName"` + + } + + // We can use the helper functions to build the struct + details := core.CreateVcnDetails{ + CidrBlock: common.String("172.16.0.0/16"), + CompartmentId: common.String("someOcid"), + DisplayName: common.String("myVcn"), + } + + +Signing custom requests + +The SDK exposes a stand-alone signer that can be used to signing custom requests. Related code can be found here: +https://github.com/oracle/oci-go-sdk/blob/master/common/http_signer.go. + +The example below shows how to create a default signer. + + client := http.Client{} + var request http.Request + request = ... // some custom request + + // Set the Date header + request.Header.Set("Date", time.Now().UTC().Format(http.TimeFormat)) + + // And a provider of cryptographic keys + provider := common.DefaultConfigProvider() + + // Build the signer + signer := common.DefaultSigner(provider) + + // Sign the request + signer.Sign(&request) + + // Execute the request + client.Do(request) + + + +The signer also allows more granular control on the headers used for signing. For example: + + client := http.Client{} + var request http.Request + request = ... // some custom request + + // Set the Date header + request.Header.Set("Date", time.Now().UTC().Format(http.TimeFormat)) + + // Mandatory headers to be used in the sign process + defaultGenericHeaders = []string{"date", "(request-target)", "host"} + + // Optional headers + optionalHeaders = []string{"content-length", "content-type", "x-content-sha256"} + + // A predicate that specifies when to use the optional signing headers + optionalHeadersPredicate := func (r *http.Request) bool { + return r.Method == http.MethodPost + } + + // And a provider of cryptographic keys + provider := common.DefaultConfigProvider() + + // Build the signer + signer := common.RequestSigner(provider, defaultGenericHeaders, optionalHeaders, optionalHeadersPredicate) + + // Sign the request + signer.Sign(&request) + + // Execute the request + c.Do(request) + +For more information on the signing algorithm refer to: https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/signingrequests.htm + +Polymorphic json requests and responses + +Some operations accept or return polymorphic json objects. The SDK models such objects as interfaces. Further the SDK provides +structs that implement such interfaces. Thus, for all operations that expect interfaces as input, pass the struct in the SDK that satisfies +such interface. For example: + + c, err := identity.NewIdentityClientWithConfigurationProvider(common.DefaultConfigProvider()) + if err != nil { + panic(err) + } + + // The CreateIdentityProviderRequest takes a CreateIdentityProviderDetails interface as input + rCreate := identity.CreateIdentityProviderRequest{} + + // The CreateSaml2IdentityProviderDetails struct implements the CreateIdentityProviderDetails interface + details := identity.CreateSaml2IdentityProviderDetails{} + details.CompartmentId = common.String(getTenancyID()) + details.Name = common.String("someName") + //... more setup if needed + // Use the above struct + rCreate.CreateIdentityProviderDetails = details + + // Make the call + rspCreate, createErr := c.CreateIdentityProvider(context.Background(), rCreate) + +In the case of a polymorphic response you can type assert the interface to the expected type. For example: + + rRead := identity.GetIdentityProviderRequest{} + rRead.IdentityProviderId = common.String("aValidId") + response, err := c.GetIdentityProvider(context.Background(), rRead) + + provider := response.IdentityProvider.(identity.Saml2IdentityProvider) + +An example of polymorphic json request handling can be found here: https://github.com/oracle/oci-go-sdk/blob/master/example/example_core_test.go#L63 + + +Pagination + +When calling a list operation, the operation will retrieve a page of results. To retrieve more data, call the list operation again, +passing in the value of the most recent response's OpcNextPage as the value of Page in the next list operation call. +When there is no more data the OpcNextPage field will be nil. An example of pagination using this logic can be found here: https://github.com/oracle/oci-go-sdk/blob/master/example/example_core_test.go#L86 + +Logging and Debugging + +The SDK has a built-in logging mechanism used internally. The internal logging logic is used to record the raw http +requests, responses and potential errors when (un)marshalling request and responses. + +To expose debugging logs, set the environment variable "OCI_GO_SDK_DEBUG" to "1", or some other non empty string. + + +Forward Compatibility + +Some response fields are enum-typed. In the future, individual services may return values not covered by existing enums +for that field. To address this possibility, every enum-type response field is a modeled as a type that supports any string. +Thus if a service returns a value that is not recognized by your version of the SDK, then the response field will be set to this value. + +When individual services return a polymorphic json response not available as a concrete struct, the SDK will return an implementation that only satisfies +the interface modeling the polymorphic json response. + + +Contributions + +Got a fix for a bug, or a new feature you'd like to contribute? The SDK is open source and accepting pull requests on GitHub +https://github.com/oracle/oci-go-sdk + +License + +Licensing information available at: https://github.com/oracle/oci-go-sdk/blob/master/LICENSE.txt + +Notifications + +To be notified when a new version of the Go SDK is released, subscribe to the following feed: https://github.com/oracle/oci-go-sdk/releases.atom + +Questions or Feedback + +Please refer to this link: https://github.com/oracle/oci-go-sdk#help + + + + + */ +package oci + +//go:generate go run cmd/genver/main.go cmd/genver/version_template.go --output common/version.go diff --git a/vendor/github.com/pkg/errors/LICENSE b/vendor/github.com/pkg/errors/LICENSE new file mode 100644 index 0000000000..835ba3e755 --- /dev/null +++ b/vendor/github.com/pkg/errors/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2015, Dave Cheney +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pkg/errors/bench_test.go b/vendor/github.com/pkg/errors/bench_test.go new file mode 100644 index 0000000000..0416a3cbb8 --- /dev/null +++ b/vendor/github.com/pkg/errors/bench_test.go @@ -0,0 +1,59 @@ +// +build go1.7 + +package errors + +import ( + "fmt" + "testing" + + stderrors "errors" +) + +func noErrors(at, depth int) error { + if at >= depth { + return stderrors.New("no error") + } + return noErrors(at+1, depth) +} +func yesErrors(at, depth int) error { + if at >= depth { + return New("ye error") + } + return yesErrors(at+1, depth) +} + +func BenchmarkErrors(b *testing.B) { + var toperr error + type run struct { + stack int + std bool + } + runs := []run{ + {10, false}, + {10, true}, + {100, false}, + {100, true}, + {1000, false}, + {1000, true}, + } + for _, r := range runs { + part := "pkg/errors" + if r.std { + part = "errors" + } + name := fmt.Sprintf("%s-stack-%d", part, r.stack) + b.Run(name, func(b *testing.B) { + var err error + f := yesErrors + if r.std { + f = noErrors + } + b.ReportAllocs() + for i := 0; i < b.N; i++ { + err = f(0, r.stack) + } + b.StopTimer() + toperr = err + }) + } +} diff --git a/vendor/github.com/pkg/errors/errors.go b/vendor/github.com/pkg/errors/errors.go new file mode 100644 index 0000000000..842ee80456 --- /dev/null +++ b/vendor/github.com/pkg/errors/errors.go @@ -0,0 +1,269 @@ +// Package errors provides simple error handling primitives. +// +// The traditional error handling idiom in Go is roughly akin to +// +// if err != nil { +// return err +// } +// +// which applied recursively up the call stack results in error reports +// without context or debugging information. The errors package allows +// programmers to add context to the failure path in their code in a way +// that does not destroy the original value of the error. +// +// Adding context to an error +// +// The errors.Wrap function returns a new error that adds context to the +// original error by recording a stack trace at the point Wrap is called, +// and the supplied message. For example +// +// _, err := ioutil.ReadAll(r) +// if err != nil { +// return errors.Wrap(err, "read failed") +// } +// +// If additional control is required the errors.WithStack and errors.WithMessage +// functions destructure errors.Wrap into its component operations of annotating +// an error with a stack trace and an a message, respectively. +// +// Retrieving the cause of an error +// +// Using errors.Wrap constructs a stack of errors, adding context to the +// preceding error. Depending on the nature of the error it may be necessary +// to reverse the operation of errors.Wrap to retrieve the original error +// for inspection. Any error value which implements this interface +// +// type causer interface { +// Cause() error +// } +// +// can be inspected by errors.Cause. errors.Cause will recursively retrieve +// the topmost error which does not implement causer, which is assumed to be +// the original cause. For example: +// +// switch err := errors.Cause(err).(type) { +// case *MyError: +// // handle specifically +// default: +// // unknown error +// } +// +// causer interface is not exported by this package, but is considered a part +// of stable public API. +// +// Formatted printing of errors +// +// All error values returned from this package implement fmt.Formatter and can +// be formatted by the fmt package. The following verbs are supported +// +// %s print the error. If the error has a Cause it will be +// printed recursively +// %v see %s +// %+v extended format. Each Frame of the error's StackTrace will +// be printed in detail. +// +// Retrieving the stack trace of an error or wrapper +// +// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are +// invoked. This information can be retrieved with the following interface. +// +// type stackTracer interface { +// StackTrace() errors.StackTrace +// } +// +// Where errors.StackTrace is defined as +// +// type StackTrace []Frame +// +// The Frame type represents a call site in the stack trace. Frame supports +// the fmt.Formatter interface that can be used for printing information about +// the stack trace of this error. For example: +// +// if err, ok := err.(stackTracer); ok { +// for _, f := range err.StackTrace() { +// fmt.Printf("%+s:%d", f) +// } +// } +// +// stackTracer interface is not exported by this package, but is considered a part +// of stable public API. +// +// See the documentation for Frame.Format for more details. +package errors + +import ( + "fmt" + "io" +) + +// New returns an error with the supplied message. +// New also records the stack trace at the point it was called. +func New(message string) error { + return &fundamental{ + msg: message, + stack: callers(), + } +} + +// Errorf formats according to a format specifier and returns the string +// as a value that satisfies error. +// Errorf also records the stack trace at the point it was called. +func Errorf(format string, args ...interface{}) error { + return &fundamental{ + msg: fmt.Sprintf(format, args...), + stack: callers(), + } +} + +// fundamental is an error that has a message and a stack, but no caller. +type fundamental struct { + msg string + *stack +} + +func (f *fundamental) Error() string { return f.msg } + +func (f *fundamental) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + io.WriteString(s, f.msg) + f.stack.Format(s, verb) + return + } + fallthrough + case 's': + io.WriteString(s, f.msg) + case 'q': + fmt.Fprintf(s, "%q", f.msg) + } +} + +// WithStack annotates err with a stack trace at the point WithStack was called. +// If err is nil, WithStack returns nil. +func WithStack(err error) error { + if err == nil { + return nil + } + return &withStack{ + err, + callers(), + } +} + +type withStack struct { + error + *stack +} + +func (w *withStack) Cause() error { return w.error } + +func (w *withStack) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + fmt.Fprintf(s, "%+v", w.Cause()) + w.stack.Format(s, verb) + return + } + fallthrough + case 's': + io.WriteString(s, w.Error()) + case 'q': + fmt.Fprintf(s, "%q", w.Error()) + } +} + +// Wrap returns an error annotating err with a stack trace +// at the point Wrap is called, and the supplied message. +// If err is nil, Wrap returns nil. +func Wrap(err error, message string) error { + if err == nil { + return nil + } + err = &withMessage{ + cause: err, + msg: message, + } + return &withStack{ + err, + callers(), + } +} + +// Wrapf returns an error annotating err with a stack trace +// at the point Wrapf is call, and the format specifier. +// If err is nil, Wrapf returns nil. +func Wrapf(err error, format string, args ...interface{}) error { + if err == nil { + return nil + } + err = &withMessage{ + cause: err, + msg: fmt.Sprintf(format, args...), + } + return &withStack{ + err, + callers(), + } +} + +// WithMessage annotates err with a new message. +// If err is nil, WithMessage returns nil. +func WithMessage(err error, message string) error { + if err == nil { + return nil + } + return &withMessage{ + cause: err, + msg: message, + } +} + +type withMessage struct { + cause error + msg string +} + +func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } +func (w *withMessage) Cause() error { return w.cause } + +func (w *withMessage) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + if s.Flag('+') { + fmt.Fprintf(s, "%+v\n", w.Cause()) + io.WriteString(s, w.msg) + return + } + fallthrough + case 's', 'q': + io.WriteString(s, w.Error()) + } +} + +// Cause returns the underlying cause of the error, if possible. +// An error value has a cause if it implements the following +// interface: +// +// type causer interface { +// Cause() error +// } +// +// If the error does not implement Cause, the original error will +// be returned. If the error is nil, nil will be returned without further +// investigation. +func Cause(err error) error { + type causer interface { + Cause() error + } + + for err != nil { + cause, ok := err.(causer) + if !ok { + break + } + err = cause.Cause() + } + return err +} diff --git a/vendor/github.com/pkg/errors/errors_test.go b/vendor/github.com/pkg/errors/errors_test.go new file mode 100644 index 0000000000..1d8c635586 --- /dev/null +++ b/vendor/github.com/pkg/errors/errors_test.go @@ -0,0 +1,226 @@ +package errors + +import ( + "errors" + "fmt" + "io" + "reflect" + "testing" +) + +func TestNew(t *testing.T) { + tests := []struct { + err string + want error + }{ + {"", fmt.Errorf("")}, + {"foo", fmt.Errorf("foo")}, + {"foo", New("foo")}, + {"string with format specifiers: %v", errors.New("string with format specifiers: %v")}, + } + + for _, tt := range tests { + got := New(tt.err) + if got.Error() != tt.want.Error() { + t.Errorf("New.Error(): got: %q, want %q", got, tt.want) + } + } +} + +func TestWrapNil(t *testing.T) { + got := Wrap(nil, "no error") + if got != nil { + t.Errorf("Wrap(nil, \"no error\"): got %#v, expected nil", got) + } +} + +func TestWrap(t *testing.T) { + tests := []struct { + err error + message string + want string + }{ + {io.EOF, "read error", "read error: EOF"}, + {Wrap(io.EOF, "read error"), "client error", "client error: read error: EOF"}, + } + + for _, tt := range tests { + got := Wrap(tt.err, tt.message).Error() + if got != tt.want { + t.Errorf("Wrap(%v, %q): got: %v, want %v", tt.err, tt.message, got, tt.want) + } + } +} + +type nilError struct{} + +func (nilError) Error() string { return "nil error" } + +func TestCause(t *testing.T) { + x := New("error") + tests := []struct { + err error + want error + }{{ + // nil error is nil + err: nil, + want: nil, + }, { + // explicit nil error is nil + err: (error)(nil), + want: nil, + }, { + // typed nil is nil + err: (*nilError)(nil), + want: (*nilError)(nil), + }, { + // uncaused error is unaffected + err: io.EOF, + want: io.EOF, + }, { + // caused error returns cause + err: Wrap(io.EOF, "ignored"), + want: io.EOF, + }, { + err: x, // return from errors.New + want: x, + }, { + WithMessage(nil, "whoops"), + nil, + }, { + WithMessage(io.EOF, "whoops"), + io.EOF, + }, { + WithStack(nil), + nil, + }, { + WithStack(io.EOF), + io.EOF, + }} + + for i, tt := range tests { + got := Cause(tt.err) + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("test %d: got %#v, want %#v", i+1, got, tt.want) + } + } +} + +func TestWrapfNil(t *testing.T) { + got := Wrapf(nil, "no error") + if got != nil { + t.Errorf("Wrapf(nil, \"no error\"): got %#v, expected nil", got) + } +} + +func TestWrapf(t *testing.T) { + tests := []struct { + err error + message string + want string + }{ + {io.EOF, "read error", "read error: EOF"}, + {Wrapf(io.EOF, "read error without format specifiers"), "client error", "client error: read error without format specifiers: EOF"}, + {Wrapf(io.EOF, "read error with %d format specifier", 1), "client error", "client error: read error with 1 format specifier: EOF"}, + } + + for _, tt := range tests { + got := Wrapf(tt.err, tt.message).Error() + if got != tt.want { + t.Errorf("Wrapf(%v, %q): got: %v, want %v", tt.err, tt.message, got, tt.want) + } + } +} + +func TestErrorf(t *testing.T) { + tests := []struct { + err error + want string + }{ + {Errorf("read error without format specifiers"), "read error without format specifiers"}, + {Errorf("read error with %d format specifier", 1), "read error with 1 format specifier"}, + } + + for _, tt := range tests { + got := tt.err.Error() + if got != tt.want { + t.Errorf("Errorf(%v): got: %q, want %q", tt.err, got, tt.want) + } + } +} + +func TestWithStackNil(t *testing.T) { + got := WithStack(nil) + if got != nil { + t.Errorf("WithStack(nil): got %#v, expected nil", got) + } +} + +func TestWithStack(t *testing.T) { + tests := []struct { + err error + want string + }{ + {io.EOF, "EOF"}, + {WithStack(io.EOF), "EOF"}, + } + + for _, tt := range tests { + got := WithStack(tt.err).Error() + if got != tt.want { + t.Errorf("WithStack(%v): got: %v, want %v", tt.err, got, tt.want) + } + } +} + +func TestWithMessageNil(t *testing.T) { + got := WithMessage(nil, "no error") + if got != nil { + t.Errorf("WithMessage(nil, \"no error\"): got %#v, expected nil", got) + } +} + +func TestWithMessage(t *testing.T) { + tests := []struct { + err error + message string + want string + }{ + {io.EOF, "read error", "read error: EOF"}, + {WithMessage(io.EOF, "read error"), "client error", "client error: read error: EOF"}, + } + + for _, tt := range tests { + got := WithMessage(tt.err, tt.message).Error() + if got != tt.want { + t.Errorf("WithMessage(%v, %q): got: %q, want %q", tt.err, tt.message, got, tt.want) + } + } + +} + +// errors.New, etc values are not expected to be compared by value +// but the change in errors#27 made them incomparable. Assert that +// various kinds of errors have a functional equality operator, even +// if the result of that equality is always false. +func TestErrorEquality(t *testing.T) { + vals := []error{ + nil, + io.EOF, + errors.New("EOF"), + New("EOF"), + Errorf("EOF"), + Wrap(io.EOF, "EOF"), + Wrapf(io.EOF, "EOF%d", 2), + WithMessage(nil, "whoops"), + WithMessage(io.EOF, "whoops"), + WithStack(io.EOF), + WithStack(nil), + } + + for i := range vals { + for j := range vals { + _ = vals[i] == vals[j] // mustn't panic + } + } +} diff --git a/vendor/github.com/pkg/errors/example_test.go b/vendor/github.com/pkg/errors/example_test.go new file mode 100644 index 0000000000..c1fc13e384 --- /dev/null +++ b/vendor/github.com/pkg/errors/example_test.go @@ -0,0 +1,205 @@ +package errors_test + +import ( + "fmt" + + "github.com/pkg/errors" +) + +func ExampleNew() { + err := errors.New("whoops") + fmt.Println(err) + + // Output: whoops +} + +func ExampleNew_printf() { + err := errors.New("whoops") + fmt.Printf("%+v", err) + + // Example output: + // whoops + // github.com/pkg/errors_test.ExampleNew_printf + // /home/dfc/src/github.com/pkg/errors/example_test.go:17 + // testing.runExample + // /home/dfc/go/src/testing/example.go:114 + // testing.RunExamples + // /home/dfc/go/src/testing/example.go:38 + // testing.(*M).Run + // /home/dfc/go/src/testing/testing.go:744 + // main.main + // /github.com/pkg/errors/_test/_testmain.go:106 + // runtime.main + // /home/dfc/go/src/runtime/proc.go:183 + // runtime.goexit + // /home/dfc/go/src/runtime/asm_amd64.s:2059 +} + +func ExampleWithMessage() { + cause := errors.New("whoops") + err := errors.WithMessage(cause, "oh noes") + fmt.Println(err) + + // Output: oh noes: whoops +} + +func ExampleWithStack() { + cause := errors.New("whoops") + err := errors.WithStack(cause) + fmt.Println(err) + + // Output: whoops +} + +func ExampleWithStack_printf() { + cause := errors.New("whoops") + err := errors.WithStack(cause) + fmt.Printf("%+v", err) + + // Example Output: + // whoops + // github.com/pkg/errors_test.ExampleWithStack_printf + // /home/fabstu/go/src/github.com/pkg/errors/example_test.go:55 + // testing.runExample + // /usr/lib/go/src/testing/example.go:114 + // testing.RunExamples + // /usr/lib/go/src/testing/example.go:38 + // testing.(*M).Run + // /usr/lib/go/src/testing/testing.go:744 + // main.main + // github.com/pkg/errors/_test/_testmain.go:106 + // runtime.main + // /usr/lib/go/src/runtime/proc.go:183 + // runtime.goexit + // /usr/lib/go/src/runtime/asm_amd64.s:2086 + // github.com/pkg/errors_test.ExampleWithStack_printf + // /home/fabstu/go/src/github.com/pkg/errors/example_test.go:56 + // testing.runExample + // /usr/lib/go/src/testing/example.go:114 + // testing.RunExamples + // /usr/lib/go/src/testing/example.go:38 + // testing.(*M).Run + // /usr/lib/go/src/testing/testing.go:744 + // main.main + // github.com/pkg/errors/_test/_testmain.go:106 + // runtime.main + // /usr/lib/go/src/runtime/proc.go:183 + // runtime.goexit + // /usr/lib/go/src/runtime/asm_amd64.s:2086 +} + +func ExampleWrap() { + cause := errors.New("whoops") + err := errors.Wrap(cause, "oh noes") + fmt.Println(err) + + // Output: oh noes: whoops +} + +func fn() error { + e1 := errors.New("error") + e2 := errors.Wrap(e1, "inner") + e3 := errors.Wrap(e2, "middle") + return errors.Wrap(e3, "outer") +} + +func ExampleCause() { + err := fn() + fmt.Println(err) + fmt.Println(errors.Cause(err)) + + // Output: outer: middle: inner: error + // error +} + +func ExampleWrap_extended() { + err := fn() + fmt.Printf("%+v\n", err) + + // Example output: + // error + // github.com/pkg/errors_test.fn + // /home/dfc/src/github.com/pkg/errors/example_test.go:47 + // github.com/pkg/errors_test.ExampleCause_printf + // /home/dfc/src/github.com/pkg/errors/example_test.go:63 + // testing.runExample + // /home/dfc/go/src/testing/example.go:114 + // testing.RunExamples + // /home/dfc/go/src/testing/example.go:38 + // testing.(*M).Run + // /home/dfc/go/src/testing/testing.go:744 + // main.main + // /github.com/pkg/errors/_test/_testmain.go:104 + // runtime.main + // /home/dfc/go/src/runtime/proc.go:183 + // runtime.goexit + // /home/dfc/go/src/runtime/asm_amd64.s:2059 + // github.com/pkg/errors_test.fn + // /home/dfc/src/github.com/pkg/errors/example_test.go:48: inner + // github.com/pkg/errors_test.fn + // /home/dfc/src/github.com/pkg/errors/example_test.go:49: middle + // github.com/pkg/errors_test.fn + // /home/dfc/src/github.com/pkg/errors/example_test.go:50: outer +} + +func ExampleWrapf() { + cause := errors.New("whoops") + err := errors.Wrapf(cause, "oh noes #%d", 2) + fmt.Println(err) + + // Output: oh noes #2: whoops +} + +func ExampleErrorf_extended() { + err := errors.Errorf("whoops: %s", "foo") + fmt.Printf("%+v", err) + + // Example output: + // whoops: foo + // github.com/pkg/errors_test.ExampleErrorf + // /home/dfc/src/github.com/pkg/errors/example_test.go:101 + // testing.runExample + // /home/dfc/go/src/testing/example.go:114 + // testing.RunExamples + // /home/dfc/go/src/testing/example.go:38 + // testing.(*M).Run + // /home/dfc/go/src/testing/testing.go:744 + // main.main + // /github.com/pkg/errors/_test/_testmain.go:102 + // runtime.main + // /home/dfc/go/src/runtime/proc.go:183 + // runtime.goexit + // /home/dfc/go/src/runtime/asm_amd64.s:2059 +} + +func Example_stackTrace() { + type stackTracer interface { + StackTrace() errors.StackTrace + } + + err, ok := errors.Cause(fn()).(stackTracer) + if !ok { + panic("oops, err does not implement stackTracer") + } + + st := err.StackTrace() + fmt.Printf("%+v", st[0:2]) // top two frames + + // Example output: + // github.com/pkg/errors_test.fn + // /home/dfc/src/github.com/pkg/errors/example_test.go:47 + // github.com/pkg/errors_test.Example_stackTrace + // /home/dfc/src/github.com/pkg/errors/example_test.go:127 +} + +func ExampleCause_printf() { + err := errors.Wrap(func() error { + return func() error { + return errors.Errorf("hello %s", fmt.Sprintf("world")) + }() + }(), "failed") + + fmt.Printf("%v", err) + + // Output: failed: hello world +} diff --git a/vendor/github.com/pkg/errors/format_test.go b/vendor/github.com/pkg/errors/format_test.go new file mode 100644 index 0000000000..15fd7d89d7 --- /dev/null +++ b/vendor/github.com/pkg/errors/format_test.go @@ -0,0 +1,535 @@ +package errors + +import ( + "errors" + "fmt" + "io" + "regexp" + "strings" + "testing" +) + +func TestFormatNew(t *testing.T) { + tests := []struct { + error + format string + want string + }{{ + New("error"), + "%s", + "error", + }, { + New("error"), + "%v", + "error", + }, { + New("error"), + "%+v", + "error\n" + + "github.com/pkg/errors.TestFormatNew\n" + + "\t.+/github.com/pkg/errors/format_test.go:26", + }, { + New("error"), + "%q", + `"error"`, + }} + + for i, tt := range tests { + testFormatRegexp(t, i, tt.error, tt.format, tt.want) + } +} + +func TestFormatErrorf(t *testing.T) { + tests := []struct { + error + format string + want string + }{{ + Errorf("%s", "error"), + "%s", + "error", + }, { + Errorf("%s", "error"), + "%v", + "error", + }, { + Errorf("%s", "error"), + "%+v", + "error\n" + + "github.com/pkg/errors.TestFormatErrorf\n" + + "\t.+/github.com/pkg/errors/format_test.go:56", + }} + + for i, tt := range tests { + testFormatRegexp(t, i, tt.error, tt.format, tt.want) + } +} + +func TestFormatWrap(t *testing.T) { + tests := []struct { + error + format string + want string + }{{ + Wrap(New("error"), "error2"), + "%s", + "error2: error", + }, { + Wrap(New("error"), "error2"), + "%v", + "error2: error", + }, { + Wrap(New("error"), "error2"), + "%+v", + "error\n" + + "github.com/pkg/errors.TestFormatWrap\n" + + "\t.+/github.com/pkg/errors/format_test.go:82", + }, { + Wrap(io.EOF, "error"), + "%s", + "error: EOF", + }, { + Wrap(io.EOF, "error"), + "%v", + "error: EOF", + }, { + Wrap(io.EOF, "error"), + "%+v", + "EOF\n" + + "error\n" + + "github.com/pkg/errors.TestFormatWrap\n" + + "\t.+/github.com/pkg/errors/format_test.go:96", + }, { + Wrap(Wrap(io.EOF, "error1"), "error2"), + "%+v", + "EOF\n" + + "error1\n" + + "github.com/pkg/errors.TestFormatWrap\n" + + "\t.+/github.com/pkg/errors/format_test.go:103\n", + }, { + Wrap(New("error with space"), "context"), + "%q", + `"context: error with space"`, + }} + + for i, tt := range tests { + testFormatRegexp(t, i, tt.error, tt.format, tt.want) + } +} + +func TestFormatWrapf(t *testing.T) { + tests := []struct { + error + format string + want string + }{{ + Wrapf(io.EOF, "error%d", 2), + "%s", + "error2: EOF", + }, { + Wrapf(io.EOF, "error%d", 2), + "%v", + "error2: EOF", + }, { + Wrapf(io.EOF, "error%d", 2), + "%+v", + "EOF\n" + + "error2\n" + + "github.com/pkg/errors.TestFormatWrapf\n" + + "\t.+/github.com/pkg/errors/format_test.go:134", + }, { + Wrapf(New("error"), "error%d", 2), + "%s", + "error2: error", + }, { + Wrapf(New("error"), "error%d", 2), + "%v", + "error2: error", + }, { + Wrapf(New("error"), "error%d", 2), + "%+v", + "error\n" + + "github.com/pkg/errors.TestFormatWrapf\n" + + "\t.+/github.com/pkg/errors/format_test.go:149", + }} + + for i, tt := range tests { + testFormatRegexp(t, i, tt.error, tt.format, tt.want) + } +} + +func TestFormatWithStack(t *testing.T) { + tests := []struct { + error + format string + want []string + }{{ + WithStack(io.EOF), + "%s", + []string{"EOF"}, + }, { + WithStack(io.EOF), + "%v", + []string{"EOF"}, + }, { + WithStack(io.EOF), + "%+v", + []string{"EOF", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:175"}, + }, { + WithStack(New("error")), + "%s", + []string{"error"}, + }, { + WithStack(New("error")), + "%v", + []string{"error"}, + }, { + WithStack(New("error")), + "%+v", + []string{"error", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:189", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:189"}, + }, { + WithStack(WithStack(io.EOF)), + "%+v", + []string{"EOF", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:197", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:197"}, + }, { + WithStack(WithStack(Wrapf(io.EOF, "message"))), + "%+v", + []string{"EOF", + "message", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:205", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:205", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:205"}, + }, { + WithStack(Errorf("error%d", 1)), + "%+v", + []string{"error1", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:216", + "github.com/pkg/errors.TestFormatWithStack\n" + + "\t.+/github.com/pkg/errors/format_test.go:216"}, + }} + + for i, tt := range tests { + testFormatCompleteCompare(t, i, tt.error, tt.format, tt.want, true) + } +} + +func TestFormatWithMessage(t *testing.T) { + tests := []struct { + error + format string + want []string + }{{ + WithMessage(New("error"), "error2"), + "%s", + []string{"error2: error"}, + }, { + WithMessage(New("error"), "error2"), + "%v", + []string{"error2: error"}, + }, { + WithMessage(New("error"), "error2"), + "%+v", + []string{ + "error", + "github.com/pkg/errors.TestFormatWithMessage\n" + + "\t.+/github.com/pkg/errors/format_test.go:244", + "error2"}, + }, { + WithMessage(io.EOF, "addition1"), + "%s", + []string{"addition1: EOF"}, + }, { + WithMessage(io.EOF, "addition1"), + "%v", + []string{"addition1: EOF"}, + }, { + WithMessage(io.EOF, "addition1"), + "%+v", + []string{"EOF", "addition1"}, + }, { + WithMessage(WithMessage(io.EOF, "addition1"), "addition2"), + "%v", + []string{"addition2: addition1: EOF"}, + }, { + WithMessage(WithMessage(io.EOF, "addition1"), "addition2"), + "%+v", + []string{"EOF", "addition1", "addition2"}, + }, { + Wrap(WithMessage(io.EOF, "error1"), "error2"), + "%+v", + []string{"EOF", "error1", "error2", + "github.com/pkg/errors.TestFormatWithMessage\n" + + "\t.+/github.com/pkg/errors/format_test.go:272"}, + }, { + WithMessage(Errorf("error%d", 1), "error2"), + "%+v", + []string{"error1", + "github.com/pkg/errors.TestFormatWithMessage\n" + + "\t.+/github.com/pkg/errors/format_test.go:278", + "error2"}, + }, { + WithMessage(WithStack(io.EOF), "error"), + "%+v", + []string{ + "EOF", + "github.com/pkg/errors.TestFormatWithMessage\n" + + "\t.+/github.com/pkg/errors/format_test.go:285", + "error"}, + }, { + WithMessage(Wrap(WithStack(io.EOF), "inside-error"), "outside-error"), + "%+v", + []string{ + "EOF", + "github.com/pkg/errors.TestFormatWithMessage\n" + + "\t.+/github.com/pkg/errors/format_test.go:293", + "inside-error", + "github.com/pkg/errors.TestFormatWithMessage\n" + + "\t.+/github.com/pkg/errors/format_test.go:293", + "outside-error"}, + }} + + for i, tt := range tests { + testFormatCompleteCompare(t, i, tt.error, tt.format, tt.want, true) + } +} + +func TestFormatGeneric(t *testing.T) { + starts := []struct { + err error + want []string + }{ + {New("new-error"), []string{ + "new-error", + "github.com/pkg/errors.TestFormatGeneric\n" + + "\t.+/github.com/pkg/errors/format_test.go:315"}, + }, {Errorf("errorf-error"), []string{ + "errorf-error", + "github.com/pkg/errors.TestFormatGeneric\n" + + "\t.+/github.com/pkg/errors/format_test.go:319"}, + }, {errors.New("errors-new-error"), []string{ + "errors-new-error"}, + }, + } + + wrappers := []wrapper{ + { + func(err error) error { return WithMessage(err, "with-message") }, + []string{"with-message"}, + }, { + func(err error) error { return WithStack(err) }, + []string{ + "github.com/pkg/errors.(func·002|TestFormatGeneric.func2)\n\t" + + ".+/github.com/pkg/errors/format_test.go:333", + }, + }, { + func(err error) error { return Wrap(err, "wrap-error") }, + []string{ + "wrap-error", + "github.com/pkg/errors.(func·003|TestFormatGeneric.func3)\n\t" + + ".+/github.com/pkg/errors/format_test.go:339", + }, + }, { + func(err error) error { return Wrapf(err, "wrapf-error%d", 1) }, + []string{ + "wrapf-error1", + "github.com/pkg/errors.(func·004|TestFormatGeneric.func4)\n\t" + + ".+/github.com/pkg/errors/format_test.go:346", + }, + }, + } + + for s := range starts { + err := starts[s].err + want := starts[s].want + testFormatCompleteCompare(t, s, err, "%+v", want, false) + testGenericRecursive(t, err, want, wrappers, 3) + } +} + +func testFormatRegexp(t *testing.T, n int, arg interface{}, format, want string) { + got := fmt.Sprintf(format, arg) + gotLines := strings.SplitN(got, "\n", -1) + wantLines := strings.SplitN(want, "\n", -1) + + if len(wantLines) > len(gotLines) { + t.Errorf("test %d: wantLines(%d) > gotLines(%d):\n got: %q\nwant: %q", n+1, len(wantLines), len(gotLines), got, want) + return + } + + for i, w := range wantLines { + match, err := regexp.MatchString(w, gotLines[i]) + if err != nil { + t.Fatal(err) + } + if !match { + t.Errorf("test %d: line %d: fmt.Sprintf(%q, err):\n got: %q\nwant: %q", n+1, i+1, format, got, want) + } + } +} + +var stackLineR = regexp.MustCompile(`\.`) + +// parseBlocks parses input into a slice, where: +// - incase entry contains a newline, its a stacktrace +// - incase entry contains no newline, its a solo line. +// +// Detecting stack boundaries only works incase the WithStack-calls are +// to be found on the same line, thats why it is optionally here. +// +// Example use: +// +// for _, e := range blocks { +// if strings.ContainsAny(e, "\n") { +// // Match as stack +// } else { +// // Match as line +// } +// } +// +func parseBlocks(input string, detectStackboundaries bool) ([]string, error) { + var blocks []string + + stack := "" + wasStack := false + lines := map[string]bool{} // already found lines + + for _, l := range strings.Split(input, "\n") { + isStackLine := stackLineR.MatchString(l) + + switch { + case !isStackLine && wasStack: + blocks = append(blocks, stack, l) + stack = "" + lines = map[string]bool{} + case isStackLine: + if wasStack { + // Detecting two stacks after another, possible cause lines match in + // our tests due to WithStack(WithStack(io.EOF)) on same line. + if detectStackboundaries { + if lines[l] { + if len(stack) == 0 { + return nil, errors.New("len of block must not be zero here") + } + + blocks = append(blocks, stack) + stack = l + lines = map[string]bool{l: true} + continue + } + } + + stack = stack + "\n" + l + } else { + stack = l + } + lines[l] = true + case !isStackLine && !wasStack: + blocks = append(blocks, l) + default: + return nil, errors.New("must not happen") + } + + wasStack = isStackLine + } + + // Use up stack + if stack != "" { + blocks = append(blocks, stack) + } + return blocks, nil +} + +func testFormatCompleteCompare(t *testing.T, n int, arg interface{}, format string, want []string, detectStackBoundaries bool) { + gotStr := fmt.Sprintf(format, arg) + + got, err := parseBlocks(gotStr, detectStackBoundaries) + if err != nil { + t.Fatal(err) + } + + if len(got) != len(want) { + t.Fatalf("test %d: fmt.Sprintf(%s, err) -> wrong number of blocks: got(%d) want(%d)\n got: %s\nwant: %s\ngotStr: %q", + n+1, format, len(got), len(want), prettyBlocks(got), prettyBlocks(want), gotStr) + } + + for i := range got { + if strings.ContainsAny(want[i], "\n") { + // Match as stack + match, err := regexp.MatchString(want[i], got[i]) + if err != nil { + t.Fatal(err) + } + if !match { + t.Fatalf("test %d: block %d: fmt.Sprintf(%q, err):\ngot:\n%q\nwant:\n%q\nall-got:\n%s\nall-want:\n%s\n", + n+1, i+1, format, got[i], want[i], prettyBlocks(got), prettyBlocks(want)) + } + } else { + // Match as message + if got[i] != want[i] { + t.Fatalf("test %d: fmt.Sprintf(%s, err) at block %d got != want:\n got: %q\nwant: %q", n+1, format, i+1, got[i], want[i]) + } + } + } +} + +type wrapper struct { + wrap func(err error) error + want []string +} + +func prettyBlocks(blocks []string, prefix ...string) string { + var out []string + + for _, b := range blocks { + out = append(out, fmt.Sprintf("%v", b)) + } + + return " " + strings.Join(out, "\n ") +} + +func testGenericRecursive(t *testing.T, beforeErr error, beforeWant []string, list []wrapper, maxDepth int) { + if len(beforeWant) == 0 { + panic("beforeWant must not be empty") + } + for _, w := range list { + if len(w.want) == 0 { + panic("want must not be empty") + } + + err := w.wrap(beforeErr) + + // Copy required cause append(beforeWant, ..) modified beforeWant subtly. + beforeCopy := make([]string, len(beforeWant)) + copy(beforeCopy, beforeWant) + + beforeWant := beforeCopy + last := len(beforeWant) - 1 + var want []string + + // Merge two stacks behind each other. + if strings.ContainsAny(beforeWant[last], "\n") && strings.ContainsAny(w.want[0], "\n") { + want = append(beforeWant[:last], append([]string{beforeWant[last] + "((?s).*)" + w.want[0]}, w.want[1:]...)...) + } else { + want = append(beforeWant, w.want...) + } + + testFormatCompleteCompare(t, maxDepth, err, "%+v", want, false) + if maxDepth > 0 { + testGenericRecursive(t, err, want, list, maxDepth-1) + } + } +} diff --git a/vendor/github.com/pkg/errors/stack.go b/vendor/github.com/pkg/errors/stack.go new file mode 100644 index 0000000000..6b1f2891a5 --- /dev/null +++ b/vendor/github.com/pkg/errors/stack.go @@ -0,0 +1,178 @@ +package errors + +import ( + "fmt" + "io" + "path" + "runtime" + "strings" +) + +// Frame represents a program counter inside a stack frame. +type Frame uintptr + +// pc returns the program counter for this frame; +// multiple frames may have the same PC value. +func (f Frame) pc() uintptr { return uintptr(f) - 1 } + +// file returns the full path to the file that contains the +// function for this Frame's pc. +func (f Frame) file() string { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return "unknown" + } + file, _ := fn.FileLine(f.pc()) + return file +} + +// line returns the line number of source code of the +// function for this Frame's pc. +func (f Frame) line() int { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return 0 + } + _, line := fn.FileLine(f.pc()) + return line +} + +// Format formats the frame according to the fmt.Formatter interface. +// +// %s source file +// %d source line +// %n function name +// %v equivalent to %s:%d +// +// Format accepts flags that alter the printing of some verbs, as follows: +// +// %+s path of source file relative to the compile time GOPATH +// %+v equivalent to %+s:%d +func (f Frame) Format(s fmt.State, verb rune) { + switch verb { + case 's': + switch { + case s.Flag('+'): + pc := f.pc() + fn := runtime.FuncForPC(pc) + if fn == nil { + io.WriteString(s, "unknown") + } else { + file, _ := fn.FileLine(pc) + fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file) + } + default: + io.WriteString(s, path.Base(f.file())) + } + case 'd': + fmt.Fprintf(s, "%d", f.line()) + case 'n': + name := runtime.FuncForPC(f.pc()).Name() + io.WriteString(s, funcname(name)) + case 'v': + f.Format(s, 's') + io.WriteString(s, ":") + f.Format(s, 'd') + } +} + +// StackTrace is stack of Frames from innermost (newest) to outermost (oldest). +type StackTrace []Frame + +func (st StackTrace) Format(s fmt.State, verb rune) { + switch verb { + case 'v': + switch { + case s.Flag('+'): + for _, f := range st { + fmt.Fprintf(s, "\n%+v", f) + } + case s.Flag('#'): + fmt.Fprintf(s, "%#v", []Frame(st)) + default: + fmt.Fprintf(s, "%v", []Frame(st)) + } + case 's': + fmt.Fprintf(s, "%s", []Frame(st)) + } +} + +// stack represents a stack of program counters. +type stack []uintptr + +func (s *stack) Format(st fmt.State, verb rune) { + switch verb { + case 'v': + switch { + case st.Flag('+'): + for _, pc := range *s { + f := Frame(pc) + fmt.Fprintf(st, "\n%+v", f) + } + } + } +} + +func (s *stack) StackTrace() StackTrace { + f := make([]Frame, len(*s)) + for i := 0; i < len(f); i++ { + f[i] = Frame((*s)[i]) + } + return f +} + +func callers() *stack { + const depth = 32 + var pcs [depth]uintptr + n := runtime.Callers(3, pcs[:]) + var st stack = pcs[0:n] + return &st +} + +// funcname removes the path prefix component of a function's name reported by func.Name(). +func funcname(name string) string { + i := strings.LastIndex(name, "/") + name = name[i+1:] + i = strings.Index(name, ".") + return name[i+1:] +} + +func trimGOPATH(name, file string) string { + // Here we want to get the source file path relative to the compile time + // GOPATH. As of Go 1.6.x there is no direct way to know the compiled + // GOPATH at runtime, but we can infer the number of path segments in the + // GOPATH. We note that fn.Name() returns the function name qualified by + // the import path, which does not include the GOPATH. Thus we can trim + // segments from the beginning of the file path until the number of path + // separators remaining is one more than the number of path separators in + // the function name. For example, given: + // + // GOPATH /home/user + // file /home/user/src/pkg/sub/file.go + // fn.Name() pkg/sub.Type.Method + // + // We want to produce: + // + // pkg/sub/file.go + // + // From this we can easily see that fn.Name() has one less path separator + // than our desired output. We count separators from the end of the file + // path until it finds two more than in the function name and then move + // one character forward to preserve the initial path segment without a + // leading separator. + const sep = "/" + goal := strings.Count(name, sep) + 2 + i := len(file) + for n := 0; n < goal; n++ { + i = strings.LastIndex(file[:i], sep) + if i == -1 { + // not enough separators found, set i so that the slice expression + // below leaves file unmodified + i = -len(sep) + break + } + } + // get back to 0 or trim the leading separator + file = file[i+len(sep):] + return file +} diff --git a/vendor/github.com/pkg/errors/stack_test.go b/vendor/github.com/pkg/errors/stack_test.go new file mode 100644 index 0000000000..510c27a9f9 --- /dev/null +++ b/vendor/github.com/pkg/errors/stack_test.go @@ -0,0 +1,292 @@ +package errors + +import ( + "fmt" + "runtime" + "testing" +) + +var initpc, _, _, _ = runtime.Caller(0) + +func TestFrameLine(t *testing.T) { + var tests = []struct { + Frame + want int + }{{ + Frame(initpc), + 9, + }, { + func() Frame { + var pc, _, _, _ = runtime.Caller(0) + return Frame(pc) + }(), + 20, + }, { + func() Frame { + var pc, _, _, _ = runtime.Caller(1) + return Frame(pc) + }(), + 28, + }, { + Frame(0), // invalid PC + 0, + }} + + for _, tt := range tests { + got := tt.Frame.line() + want := tt.want + if want != got { + t.Errorf("Frame(%v): want: %v, got: %v", uintptr(tt.Frame), want, got) + } + } +} + +type X struct{} + +func (x X) val() Frame { + var pc, _, _, _ = runtime.Caller(0) + return Frame(pc) +} + +func (x *X) ptr() Frame { + var pc, _, _, _ = runtime.Caller(0) + return Frame(pc) +} + +func TestFrameFormat(t *testing.T) { + var tests = []struct { + Frame + format string + want string + }{{ + Frame(initpc), + "%s", + "stack_test.go", + }, { + Frame(initpc), + "%+s", + "github.com/pkg/errors.init\n" + + "\t.+/github.com/pkg/errors/stack_test.go", + }, { + Frame(0), + "%s", + "unknown", + }, { + Frame(0), + "%+s", + "unknown", + }, { + Frame(initpc), + "%d", + "9", + }, { + Frame(0), + "%d", + "0", + }, { + Frame(initpc), + "%n", + "init", + }, { + func() Frame { + var x X + return x.ptr() + }(), + "%n", + `\(\*X\).ptr`, + }, { + func() Frame { + var x X + return x.val() + }(), + "%n", + "X.val", + }, { + Frame(0), + "%n", + "", + }, { + Frame(initpc), + "%v", + "stack_test.go:9", + }, { + Frame(initpc), + "%+v", + "github.com/pkg/errors.init\n" + + "\t.+/github.com/pkg/errors/stack_test.go:9", + }, { + Frame(0), + "%v", + "unknown:0", + }} + + for i, tt := range tests { + testFormatRegexp(t, i, tt.Frame, tt.format, tt.want) + } +} + +func TestFuncname(t *testing.T) { + tests := []struct { + name, want string + }{ + {"", ""}, + {"runtime.main", "main"}, + {"github.com/pkg/errors.funcname", "funcname"}, + {"funcname", "funcname"}, + {"io.copyBuffer", "copyBuffer"}, + {"main.(*R).Write", "(*R).Write"}, + } + + for _, tt := range tests { + got := funcname(tt.name) + want := tt.want + if got != want { + t.Errorf("funcname(%q): want: %q, got %q", tt.name, want, got) + } + } +} + +func TestTrimGOPATH(t *testing.T) { + var tests = []struct { + Frame + want string + }{{ + Frame(initpc), + "github.com/pkg/errors/stack_test.go", + }} + + for i, tt := range tests { + pc := tt.Frame.pc() + fn := runtime.FuncForPC(pc) + file, _ := fn.FileLine(pc) + got := trimGOPATH(fn.Name(), file) + testFormatRegexp(t, i, got, "%s", tt.want) + } +} + +func TestStackTrace(t *testing.T) { + tests := []struct { + err error + want []string + }{{ + New("ooh"), []string{ + "github.com/pkg/errors.TestStackTrace\n" + + "\t.+/github.com/pkg/errors/stack_test.go:172", + }, + }, { + Wrap(New("ooh"), "ahh"), []string{ + "github.com/pkg/errors.TestStackTrace\n" + + "\t.+/github.com/pkg/errors/stack_test.go:177", // this is the stack of Wrap, not New + }, + }, { + Cause(Wrap(New("ooh"), "ahh")), []string{ + "github.com/pkg/errors.TestStackTrace\n" + + "\t.+/github.com/pkg/errors/stack_test.go:182", // this is the stack of New + }, + }, { + func() error { return New("ooh") }(), []string{ + `github.com/pkg/errors.(func·009|TestStackTrace.func1)` + + "\n\t.+/github.com/pkg/errors/stack_test.go:187", // this is the stack of New + "github.com/pkg/errors.TestStackTrace\n" + + "\t.+/github.com/pkg/errors/stack_test.go:187", // this is the stack of New's caller + }, + }, { + Cause(func() error { + return func() error { + return Errorf("hello %s", fmt.Sprintf("world")) + }() + }()), []string{ + `github.com/pkg/errors.(func·010|TestStackTrace.func2.1)` + + "\n\t.+/github.com/pkg/errors/stack_test.go:196", // this is the stack of Errorf + `github.com/pkg/errors.(func·011|TestStackTrace.func2)` + + "\n\t.+/github.com/pkg/errors/stack_test.go:197", // this is the stack of Errorf's caller + "github.com/pkg/errors.TestStackTrace\n" + + "\t.+/github.com/pkg/errors/stack_test.go:198", // this is the stack of Errorf's caller's caller + }, + }} + for i, tt := range tests { + x, ok := tt.err.(interface { + StackTrace() StackTrace + }) + if !ok { + t.Errorf("expected %#v to implement StackTrace() StackTrace", tt.err) + continue + } + st := x.StackTrace() + for j, want := range tt.want { + testFormatRegexp(t, i, st[j], "%+v", want) + } + } +} + +func stackTrace() StackTrace { + const depth = 8 + var pcs [depth]uintptr + n := runtime.Callers(1, pcs[:]) + var st stack = pcs[0:n] + return st.StackTrace() +} + +func TestStackTraceFormat(t *testing.T) { + tests := []struct { + StackTrace + format string + want string + }{{ + nil, + "%s", + `\[\]`, + }, { + nil, + "%v", + `\[\]`, + }, { + nil, + "%+v", + "", + }, { + nil, + "%#v", + `\[\]errors.Frame\(nil\)`, + }, { + make(StackTrace, 0), + "%s", + `\[\]`, + }, { + make(StackTrace, 0), + "%v", + `\[\]`, + }, { + make(StackTrace, 0), + "%+v", + "", + }, { + make(StackTrace, 0), + "%#v", + `\[\]errors.Frame{}`, + }, { + stackTrace()[:2], + "%s", + `\[stack_test.go stack_test.go\]`, + }, { + stackTrace()[:2], + "%v", + `\[stack_test.go:225 stack_test.go:272\]`, + }, { + stackTrace()[:2], + "%+v", + "\n" + + "github.com/pkg/errors.stackTrace\n" + + "\t.+/github.com/pkg/errors/stack_test.go:225\n" + + "github.com/pkg/errors.TestStackTraceFormat\n" + + "\t.+/github.com/pkg/errors/stack_test.go:276", + }, { + stackTrace()[:2], + "%#v", + `\[\]errors.Frame{stack_test.go:225, stack_test.go:284}`, + }} + + for i, tt := range tests { + testFormatRegexp(t, i, tt.StackTrace, tt.format, tt.want) + } +}