Merge pull request #9104 from hashicorp/up_oci_sdk

update github.com/oracle/oci-go-sdk v1.8.0 to v18.0.0+incompatible
This commit is contained in:
Wilken Rivera 2020-04-22 15:04:18 -04:00 committed by GitHub
commit 4844e101ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
640 changed files with 32755 additions and 2647 deletions

2
go.mod
View File

@ -127,7 +127,7 @@ require (
github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b
github.com/oracle/oci-go-sdk v1.8.0
github.com/oracle/oci-go-sdk v18.0.0+incompatible
github.com/outscale/osc-go v0.0.1
github.com/overdrive3000/secretsmanager v0.0.0-20200421092817-bcdff577c37a
github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a

4
go.sum
View File

@ -420,8 +420,8 @@ github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH
github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b h1:LGItPaClbzopugAomw5VFKnG3h1dUr9QW5KOU+m8gu0=
github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/oracle/oci-go-sdk v1.8.0 h1:4SO45bKV0I3/Mn1os3ANDZmV0eSE5z5CLdSUIkxtyzs=
github.com/oracle/oci-go-sdk v1.8.0/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
github.com/oracle/oci-go-sdk v18.0.0+incompatible h1:FLV4KixsVfF3rwyVTMI6Ryp/Q+OSb9sR5TawbfjFLN4=
github.com/oracle/oci-go-sdk v18.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
github.com/outscale/osc-go v0.0.1 h1:hvBtORyu7sWSKW1norGlfIP8C7c2aegI2Vkq75SRPCE=
github.com/outscale/osc-go v0.0.1/go.mod h1:hJLmXzqU/t07qQYh90I0TqZzu9s85Zs6FMrxk3ukiFM=
github.com/overdrive3000/secretsmanager v0.0.0-20200421092817-bcdff577c37a h1:75mTB6HzCWbVMbrOoC3Uul0ISN4hM2q3l8dyipdJHxM=

View File

@ -1,6 +1,6 @@
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.
Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl
or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
 ____________________________
The Universal Permissive License (UPL), Version 1.0
Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
@ -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,9 +46,9 @@ 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.
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.
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.

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package auth
@ -31,14 +32,16 @@ type urlBasedX509CertificateRetriever struct {
privateKeyPemRaw []byte
privateKey *rsa.PrivateKey
mux sync.Mutex
dispatcher common.HTTPRequestDispatcher
}
func newURLBasedX509CertificateRetriever(certURL, privateKeyURL, passphrase string) x509CertificateRetriever {
func newURLBasedX509CertificateRetriever(dispatcher common.HTTPRequestDispatcher, certURL, privateKeyURL, passphrase string) x509CertificateRetriever {
return &urlBasedX509CertificateRetriever{
certURL: certURL,
privateKeyURL: privateKeyURL,
passphrase: passphrase,
mux: sync.Mutex{},
dispatcher: dispatcher,
}
}
@ -75,7 +78,7 @@ func (r *urlBasedX509CertificateRetriever) Refresh() error {
func (r *urlBasedX509CertificateRetriever) renewCertificate(url string) (certificatePemRaw []byte, certificate *x509.Certificate, err error) {
var body bytes.Buffer
if body, err = httpGet(url); err != nil {
if body, _, err = httpGet(r.dispatcher, url); err != nil {
return nil, nil, fmt.Errorf("failed to get certificate from %s: %s", url, err.Error())
}
@ -95,7 +98,7 @@ func (r *urlBasedX509CertificateRetriever) renewCertificate(url string) (certifi
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 {
if body, _, err = httpGet(r.dispatcher, url); err != nil {
return nil, nil, fmt.Errorf("failed to get private key from %s: %s", url, err.Error())
}
@ -149,6 +152,7 @@ func (r *urlBasedX509CertificateRetriever) PrivateKey() *rsa.PrivateKey {
r.mux.Lock()
defer r.mux.Unlock()
//Nil Private keys are supported as part of a certificate
if r.privateKey == nil {
return nil
}
@ -156,3 +160,102 @@ func (r *urlBasedX509CertificateRetriever) PrivateKey() *rsa.PrivateKey {
c := *r.privateKey
return &c
}
//staticCertificateRetriever serves certificates from static data
type staticCertificateRetriever struct {
Passphrase []byte
CertificatePem []byte
PrivateKeyPem []byte
certificate *x509.Certificate
privateKey *rsa.PrivateKey
mux sync.Mutex
}
//Refresh proccess the inputs into appropiate keys and certificates
func (r *staticCertificateRetriever) Refresh() error {
r.mux.Lock()
defer r.mux.Unlock()
certifcate, err := r.readCertificate()
if err != nil {
r.certificate = nil
return err
}
r.certificate = certifcate
key, err := r.readPrivateKey()
if err != nil {
r.privateKey = nil
return err
}
r.privateKey = key
return nil
}
func (r *staticCertificateRetriever) Certificate() *x509.Certificate {
r.mux.Lock()
defer r.mux.Unlock()
return r.certificate
}
func (r *staticCertificateRetriever) PrivateKey() *rsa.PrivateKey {
r.mux.Lock()
defer r.mux.Unlock()
return r.privateKey
}
func (r *staticCertificateRetriever) CertificatePemRaw() []byte {
r.mux.Lock()
defer r.mux.Unlock()
if r.CertificatePem == nil {
return nil
}
c := make([]byte, len(r.CertificatePem))
copy(c, r.CertificatePem)
return c
}
func (r *staticCertificateRetriever) PrivateKeyPemRaw() []byte {
r.mux.Lock()
defer r.mux.Unlock()
if r.PrivateKeyPem == nil {
return nil
}
c := make([]byte, len(r.PrivateKeyPem))
copy(c, r.PrivateKeyPem)
return c
}
func (r *staticCertificateRetriever) readCertificate() (certificate *x509.Certificate, err error) {
block, _ := pem.Decode(r.CertificatePem)
if block == nil {
return nil, fmt.Errorf("failed to parse the new certificate, not valid pem data")
}
if certificate, err = x509.ParseCertificate(block.Bytes); err != nil {
return nil, fmt.Errorf("failed to parse the new certificate: %s", err.Error())
}
return certificate, nil
}
func (r *staticCertificateRetriever) readPrivateKey() (*rsa.PrivateKey, error) {
if r.PrivateKeyPem == nil {
return nil, nil
}
var pass *string
if r.Passphrase == nil {
pass = nil
} else {
ss := string(r.Passphrase)
pass = &ss
}
return common.PrivateKeyFromBytes(r.PrivateKeyPem, pass)
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package auth
@ -9,28 +10,70 @@ import (
)
type instancePrincipalConfigurationProvider struct {
keyProvider *instancePrincipalKeyProvider
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
return newInstancePrincipalConfigurationProvider("", nil)
}
//InstancePrincipalConfigurationProviderForRegion returns a configuration for instance principals with a given region
func InstancePrincipalConfigurationProviderForRegion(region common.Region) (common.ConfigurationProvider, error) {
return newInstancePrincipalConfigurationProvider(region, nil)
}
//InstancePrincipalConfigurationProviderWithCustomClient returns a configuration for instance principals using a modifier function to modify the HTTPRequestDispatcher
func InstancePrincipalConfigurationProviderWithCustomClient(modifier func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error)) (common.ConfigurationProvider, error) {
return newInstancePrincipalConfigurationProvider("", modifier)
}
//InstancePrincipalConfigurationForRegionWithCustomClient returns a configuration for instance principals with a given region using a modifier function to modify the HTTPRequestDispatcher
func InstancePrincipalConfigurationForRegionWithCustomClient(region common.Region, modifier func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error)) (common.ConfigurationProvider, error) {
return newInstancePrincipalConfigurationProvider(region, modifier)
}
func newInstancePrincipalConfigurationProvider(region common.Region, modifier func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error)) (common.ConfigurationProvider, error) {
var err error
var keyProvider *instancePrincipalKeyProvider
if keyProvider, err = newInstancePrincipalKeyProvider(); err != nil {
if keyProvider, err = newInstancePrincipalKeyProvider(modifier); err != nil {
return nil, fmt.Errorf("failed to create a new key provider for instance principal: %s", err.Error())
}
return instancePrincipalConfigurationProvider{keyProvider: keyProvider, region: &region}, nil
if len(region) > 0 {
return instancePrincipalConfigurationProvider{keyProvider: *keyProvider, region: &region}, nil
}
return instancePrincipalConfigurationProvider{keyProvider: *keyProvider, region: nil}, nil
}
//InstancePrincipalConfigurationWithCerts returns a configuration for instance principals with a given region and hardcoded certificates in lieu of metadata service certs
func InstancePrincipalConfigurationWithCerts(region common.Region, leafCertificate, leafPassphrase, leafPrivateKey []byte, intermediateCertificates [][]byte) (common.ConfigurationProvider, error) {
leafCertificateRetriever := staticCertificateRetriever{Passphrase: leafPassphrase, CertificatePem: leafCertificate, PrivateKeyPem: leafPrivateKey}
//The .Refresh() call actually reads the certificates from the inputs
err := leafCertificateRetriever.Refresh()
if err != nil {
return nil, err
}
certificate := leafCertificateRetriever.Certificate()
tenancyID := extractTenancyIDFromCertificate(certificate)
fedClient, err := newX509FederationClientWithCerts(region, tenancyID, leafCertificate, leafPassphrase, leafPrivateKey, intermediateCertificates, *newDispatcherModifier(nil))
if err != nil {
return nil, err
}
provider := instancePrincipalConfigurationProvider{
keyProvider: instancePrincipalKeyProvider{
Region: region,
FederationClient: fedClient,
TenancyID: tenancyID,
},
region: &region,
}
return provider, nil
}
func (p instancePrincipalConfigurationProvider) PrivateRSAKey() (*rsa.PrivateKey, error) {
@ -55,7 +98,9 @@ func (p instancePrincipalConfigurationProvider) KeyFingerprint() (string, error)
func (p instancePrincipalConfigurationProvider) Region() (string, error) {
if p.region == nil {
return string(p.keyProvider.RegionForFederationClient()), nil
region := p.keyProvider.RegionForFederationClient()
common.Debugf("Region in instance principal configuration provider is nil. Returning federation clients region: %s", region)
return string(region), nil
}
return string(*p.region), nil
}

View File

@ -0,0 +1,38 @@
package auth
import "github.com/oracle/oci-go-sdk/common"
//dispatcherModifier gives ability to modify a HTTPRequestDispatcher before use.
type dispatcherModifier struct {
modifiers []func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error)
}
//newDispatcherModifier creates a new dispatcherModifier with optional initial modifier (may be nil).
func newDispatcherModifier(modifier func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error)) *dispatcherModifier {
dispatcherModifier := &dispatcherModifier{
modifiers: make([]func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error), 0),
}
if modifier != nil {
dispatcherModifier.QueueModifier(modifier)
}
return dispatcherModifier
}
//QueueModifier queues up a new modifier
func (c *dispatcherModifier) QueueModifier(modifier func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error)) {
c.modifiers = append(c.modifiers, modifier)
}
//Modify the provided HTTPRequestDispatcher with this modifier, and return the result, or error if something goes wrong
func (c *dispatcherModifier) Modify(dispatcher common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error) {
if len(c.modifiers) > 0 {
for _, modifier := range c.modifiers {
var err error
if dispatcher, err = modifier(dispatcher); err != nil {
common.Debugf("An error occurred when attempting to modify the dispatcher. Error was: %s", err.Error())
return nil, err
}
}
}
return dispatcher, nil
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Package auth provides supporting functions and structs for authentication
package auth
@ -9,20 +10,127 @@ import (
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"io/ioutil"
"net/http"
"os"
"strings"
"sync"
"time"
)
// 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 {
ClaimHolder
PrivateKey() (*rsa.PrivateKey, error)
SecurityToken() (string, error)
}
// ClaimHolder is implemented by any token interface that provides access to the security claims embedded in the token.
type ClaimHolder interface {
GetClaim(key string) (interface{}, error)
}
type genericFederationClient struct {
SessionKeySupplier sessionKeySupplier
RefreshSecurityToken func() (securityToken, error)
securityToken securityToken
mux sync.Mutex
}
var _ federationClient = &genericFederationClient{}
func (c *genericFederationClient) PrivateKey() (*rsa.PrivateKey, error) {
c.mux.Lock()
defer c.mux.Unlock()
if err := c.renewKeyAndSecurityTokenIfNotValid(); err != nil {
return nil, err
}
return c.SessionKeySupplier.PrivateKey(), nil
}
func (c *genericFederationClient) SecurityToken() (token string, err error) {
c.mux.Lock()
defer c.mux.Unlock()
if err = c.renewKeyAndSecurityTokenIfNotValid(); err != nil {
return "", err
}
return c.securityToken.String(), nil
}
func (c *genericFederationClient) renewKeyAndSecurityTokenIfNotValid() (err error) {
if c.securityToken == nil || !c.securityToken.Valid() {
if err = c.renewKeyAndSecurityToken(); err != nil {
return fmt.Errorf("failed to renew security token: %s", err.Error())
}
}
return nil
}
func (c *genericFederationClient) renewKeyAndSecurityToken() (err error) {
common.Logf("Renewing keys for file based security token at: %v\n", time.Now().Format("15:04:05.000"))
if err = c.SessionKeySupplier.Refresh(); err != nil {
return fmt.Errorf("failed to refresh session key: %s", err.Error())
}
common.Logf("Renewing security token at: %v\n", time.Now().Format("15:04:05.000"))
if c.securityToken, err = c.RefreshSecurityToken(); err != nil {
return fmt.Errorf("failed to refresh security token key: %s", err.Error())
}
common.Logf("Security token renewed at: %v\n", time.Now().Format("15:04:05.000"))
return nil
}
func (c *genericFederationClient) GetClaim(key string) (interface{}, error) {
c.mux.Lock()
defer c.mux.Unlock()
if err := c.renewKeyAndSecurityTokenIfNotValid(); err != nil {
return nil, err
}
return c.securityToken.GetClaim(key)
}
func newFileBasedFederationClient(securityTokenPath string, supplier sessionKeySupplier) (*genericFederationClient, error) {
return &genericFederationClient{
SessionKeySupplier: supplier,
RefreshSecurityToken: func() (token securityToken, err error) {
var content []byte
if content, err = ioutil.ReadFile(securityTokenPath); err != nil {
return nil, fmt.Errorf("failed to read security token from :%s. Due to: %s", securityTokenPath, err.Error())
}
var newToken securityToken
if newToken, err = newInstancePrincipalToken(string(content)); err != nil {
return nil, fmt.Errorf("failed to read security token from :%s. Due to: %s", securityTokenPath, err.Error())
}
return newToken, nil
},
}, nil
}
func newStaticFederationClient(sessionToken string, supplier sessionKeySupplier) (*genericFederationClient, error) {
var newToken securityToken
var err error
if newToken, err = newInstancePrincipalToken(string(sessionToken)); err != nil {
return nil, fmt.Errorf("failed to read security token. Due to: %s", err.Error())
}
return &genericFederationClient{
SessionKeySupplier: supplier,
RefreshSecurityToken: func() (token securityToken, err error) {
return newToken, nil
},
}, nil
}
// x509FederationClient retrieves a security token from Auth service.
type x509FederationClient struct {
tenancyID string
@ -34,15 +142,49 @@ type x509FederationClient struct {
mux sync.Mutex
}
func newX509FederationClient(region common.Region, tenancyID string, leafCertificateRetriever x509CertificateRetriever, intermediateCertificateRetrievers []x509CertificateRetriever) federationClient {
func newX509FederationClient(region common.Region, tenancyID string, leafCertificateRetriever x509CertificateRetriever, intermediateCertificateRetrievers []x509CertificateRetriever, modifier dispatcherModifier) (federationClient, error) {
client := &x509FederationClient{
tenancyID: tenancyID,
leafCertificateRetriever: leafCertificateRetriever,
intermediateCertificateRetrievers: intermediateCertificateRetrievers,
}
client.sessionKeySupplier = newSessionKeySupplier()
client.authClient = newAuthClient(region, client)
return client
authClient := newAuthClient(region, client)
var err error
if authClient.HTTPClient, err = modifier.Modify(authClient.HTTPClient); err != nil {
err = fmt.Errorf("failed to modify client: %s", err.Error())
return nil, err
}
client.authClient = authClient
return client, nil
}
func newX509FederationClientWithCerts(region common.Region, tenancyID string, leafCertificate, leafPassphrase, leafPrivateKey []byte, intermediateCertificates [][]byte, modifier dispatcherModifier) (federationClient, error) {
intermediateRetrievers := make([]x509CertificateRetriever, len(intermediateCertificates))
for i, c := range intermediateCertificates {
intermediateRetrievers[i] = &staticCertificateRetriever{Passphrase: []byte(""), CertificatePem: c, PrivateKeyPem: nil}
}
client := &x509FederationClient{
tenancyID: tenancyID,
leafCertificateRetriever: &staticCertificateRetriever{Passphrase: leafPassphrase, CertificatePem: leafCertificate, PrivateKeyPem: leafPrivateKey},
intermediateCertificateRetrievers: intermediateRetrievers,
}
client.sessionKeySupplier = newSessionKeySupplier()
authClient := newAuthClient(region, client)
var err error
if authClient.HTTPClient, err = modifier.Modify(authClient.HTTPClient); err != nil {
err = fmt.Errorf("failed to modify client: %s", err.Error())
return nil, err
}
client.authClient = authClient
return client, nil
}
var (
@ -53,10 +195,10 @@ var (
func newAuthClient(region common.Region, provider common.KeyProvider) *common.BaseClient {
signer := common.RequestSigner(provider, genericHeaders, bodyHeaders)
client := common.DefaultBaseClientWithSigner(signer)
if region == common.RegionSEA {
client.Host = "https://auth.r1.oracleiaas.com"
if regionURL, ok := os.LookupEnv("OCI_SDK_AUTH_CLIENT_REGION_URL"); ok {
client.Host = regionURL
} else {
client.Host = fmt.Sprintf(common.DefaultHostURLTemplate, "auth", string(region))
client.Host = region.Endpoint("auth")
}
client.BasePath = "v1/x509"
return &client
@ -71,7 +213,12 @@ func (c *x509FederationClient) KeyID() (string, error) {
// For authClient to sign requests to X509 Federation Endpoint
func (c *x509FederationClient) PrivateRSAKey() (*rsa.PrivateKey, error) {
return c.leafCertificateRetriever.PrivateKey(), nil
key := c.leafCertificateRetriever.PrivateKey()
if key == nil {
return nil, fmt.Errorf("can not read private key from leaf certificate. Likely an error in the metadata service")
}
return key, nil
}
func (c *x509FederationClient) PrivateKey() (*rsa.PrivateKey, error) {
@ -124,9 +271,11 @@ func (c *x509FederationClient) renewSecurityToken() (err error) {
}
}
common.Logf("Renewing security token at: %v\n", time.Now().Format("15:04:05.000"))
if c.securityToken, err = c.getSecurityToken(); err != nil {
return fmt.Errorf("failed to get security token: %s", err.Error())
}
common.Logf("Security token renewed at: %v\n", time.Now().Format("15:04:05.000"))
return nil
}
@ -142,7 +291,14 @@ func (c *x509FederationClient) getSecurityToken() (securityToken, error) {
var httpResponse *http.Response
defer common.CloseBodyIfValid(httpResponse)
if httpResponse, err = c.authClient.Call(context.Background(), &httpRequest); err != nil {
for retry := 0; retry < 5; retry++ {
if httpResponse, err = c.authClient.Call(context.Background(), &httpRequest); err == nil {
break
}
time.Sleep(250 * time.Microsecond)
}
if err != nil {
return nil, fmt.Errorf("failed to call: %s", err.Error())
}
@ -154,6 +310,16 @@ func (c *x509FederationClient) getSecurityToken() (securityToken, error) {
return newInstancePrincipalToken(response.Token.Token)
}
func (c *x509FederationClient) GetClaim(key string) (interface{}, error) {
c.mux.Lock()
defer c.mux.Unlock()
if err := c.renewSecurityTokenIfNotValid(); err != nil {
return nil, err
}
return c.securityToken.GetClaim(key)
}
type x509FederationRequest struct {
X509FederationDetails `contributesTo:"body"`
}
@ -206,6 +372,103 @@ type sessionKeySupplier interface {
PublicKeyPemRaw() []byte
}
//genericKeySupplier implements sessionKeySupplier and provides an arbitrary refresh mechanism
type genericKeySupplier struct {
RefreshFn func() (*rsa.PrivateKey, []byte, error)
privateKey *rsa.PrivateKey
publicKeyPemRaw []byte
}
func (s genericKeySupplier) PrivateKey() *rsa.PrivateKey {
if s.privateKey == nil {
return nil
}
c := *s.privateKey
return &c
}
func (s genericKeySupplier) PublicKeyPemRaw() []byte {
if s.publicKeyPemRaw == nil {
return nil
}
c := make([]byte, len(s.publicKeyPemRaw))
copy(c, s.publicKeyPemRaw)
return c
}
func (s *genericKeySupplier) Refresh() (err error) {
privateKey, publicPem, err := s.RefreshFn()
if err != nil {
return err
}
s.privateKey = privateKey
s.publicKeyPemRaw = publicPem
return nil
}
// create a sessionKeySupplier that reads keys from file every time it refreshes
func newFileBasedKeySessionSupplier(privateKeyPemPath string, passphrasePath *string) (*genericKeySupplier, error) {
return &genericKeySupplier{
RefreshFn: func() (*rsa.PrivateKey, []byte, error) {
var err error
var passContent []byte
if passphrasePath != nil {
if passContent, err = ioutil.ReadFile(*passphrasePath); err != nil {
return nil, nil, fmt.Errorf("can not read passphrase from file: %s, due to %s", *passphrasePath, err.Error())
}
}
var keyPemContent []byte
if keyPemContent, err = ioutil.ReadFile(privateKeyPemPath); err != nil {
return nil, nil, fmt.Errorf("can not read private privateKey pem from file: %s, due to %s", privateKeyPemPath, err.Error())
}
var privateKey *rsa.PrivateKey
if privateKey, err = common.PrivateKeyFromBytesWithPassword(keyPemContent, passContent); err != nil {
return nil, nil, fmt.Errorf("can not create private privateKey from contents of: %s, due to: %s", privateKeyPemPath, err.Error())
}
var publicKeyAsnBytes []byte
if publicKeyAsnBytes, err = x509.MarshalPKIXPublicKey(privateKey.Public()); err != nil {
return nil, nil, 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,
})
return privateKey, publicKeyPemRaw, nil
},
}, nil
}
func newStaticKeySessionSupplier(privateKeyPemContent, passphrase []byte) (*genericKeySupplier, error) {
var err error
var privateKey *rsa.PrivateKey
if privateKey, err = common.PrivateKeyFromBytesWithPassword(privateKeyPemContent, passphrase); err != nil {
return nil, fmt.Errorf("can not create private privateKey, due to: %s", err.Error())
}
var publicKeyAsnBytes []byte
if publicKeyAsnBytes, err = x509.MarshalPKIXPublicKey(privateKey.Public()); err != nil {
return nil, 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,
})
return &genericKeySupplier{
RefreshFn: func() (key *rsa.PrivateKey, bytes []byte, err error) {
return privateKey, publicKeyPemRaw, nil
},
}, nil
}
// inMemorySessionKeySupplier implements sessionKeySupplier to vend an RSA keypair.
// Refresh() generates a new RSA keypair with a random source, and keeps it in memory.
//
@ -268,6 +531,8 @@ func (s *inMemorySessionKeySupplier) PublicKeyPemRaw() []byte {
type securityToken interface {
fmt.Stringer
Valid() bool
ClaimHolder
}
type instancePrincipalToken struct {
@ -290,3 +555,15 @@ func (t *instancePrincipalToken) String() string {
func (t *instancePrincipalToken) Valid() bool {
return !t.jwtToken.expired()
}
var (
// ErrNoSuchClaim is returned when a token does not hold the claim sought
ErrNoSuchClaim = errors.New("no such claim")
)
func (t *instancePrincipalToken) GetClaim(key string) (interface{}, error) {
if value, ok := t.jwtToken.payload[key]; ok {
return value, nil
}
return nil, ErrNoSuchClaim
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package auth
@ -7,27 +8,36 @@ import (
"crypto/rsa"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"net/http"
"strings"
)
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`
metadataBaseURL = `http://169.254.169.254/opc/v2`
metadataFallbackURL = `http://169.254.169.254/opc/v1`
regionPath = `/instance/region`
leafCertificatePath = `/identity/cert.pem`
leafCertificateKeyPath = `/identity/key.pem`
intermediateCertificatePath = `/identity/intermediate.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
)
var (
regionURL, leafCertificateURL, leafCertificateKeyURL, intermediateCertificateURL string
)
// 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
tenancyID string
Region common.Region
FederationClient federationClient
TenancyID string
}
// newInstancePrincipalKeyProvider creates and returns an instancePrincipalKeyProvider instance based on
@ -38,19 +48,30 @@ type instancePrincipalKeyProvider struct {
// 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)
func newInstancePrincipalKeyProvider(modifier func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher, error)) (provider *instancePrincipalKeyProvider, err error) {
updateX509CertRetrieverURLParas(metadataBaseURL)
clientModifier := newDispatcherModifier(modifier)
client, err := clientModifier.Modify(&http.Client{})
if err != nil {
err = fmt.Errorf("failed to modify client: %s", err.Error())
return nil, err
}
leafCertificateRetriever := newURLBasedX509CertificateRetriever(
var region common.Region
if region, err = getRegionForFederationClient(client, regionURL); err != nil {
err = fmt.Errorf("failed to get the region name from %s: %s", regionURL, err.Error())
common.Logf("%v\n", err)
return nil, err
}
leafCertificateRetriever := newURLBasedX509CertificateRetriever(client,
leafCertificateURL, leafCertificateKeyURL, leafCertificateKeyPassphrase)
intermediateCertificateRetrievers := []x509CertificateRetriever{
newURLBasedX509CertificateRetriever(
intermediateCertificateURL, intermediateCertificateKeyURL, intermediateCertificateKeyPassphrase),
client, intermediateCertificateURL, intermediateCertificateKeyURL,
intermediateCertificateKeyPassphrase),
}
if err = leafCertificateRetriever.Refresh(); err != nil {
@ -59,27 +80,44 @@ func newInstancePrincipalKeyProvider() (provider *instancePrincipalKeyProvider,
}
tenancyID := extractTenancyIDFromCertificate(leafCertificateRetriever.Certificate())
federationClient := newX509FederationClient(
region, tenancyID, leafCertificateRetriever, intermediateCertificateRetrievers)
federationClient, err := newX509FederationClient(region, tenancyID, leafCertificateRetriever, intermediateCertificateRetrievers, *clientModifier)
provider = &instancePrincipalKeyProvider{regionForFederationClient: region, federationClient: federationClient, tenancyID: tenancyID}
if err != nil {
err = fmt.Errorf("failed to create federation client: %s", err.Error())
return nil, err
}
provider = &instancePrincipalKeyProvider{FederationClient: federationClient, TenancyID: tenancyID, Region: region}
return
}
func getRegionForFederationClient(url string) (r common.Region, err error) {
func getRegionForFederationClient(dispatcher common.HTTPRequestDispatcher, url string) (r common.Region, err error) {
var body bytes.Buffer
if body, err = httpGet(url); err != nil {
var statusCode int
if body, statusCode, err = httpGet(dispatcher, url); err != nil {
if statusCode == 404 && strings.Compare(url, metadataBaseURL+regionPath) == 0 {
common.Logf("Falling back to http://169.254.169.254/opc/v1 to try again...\n")
updateX509CertRetrieverURLParas(metadataFallbackURL)
return getRegionForFederationClient(dispatcher, regionURL)
}
return
}
return common.StringToRegion(body.String()), nil
}
func updateX509CertRetrieverURLParas(baseURL string) {
regionURL = baseURL + regionPath
leafCertificateURL = baseURL + leafCertificatePath
leafCertificateKeyURL = baseURL + leafCertificateKeyPath
intermediateCertificateURL = baseURL + intermediateCertificatePath
}
func (p *instancePrincipalKeyProvider) RegionForFederationClient() common.Region {
return p.regionForFederationClient
return p.Region
}
func (p *instancePrincipalKeyProvider) PrivateRSAKey() (privateKey *rsa.PrivateKey, err error) {
if privateKey, err = p.federationClient.PrivateKey(); err != nil {
if privateKey, err = p.FederationClient.PrivateKey(); err != nil {
err = fmt.Errorf("failed to get private key: %s", err.Error())
return nil, err
}
@ -89,12 +127,12 @@ func (p *instancePrincipalKeyProvider) PrivateRSAKey() (privateKey *rsa.PrivateK
func (p *instancePrincipalKeyProvider) KeyID() (string, error) {
var securityToken string
var err error
if securityToken, err = p.federationClient.SecurityToken(); err != nil {
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
}
func (p *instancePrincipalKeyProvider) TenancyOCID() (string, error) {
return p.tenancyID, nil
return p.TenancyID, nil
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package auth
@ -7,6 +8,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"strings"
"time"
)
@ -17,9 +19,16 @@ type jwtToken struct {
payload map[string]interface{}
}
const bufferTimeBeforeTokenExpiration = 5 * time.Minute
func (t *jwtToken) expired() bool {
exp := int64(t.payload["exp"].(float64))
return exp <= time.Now().Unix()
expTime := time.Unix(exp, 0)
expired := exp <= time.Now().Unix()+int64(bufferTimeBeforeTokenExpiration.Seconds())
if expired {
common.Debugf("Token expires at: %v, currently expired due to bufferTime: %v", expTime.Format("15:04:05.000"), expired)
}
return expired
}
func parseJwt(tokenString string) (*jwtToken, error) {

View File

@ -0,0 +1,183 @@
package auth
import (
"crypto/rsa"
"errors"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"os"
"path"
)
const (
//ResourcePrincipalVersion2_2 supported version for resource principals
ResourcePrincipalVersion2_2 = "2.2"
//ResourcePrincipalVersionEnvVar environment var name for version
ResourcePrincipalVersionEnvVar = "OCI_RESOURCE_PRINCIPAL_VERSION"
//ResourcePrincipalRPSTEnvVar environment var name holding the token or a path to the token
ResourcePrincipalRPSTEnvVar = "OCI_RESOURCE_PRINCIPAL_RPST"
//ResourcePrincipalPrivatePEMEnvVar environment var holding a rsa private key in pem format or a path to one
ResourcePrincipalPrivatePEMEnvVar = "OCI_RESOURCE_PRINCIPAL_PRIVATE_PEM"
//ResourcePrincipalPrivatePEMPassphraseEnvVar environment var holding the passphrase to a key or a path to one
ResourcePrincipalPrivatePEMPassphraseEnvVar = "OCI_RESOURCE_PRINCIPAL_PRIVATE_PEM_PASSPHRASE"
//ResourcePrincipalRegionEnvVar environment variable holding a region
ResourcePrincipalRegionEnvVar = "OCI_RESOURCE_PRINCIPAL_REGION"
// TenancyOCIDClaimKey is the key used to look up the resource tenancy in an RPST
TenancyOCIDClaimKey = "res_tenant"
// CompartmentOCIDClaimKey is the key used to look up the resource compartment in an RPST
CompartmentOCIDClaimKey = "res_compartment"
)
// ConfigurationProviderWithClaimAccess mixes in a method to access the claims held on the underlying security token
type ConfigurationProviderWithClaimAccess interface {
common.ConfigurationProvider
ClaimHolder
}
// ResourcePrincipalConfigurationProvider returns a resource principal configuration provider using well known
// environment variables to look up token information. The environment variables can either paths or contain the material value
// of the keys. However in the case of the keys and tokens paths and values can not be mixed
func ResourcePrincipalConfigurationProvider() (ConfigurationProviderWithClaimAccess, error) {
var version string
var ok bool
if version, ok = os.LookupEnv(ResourcePrincipalVersionEnvVar); !ok {
return nil, fmt.Errorf("can not create resource principal, environment variable: %s, not present", ResourcePrincipalVersionEnvVar)
}
switch version {
case ResourcePrincipalVersion2_2:
rpst := requireEnv(ResourcePrincipalRPSTEnvVar)
if rpst == nil {
return nil, fmt.Errorf("can not create resource principal, environment variable: %s, not present", ResourcePrincipalRPSTEnvVar)
}
private := requireEnv(ResourcePrincipalPrivatePEMEnvVar)
if private == nil {
return nil, fmt.Errorf("can not create resource principal, environment variable: %s, not present", ResourcePrincipalPrivatePEMEnvVar)
}
passphrase := requireEnv(ResourcePrincipalPrivatePEMPassphraseEnvVar)
region := requireEnv(ResourcePrincipalRegionEnvVar)
if region == nil {
return nil, fmt.Errorf("can not create resource principal, environment variable: %s, not present", ResourcePrincipalRegionEnvVar)
}
return newResourcePrincipalKeyProvider22(
*rpst, *private, passphrase, *region)
default:
return nil, fmt.Errorf("can not create resource principal, environment variable: %s, must be valid", ResourcePrincipalVersionEnvVar)
}
}
func requireEnv(key string) *string {
if val, ok := os.LookupEnv(key); ok {
return &val
}
return nil
}
// resourcePrincipalKeyProvider22 is key provider that reads from specified the specified environment variables
// the environment variables can host the material keys/passphrases or they can be paths to files that need to be read
type resourcePrincipalKeyProvider struct {
FederationClient federationClient
KeyProviderRegion common.Region
}
func newResourcePrincipalKeyProvider22(sessionTokenLocation, privatePemLocation string,
passphraseLocation *string, region string) (*resourcePrincipalKeyProvider, error) {
//Check both the the passphrase and the key are paths
if passphraseLocation != nil && (!isPath(privatePemLocation) && isPath(*passphraseLocation) ||
isPath(privatePemLocation) && !isPath(*passphraseLocation)) {
return nil, fmt.Errorf("cant not create resource principal: both key and passphrase need to be path or none needs to be path")
}
var supplier sessionKeySupplier
var err error
//File based case
if isPath(privatePemLocation) {
supplier, err = newFileBasedKeySessionSupplier(privatePemLocation, passphraseLocation)
if err != nil {
return nil, fmt.Errorf("can not create resource principal, due to: %s ", err.Error())
}
} else {
//else the content is in the env vars
var passphrase []byte
if passphraseLocation != nil {
passphrase = []byte(*passphraseLocation)
}
supplier, err = newStaticKeySessionSupplier([]byte(privatePemLocation), passphrase)
if err != nil {
return nil, fmt.Errorf("can not create resource principal, due to: %s ", err.Error())
}
}
var fd federationClient
if isPath(sessionTokenLocation) {
fd, _ = newFileBasedFederationClient(sessionTokenLocation, supplier)
} else {
fd, err = newStaticFederationClient(sessionTokenLocation, supplier)
if err != nil {
return nil, fmt.Errorf("can not create resource principal, due to: %s ", err.Error())
}
}
rs := resourcePrincipalKeyProvider{
FederationClient: fd,
KeyProviderRegion: common.StringToRegion(region),
}
return &rs, nil
}
func (p *resourcePrincipalKeyProvider) 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 *resourcePrincipalKeyProvider) 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
}
func (p *resourcePrincipalKeyProvider) Region() (string, error) {
return string(p.KeyProviderRegion), nil
}
var (
// ErrNonStringClaim is returned if the token has a claim for a key, but it's not a string value
ErrNonStringClaim = errors.New("claim does not have a string value")
)
func (p *resourcePrincipalKeyProvider) TenancyOCID() (string, error) {
if claim, err := p.GetClaim(TenancyOCIDClaimKey); err != nil {
return "", err
} else if tenancy, ok := claim.(string); ok {
return tenancy, nil
} else {
return "", ErrNonStringClaim
}
}
func (p *resourcePrincipalKeyProvider) GetClaim(claim string) (interface{}, error) {
return p.FederationClient.GetClaim(claim)
}
func (p *resourcePrincipalKeyProvider) KeyFingerprint() (string, error) {
return "", nil
}
func (p *resourcePrincipalKeyProvider) UserOCID() (string, error) {
return "", nil
}
// By contract for the the content of a resource principal to be considered path, it needs to be
// an absolute path.
func isPath(str string) bool {
return path.IsAbs(str)
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package auth
@ -15,12 +16,17 @@ import (
// 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) {
func httpGet(dispatcher common.HTTPRequestDispatcher, url string) (body bytes.Buffer, statusCode int, err error) {
var response *http.Response
if response, err = http.Get(url); err != nil {
request, err := http.NewRequest(http.MethodGet, url, nil)
request.Header.Add("Authorization", "Bearer Oracle")
if response, err = dispatcher.Do(request); err != nil {
return
}
statusCode = response.StatusCode
common.IfDebug(func() {
if dump, e := httputil.DumpResponse(response, true); e == nil {
common.Logf("Dump Response %v", string(dump))
@ -34,7 +40,7 @@ func httpGet(url string) (body bytes.Buffer, err error) {
return
}
if response.StatusCode != http.StatusOK {
if statusCode != http.StatusOK {
err = fmt.Errorf("HTTP Get failed: URL: %s, Status: %s, Message: %s",
url, response.Status, body.String())
return

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Package common provides supporting functions and structs used by service packages
package common
@ -59,6 +60,9 @@ const (
// requestHeaderXContentSHA256 The key for passing a header to indicate SHA256 hash
requestHeaderXContentSHA256 = "X-Content-SHA256"
// requestHeaderOpcOboToken The key for passing a header to use obo token
requestHeaderOpcOboToken = "opc-obo-token"
// private constants
defaultScheme = "https"
defaultSDKMarker = "Oracle-GoSDK"
@ -152,6 +156,26 @@ func NewClientWithConfig(configProvider ConfigurationProvider) (client BaseClien
}
client = defaultBaseClient(configProvider)
return
}
// NewClientWithOboToken Create a new client that will use oboToken for auth
func NewClientWithOboToken(configProvider ConfigurationProvider, oboToken string) (client BaseClient, err error) {
client, err = NewClientWithConfig(configProvider)
if err != nil {
return
}
// Interceptor to add obo token header
client.Interceptor = func(request *http.Request) error {
request.Header.Add(requestHeaderOpcOboToken, oboToken)
return nil
}
// Obo token will also be signed
defaultHeaders := append(DefaultGenericHeaders(), requestHeaderOpcOboToken)
client.Signer = RequestSigner(configProvider, defaultHeaders, DefaultBodyHeaders())
return
}
@ -186,6 +210,22 @@ func DefaultConfigProvider() ConfigurationProvider {
return provider
}
// CustomProfileConfigProvider returns the config provider of given profile. The custom profile config provider
// will look for configurations in 2 places: file in $HOME/.oci/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 CustomProfileConfigProvider(customConfigPath string, profile string) ConfigurationProvider {
homeFolder := getHomeFolder()
if customConfigPath == "" {
customConfigPath = path.Join(homeFolder, defaultConfigDirName, defaultConfigFileName)
}
customFileProvider, _ := ConfigurationProviderFromFileWithProfile(customConfigPath, profile, "")
defaultFileProvider, _ := ConfigurationProviderFromFileWithProfile(customConfigPath, "DEFAULT", "")
environmentProvider := environmentConfigurationProvider{EnvironmentVariablePrefix: "TF_VAR"}
provider, _ := ComposingConfigurationProvider([]ConfigurationProvider{customFileProvider, defaultFileProvider, 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")
@ -197,10 +237,6 @@ func (client *BaseClient) prepareRequest(request *http.Request) (err error) {
request.Header.Set(requestHeaderUserAgent, client.UserAgent)
request.Header.Set(requestHeaderDate, time.Now().UTC().Format(http.TimeFormat))
if request.Header.Get(requestHeaderOpcRetryToken) == "" {
request.Header.Set(requestHeaderOpcRetryToken, generateRetryToken())
}
if !strings.Contains(client.Host, "http") &&
!strings.Contains(client.Host, "https") {
client.Host = fmt.Sprintf("%s://%s", defaultScheme, client.Host)
@ -257,8 +293,19 @@ type OCIResponse interface {
// OCIOperation is the generalization of a request-response cycle undergone by an OCI service.
type OCIOperation func(context.Context, OCIRequest) (OCIResponse, error)
//ClientCallDetails a set of settings used by the a single Call operation of the http Client
type ClientCallDetails struct {
Signer HTTPRequestSigner
}
// Call executes the http request with the given context
func (client BaseClient) Call(ctx context.Context, request *http.Request) (response *http.Response, err error) {
return client.CallWithDetails(ctx, request, ClientCallDetails{Signer: client.Signer})
}
// CallWithDetails executes the http request, the given context using details specified in the paremeters, this function
// provides a way to override some settings present in the client
func (client BaseClient) CallWithDetails(ctx context.Context, request *http.Request, details ClientCallDetails) (response *http.Response, err error) {
Debugln("Atempting to call downstream service")
request = request.WithContext(ctx)
@ -274,7 +321,7 @@ func (client BaseClient) Call(ctx context.Context, request *http.Request) (respo
}
//Sign the request
err = client.Signer.Sign(request)
err = details.Signer.Sign(request)
if err != nil {
return
}
@ -282,13 +329,14 @@ func (client BaseClient) Call(ctx context.Context, request *http.Request) (respo
IfDebug(func() {
dumpBody := true
if request.ContentLength > maxBodyLenForDebug {
Logln("not dumping body too big")
Debugf("not dumping body too big\n")
dumpBody = false
}
if dump, e := httputil.DumpRequest(request, dumpBody); e == nil {
Logf("Dump Request %v", string(dump))
dumpBody = dumpBody && defaultLogger.LogLevel() == verboseLogging
if dump, e := httputil.DumpRequestOut(request, dumpBody); e == nil {
Debugf("Dump Request %s", string(dump))
} else {
Debugln(e)
Debugf("%v\n", e)
}
})
@ -297,20 +345,21 @@ func (client BaseClient) Call(ctx context.Context, request *http.Request) (respo
IfDebug(func() {
if err != nil {
Logln(err)
Debugf("%v\n", err)
return
}
dumpBody := true
if response.ContentLength > maxBodyLenForDebug {
Logln("not dumping body too big")
Debugf("not dumping body too big\n")
dumpBody = false
}
dumpBody = dumpBody && defaultLogger.LogLevel() == verboseLogging
if dump, e := httputil.DumpResponse(response, dumpBody); e == nil {
Logf("Dump Response %v", string(dump))
Debugf("Dump Response %s", string(dump))
} else {
Debugln(e)
Debugf("%v\n", e)
}
})

View File

@ -1,8 +1,11 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package common
import (
"fmt"
"regexp"
"strings"
)
@ -12,6 +15,10 @@ type Region string
const (
//RegionSEA region SEA
RegionSEA Region = "sea"
//RegionCAToronto1 region for toronto
RegionCAToronto1 Region = "ca-toronto-1"
//RegionCAMontreal1 region for Montreal
RegionCAMontreal1 Region = "ca-montreal-1"
//RegionPHX region PHX
RegionPHX Region = "us-phoenix-1"
//RegionIAD region IAD
@ -20,13 +27,117 @@ const (
RegionFRA Region = "eu-frankfurt-1"
//RegionLHR region LHR
RegionLHR Region = "uk-london-1"
//RegionAPTokyo1 region for tokyo
RegionAPTokyo1 Region = "ap-tokyo-1"
//RegionAPOsaka1 region for Osaka
RegionAPOsaka1 Region = "ap-osaka-1"
//RegionAPSeoul1 region for seoul
RegionAPSeoul1 Region = "ap-seoul-1"
//RegionAPMumbai1 region for mumbai
RegionAPMumbai1 Region = "ap-mumbai-1"
//RegionAPMelbourne1 region for Melbourne
RegionAPMelbourne1 Region = "ap-melbourne-1"
//RegionAPSydney1 region for Sydney
RegionAPSydney1 Region = "ap-sydney-1"
//RegionMEJeddah1 region for Jeddah
RegionMEJeddah1 Region = "me-jeddah-1"
//RegionEUZurich1 region for Zurich
RegionEUZurich1 Region = "eu-zurich-1"
//RegionEUAmsterdam1 region for Amsterdam
RegionEUAmsterdam1 Region = "eu-amsterdam-1"
//RegionSASaopaulo1 region for Sao Paulo
RegionSASaopaulo1 Region = "sa-saopaulo-1"
//RegionUSLangley1 region for langley
RegionUSLangley1 Region = "us-langley-1"
//RegionUSLuke1 region for luke
RegionUSLuke1 Region = "us-luke-1"
//RegionUSGovAshburn1 region for langley
RegionUSGovAshburn1 Region = "us-gov-ashburn-1"
//RegionUSGovChicago1 region for luke
RegionUSGovChicago1 Region = "us-gov-chicago-1"
//RegionUSGovPhoenix1 region for luke
RegionUSGovPhoenix1 Region = "us-gov-phoenix-1"
//RegionUKGovLondon1 gov region London
RegionUKGovLondon1 Region = "uk-gov-london-1"
)
var realm = map[string]string{
"oc1": "oraclecloud.com",
"oc2": "oraclegovcloud.com",
"oc3": "oraclegovcloud.com",
"oc4": "oraclegovcloud.uk",
}
var regionRealm = map[Region]string{
RegionPHX: "oc1",
RegionIAD: "oc1",
RegionFRA: "oc1",
RegionLHR: "oc1",
RegionCAToronto1: "oc1",
RegionCAMontreal1: "oc1",
RegionAPTokyo1: "oc1",
RegionAPOsaka1: "oc1",
RegionAPSeoul1: "oc1",
RegionAPSydney1: "oc1",
RegionAPMumbai1: "oc1",
RegionAPMelbourne1: "oc1",
RegionMEJeddah1: "oc1",
RegionEUZurich1: "oc1",
RegionEUAmsterdam1: "oc1",
RegionSASaopaulo1: "oc1",
RegionUSLangley1: "oc2",
RegionUSLuke1: "oc2",
RegionUSGovAshburn1: "oc3",
RegionUSGovChicago1: "oc3",
RegionUSGovPhoenix1: "oc3",
RegionUKGovLondon1: "oc4",
}
// Endpoint returns a endpoint for a service
func (region Region) Endpoint(service string) string {
return fmt.Sprintf("%s.%s.%s", service, region, region.secondLevelDomain())
}
// EndpointForTemplate returns a endpoint for a service based on template
func (region Region) EndpointForTemplate(service string, serviceEndpointTemplate string) string {
if serviceEndpointTemplate == "" {
return region.Endpoint(service)
}
// replace service prefix
endpoint := strings.Replace(serviceEndpointTemplate, "{serviceEndpointPrefix}", service, 1)
// replace region
endpoint = strings.Replace(endpoint, "{region}", string(region), 1)
// replace second level domain
endpoint = strings.Replace(endpoint, "{secondLevelDomain}", region.secondLevelDomain(), 1)
return endpoint
}
func (region Region) secondLevelDomain() string {
if realmID, ok := regionRealm[region]; ok {
if secondLevelDomain, ok := realm[realmID]; ok {
return secondLevelDomain
}
}
Debugf("cannot find realm for region : %s, return default realm value.", region)
return realm["oc1"]
}
//StringToRegion convert a string to Region type
func StringToRegion(stringRegion string) (r Region) {
switch strings.ToLower(stringRegion) {
case "sea":
r = RegionSEA
case "yyz", "ca-toronto-1":
r = RegionCAToronto1
case "yul", "ca-montreal-1":
r = RegionCAMontreal1
case "phx", "us-phoenix-1":
r = RegionPHX
case "iad", "us-ashburn-1":
@ -35,9 +146,52 @@ func StringToRegion(stringRegion string) (r Region) {
r = RegionFRA
case "lhr", "uk-london-1":
r = RegionLHR
case "nrt", "ap-tokyo-1":
r = RegionAPTokyo1
case "kix", "ap-osaka-1":
r = RegionAPOsaka1
case "icn", "ap-seoul-1":
r = RegionAPSeoul1
case "bom", "ap-mumbai-1":
r = RegionAPMumbai1
case "mel", "ap-melbourne-1":
r = RegionAPMelbourne1
case "syd", "ap-sydney-1":
r = RegionAPSydney1
case "jed", "me-jeddah-1":
r = RegionMEJeddah1
case "zrh", "eu-zurich-1":
r = RegionEUZurich1
case "ams", "eu-amsterdam-1":
r = RegionEUAmsterdam1
case "gru", "sa-saopaulo-1":
r = RegionSASaopaulo1
case "us-langley-1":
r = RegionUSLangley1
case "us-luke-1":
r = RegionUSLuke1
case "us-gov-ashburn-1":
r = RegionUSGovAshburn1
case "us-gov-chicago-1":
r = RegionUSGovChicago1
case "us-gov-phoenix-1":
r = RegionUSGovPhoenix1
case "ltn", "uk-gov-london-1":
r = RegionUKGovLondon1
default:
r = Region(stringRegion)
Debugf("region named: %s, is not recognized", stringRegion)
}
return
}
// canStringBeRegion test if the string can be a region, if it can, returns the string as is, otherwise it
// returns an error
var blankRegex = regexp.MustCompile("\\s")
func canStringBeRegion(stringRegion string) (region string, err error) {
if blankRegex.MatchString(stringRegion) || stringRegion == "" {
return "", fmt.Errorf("region can not be empty or have spaces")
}
return stringRegion, nil
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package common
@ -51,7 +52,7 @@ type rawConfigurationProvider struct {
privateKeyPassphrase *string
}
// NewRawConfigurationProvider will create a rawConfigurationProvider
// NewRawConfigurationProvider will create a ConfigurationProvider with the arguments of the function
func NewRawConfigurationProvider(tenancy, user, region, fingerprint, privateKey string, privateKeyPassphrase *string) ConfigurationProvider {
return rawConfigurationProvider{tenancy, user, region, fingerprint, privateKey, privateKeyPassphrase}
}
@ -80,19 +81,28 @@ func (p rawConfigurationProvider) KeyID() (keyID string, err error) {
}
func (p rawConfigurationProvider) TenancyOCID() (string, error) {
if p.tenancy == "" {
return "", fmt.Errorf("tenancy OCID can not be empty")
}
return p.tenancy, nil
}
func (p rawConfigurationProvider) UserOCID() (string, error) {
if p.user == "" {
return "", fmt.Errorf("user OCID can not be empty")
}
return p.user, nil
}
func (p rawConfigurationProvider) KeyFingerprint() (string, error) {
if p.fingerprint == "" {
return "", fmt.Errorf("fingerprint can not be empty")
}
return p.fingerprint, nil
}
func (p rawConfigurationProvider) Region() (string, error) {
return p.region, nil
return canStringBeRegion(p.region)
}
// environmentConfigurationProvider reads configuration from environment variables
@ -183,8 +193,10 @@ func (p environmentConfigurationProvider) Region() (value string, err error) {
var ok bool
if value, ok = os.LookupEnv(environmentVariable); !ok {
err = fmt.Errorf("can not read region from environment variable %s", environmentVariable)
return value, err
}
return
return canStringBeRegion(value)
}
// fileConfigurationProvider. reads configuration information from a file
@ -310,7 +322,7 @@ func parseConfigAtLine(start int, content []string) (info *configFileInfo, err e
func expandPath(filepath string) (expandedPath string) {
cleanedPath := path.Clean(filepath)
expandedPath = cleanedPath
if strings.HasPrefix(cleanedPath, "~/") {
if strings.HasPrefix(cleanedPath, "~") {
rest := cleanedPath[2:]
expandedPath = path.Join(getHomeFolder(), rest)
}
@ -436,7 +448,11 @@ func (p fileConfigurationProvider) Region() (value string, err error) {
}
value, err = presentOrError(info.Region, hasRegion, info.PresentConfiguration, "region")
return
if err != nil {
return
}
return canStringBeRegion(value)
}
// A configuration provider that look for information in multiple configuration providers

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package common
@ -18,45 +19,48 @@ type ServiceError interface {
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
// See https://docs.cloud.oracle.com/Content/API/References/apierrors.htm
GetCode() string
// Unique Oracle-assigned identifier for the request.
// If you need to contact Oracle about a particular request, please provide the request ID.
GetOpcRequestID() string
}
type servicefailure struct {
StatusCode int
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
StatusCode int
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
OpcRequestID string `json:"opc-request-id"`
}
func newServiceFailureFromResponse(response *http.Response) error {
var err error
se := servicefailure{
StatusCode: response.StatusCode,
Code: "BadErrorResponse",
OpcRequestID: response.Header.Get("opc-request-id")}
//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.Message = fmt.Sprintf("The body of the response was not readable, due to :%s", err.Error())
return se
}
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"),
}
se.Message = fmt.Sprintf("Failed to parse json from response body due to: %s. With response body %s.", err.Error(), string(body[:]))
return se
}
return se
}
func (se servicefailure) Error() string {
return fmt.Sprintf("Service error:%s. %s. http status code: %d",
se.Code, se.Message, se.StatusCode)
return fmt.Sprintf("Service error:%s. %s. http status code: %d. Opc request id: %s",
se.Code, se.Message, se.StatusCode, se.OpcRequestID)
}
func (se servicefailure) GetHTTPStatusCode() int {
@ -72,6 +76,10 @@ func (se servicefailure) GetCode() string {
return se.Code
}
func (se servicefailure) GetOpcRequestID() string {
return se.OpcRequestID
}
// 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) {

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package common
@ -9,6 +10,7 @@ import (
"encoding/pem"
"fmt"
"reflect"
"strconv"
"strings"
"time"
)
@ -23,6 +25,11 @@ func Int(value int) *int {
return &value
}
// Int64 returns a pointer to the provided int64
func Int64(value int64) *int64 {
return &value
}
// Uint returns a pointer to the provided uint
func Uint(value uint) *uint {
return &value
@ -76,15 +83,33 @@ func PointerString(datastruct interface{}) (representation string) {
return
}
// SDKTime a time struct, which renders to/from json using RFC339
// SDKTime a struct that parses/renders to/from json using RFC339 date-time information
type SDKTime struct {
time.Time
}
// SDKDate a struct that parses/renders to/from json using only date information
type SDKDate struct {
//Date date information
Date time.Time
}
func sdkTimeFromTime(t time.Time) SDKTime {
return SDKTime{t}
}
func sdkDateFromTime(t time.Time) SDKDate {
return SDKDate{Date: t}
}
func formatTime(t SDKTime) string {
return t.Format(sdkTimeFormat)
}
func formatDate(t SDKDate) string {
return t.Date.Format(sdkDateFormat)
}
func now() *SDKTime {
t := SDKTime{time.Now()}
return &t
@ -93,19 +118,19 @@ func now() *SDKTime {
var timeType = reflect.TypeOf(SDKTime{})
var timeTypePtr = reflect.TypeOf(&SDKTime{})
const sdkTimeFormat = time.RFC3339
var sdkDateType = reflect.TypeOf(SDKDate{})
var sdkDateTypePtr = reflect.TypeOf(&SDKDate{})
//Formats for sdk supported time representations
const sdkTimeFormat = time.RFC3339Nano
const rfc1123OptionalLeadingDigitsInDay = "Mon, _2 Jan 2006 15:04:05 MST"
func formatTime(t SDKTime) string {
return t.Format(sdkTimeFormat)
}
const sdkDateFormat = "2006-01-02"
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)
t, err = tryParsing(data, time.RFC3339Nano, time.RFC3339, time.RFC1123, rfc1123OptionalLeadingDigitsInDay, time.RFC850, time.ANSIC)
return
default: //By default we parse with RFC3339
t, err = time.Parse(sdkTimeFormat, string(data))
@ -125,6 +150,21 @@ func tryParsing(data []byte, layouts ...string) (tm time.Time, err error) {
return
}
// String returns string representation of SDKDate
func (t *SDKDate) String() string {
return t.Date.Format(sdkDateFormat)
}
// NewSDKDateFromString parses the dateString into SDKDate
func NewSDKDateFromString(dateString string) (*SDKDate, error) {
parsedTime, err := time.Parse(sdkDateFormat, dateString)
if err != nil {
return nil, err
}
return &SDKDate{Date: parsedTime}, nil
}
// UnmarshalJSON unmarshals from json
func (t *SDKTime) UnmarshalJSON(data []byte) (e error) {
s := string(data)
@ -144,17 +184,48 @@ func (t *SDKTime) MarshalJSON() (buff []byte, e error) {
return
}
// UnmarshalJSON unmarshals from json
func (t *SDKDate) UnmarshalJSON(data []byte) (e error) {
if string(data) == `"null"` {
t.Date = time.Time{}
return
}
t.Date, e = tryParsing(data,
strconv.Quote(sdkDateFormat),
)
return
}
// MarshalJSON marshals to JSON
func (t *SDKDate) MarshalJSON() (buff []byte, e error) {
s := t.Date.Format(sdkDateFormat)
buff = []byte(strconv.Quote(s))
return
}
// PrivateKeyFromBytes is a helper function that will produce a RSA private
// key from bytes.
// key from bytes. This function is deprecated in favour of PrivateKeyFromBytesWithPassword
// Deprecated
func PrivateKeyFromBytes(pemData []byte, password *string) (key *rsa.PrivateKey, e error) {
if password == nil {
return PrivateKeyFromBytesWithPassword(pemData, nil)
}
return PrivateKeyFromBytesWithPassword(pemData, []byte(*password))
}
// PrivateKeyFromBytesWithPassword is a helper function that will produce a RSA private
// key from bytes and a password.
func PrivateKeyFromBytesWithPassword(pemData, password []byte) (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")
e = fmt.Errorf("private key password is required for encrypted private keys")
return
}
if decrypted, e = x509.DecryptPEMBlock(pemBlock, []byte(*password)); e != nil {
if decrypted, e = x509.DecryptPEMBlock(pemBlock, password); e != nil {
return
}
}
@ -178,3 +249,9 @@ func generateRandUUID() (string, error) {
return uuid, nil
}
func makeACopy(original []string) []string {
tmp := make([]string, len(original))
copy(tmp, original)
return tmp
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package common
@ -10,7 +11,6 @@ import (
"io/ioutil"
"net/http"
"net/url"
"path"
"reflect"
"regexp"
"strconv"
@ -43,6 +43,11 @@ func toStringValue(v reflect.Value, field reflect.StructField) (string, error) {
return formatTime(t), nil
}
if v.Type() == sdkDateType {
t := v.Interface().(SDKDate)
return formatDate(t), nil
}
switch v.Kind() {
case reflect.Bool:
return strconv.FormatBool(v.Bool()), nil
@ -53,19 +58,24 @@ func toStringValue(v reflect.Value, field reflect.StructField) (string, error) {
case reflect.String:
return v.String(), nil
case reflect.Float32:
return strconv.FormatFloat(v.Float(), 'f', 6, 32), nil
return strconv.FormatFloat(v.Float(), 'f', -1, 32), nil
case reflect.Float64:
return strconv.FormatFloat(v.Float(), 'f', 6, 64), nil
return strconv.FormatFloat(v.Float(), 'f', -1, 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) {
func addBinaryBody(request *http.Request, value reflect.Value, field reflect.StructField) (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")
isMandatory, err := strconv.ParseBool(field.Tag.Get("mandatory"))
if err != nil {
return fmt.Errorf("mandatory tag is not valid for field %s", field.Name)
}
if isMandatory && !ok {
e = fmt.Errorf("body of the request is mandatory and needs to be an io.ReadCloser interface. Can not marshal body of binary request")
return
}
@ -166,7 +176,8 @@ func omitNilFieldsInJSON(data interface{}, value reflect.Value) (interface{}, er
continue
}
if currentFieldValue.Type() == timeType || currentFieldValue.Type() == timeTypePtr {
if currentFieldValue.Type() == timeType || currentFieldValue.Type() == timeTypePtr ||
currentField.Type == sdkDateType || currentField.Type == sdkDateTypePtr {
continue
}
// does it need to be adjusted?
@ -180,7 +191,14 @@ func omitNilFieldsInJSON(data interface{}, value reflect.Value) (interface{}, er
}
return jsonMap, nil
case reflect.Slice, reflect.Array:
jsonList := data.([]interface{})
// Special case: a []byte may have been marshalled as a string
if data != nil && reflect.TypeOf(data).Kind() == reflect.String && value.Type().Elem().Kind() == reflect.Uint8 {
return data, nil
}
jsonList, ok := data.([]interface{})
if !ok {
return nil, fmt.Errorf("can not omit nil fields, data was expected to be a not-nil list")
}
newList := make([]interface{}, len(jsonList))
var err error
for i, val := range jsonList {
@ -191,7 +209,10 @@ func omitNilFieldsInJSON(data interface{}, value reflect.Value) (interface{}, er
}
return newList, nil
case reflect.Map:
jsonMap := data.(map[string]interface{})
jsonMap, ok := data.(map[string]interface{})
if !ok {
return nil, fmt.Errorf("can not omit nil fields, data was expected to be a not-nil map")
}
newMap := make(map[string]interface{}, len(jsonMap))
var err error
for key, val := range jsonMap {
@ -213,9 +234,15 @@ func omitNilFieldsInJSON(data interface{}, value reflect.Value) (interface{}, er
// 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)
var rawInterface interface{}
decoder := json.NewDecoder(bytes.NewBuffer(rawJSON))
decoder.UseNumber()
var err error
if err = decoder.Decode(&rawInterface); err != nil {
return nil, err
}
fixedMap, err := omitNilFieldsInJSON(rawInterface, value)
if err != nil {
return nil, err
}
@ -225,13 +252,13 @@ func removeNilFieldsInJSONWithTaggedStruct(rawJSON []byte, value reflect.Value)
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")
Logf("The body of the request is already set. Structure: %s will overwrite it\n", field.Name)
}
tag := field.Tag
encoding := tag.Get("encoding")
if encoding == "binary" {
return addBinaryBody(request, value)
return addBinaryBody(request, value, field)
}
rawJSON, e := json.Marshal(value.Interface())
@ -242,7 +269,11 @@ func addToBody(request *http.Request, value reflect.Value, field reflect.StructF
if e != nil {
return
}
Debugf("Marshaled body is: %s", string(marshaled))
if defaultLogger.LogLevel() == verboseLogging {
Debugf("Marshaled body is: %s\n", string(marshaled))
}
bodyBytes := bytes.NewReader(marshaled)
request.ContentLength = int64(bodyBytes.Len())
request.Header.Set(requestHeaderContentLength, strconv.FormatInt(request.ContentLength, 10))
@ -255,7 +286,7 @@ func addToBody(request *http.Request, value reflect.Value, field reflect.StructF
}
func addToQuery(request *http.Request, value reflect.Value, field reflect.StructField) (e error) {
Debugln("Marshaling to query from field:", field.Name)
Debugln("Marshaling to query from field: ", field.Name)
if request.URL == nil {
request.URL = &url.URL{}
}
@ -356,8 +387,7 @@ func addToPath(request *http.Request, value reflect.Value, field reflect.StructF
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)
request.URL.Path = strings.Join(allPath, "/")
} else {
var fieldName string
if fieldName = field.Tag.Get("name"); fieldName == "" {
@ -365,8 +395,8 @@ func addToPath(request *http.Request, value reflect.Value, field reflect.StructF
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))
Debugln("Marshaling to path from field: ", field.Name, " in template: ", urlTemplate)
request.URL.Path = strings.Replace(urlTemplate, "{"+fieldName+"}", additionalURLPathPart, -1)
}
return
}
@ -385,7 +415,7 @@ func setWellKnownHeaders(request *http.Request, headerName, headerValue string)
}
func addToHeader(request *http.Request, value reflect.Value, field reflect.StructField) (e error) {
Debugln("Marshaling to header from field:", field.Name)
Debugln("Marshaling to header from field: ", field.Name)
if request.Header == nil {
request.Header = http.Header{}
}
@ -419,7 +449,7 @@ func addToHeader(request *http.Request, value reflect.Value, field reflect.Struc
return
}
request.Header.Set(headerName, headerValue)
request.Header.Add(headerName, headerValue)
return
}
@ -512,7 +542,7 @@ func structToRequestPart(request *http.Request, val reflect.Value) (err error) {
case "body":
err = addToBody(request, sv, sf)
case "":
Debugln(sf.Name, "does not contain contributes tag. Skipping.")
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)
}
@ -544,7 +574,7 @@ func HTTPRequestMarshaller(requestStruct interface{}, httpRequest *http.Request)
return
}
Debugln("Marshaling to Request:", val.Type().Name())
Debugln("Marshaling to Request: ", val.Type().Name())
err = structToRequestPart(httpRequest, *val)
return
}
@ -617,7 +647,7 @@ func intSizeFromKind(kind reflect.Kind) int {
case reflect.Int, reflect.Uint:
return strconv.IntSize
default:
Debugln("The type is not valid: %v. Returing int size for arch", kind.String())
Debugf("The type is not valid: %v. Returing int size for arch\n", kind.String())
return strconv.IntSize
}
@ -635,6 +665,16 @@ func analyzeValue(stringValue string, kind reflect.Kind, field reflect.StructFie
val = reflect.ValueOf(sdkTime)
valPointer = reflect.ValueOf(&sdkTime)
return
case sdkDateType.Kind():
var t time.Time
t, err = tryParsingTimeWithValidFormatsForHeaders([]byte(stringValue), field.Name)
if err != nil {
return
}
sdkDate := sdkDateFromTime(t)
val = reflect.ValueOf(sdkDate)
valPointer = reflect.ValueOf(&sdkDate)
return
case reflect.Bool:
var bVal bool
if bVal, err = strconv.ParseBool(stringValue); err != nil {
@ -763,7 +803,7 @@ func valueFromJSONBody(response *http.Response, value *reflect.Value, unmarshale
}
func addFromBody(response *http.Response, value *reflect.Value, field reflect.StructField, unmarshaler PolymorphicJSONUnmarshaler) (err error) {
Debugln("Unmarshaling from body to field:", field.Name)
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
@ -801,7 +841,7 @@ func addFromBody(response *http.Response, value *reflect.Value, field reflect.St
}
func addFromHeader(response *http.Response, value *reflect.Value, field reflect.StructField) (err error) {
Debugln("Unmarshaling from header to field:", field.Name)
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)
@ -866,7 +906,7 @@ func responseToStruct(response *http.Response, val *reflect.Value, unmarshaler P
case "body":
err = addFromBody(response, &sv, sf, unmarshaler)
case "":
Debugln(sf.Name, "does not contain presentIn tag. Skipping")
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)
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package common
@ -50,6 +51,16 @@ var (
}
)
// DefaultGenericHeaders list of default generic headers that is used in signing
func DefaultGenericHeaders() []string {
return makeACopy(defaultGenericHeaders)
}
// DefaultBodyHeaders list of default body headers that is used in signing
func DefaultBodyHeaders() []string {
return makeACopy(defaultBodyHeaders)
}
// DefaultRequestSigner creates a signer with default parameters.
func DefaultRequestSigner(provider KeyProvider) HTTPRequestSigner {
return RequestSigner(provider, defaultGenericHeaders, defaultBodyHeaders)
@ -64,6 +75,22 @@ func RequestSignerExcludeBody(provider KeyProvider) HTTPRequestSigner {
return RequestSignerWithBodyHashingPredicate(provider, defaultGenericHeaders, defaultBodyHeaders, bodyHashPredicate)
}
// NewSignerFromOCIRequestSigner creates a copy of the request signer and attaches the new SignerBodyHashPredicate
// returns an error if the passed signer is not of type ociRequestSigner
func NewSignerFromOCIRequestSigner(oldSigner HTTPRequestSigner, predicate SignerBodyHashPredicate) (HTTPRequestSigner, error) {
if oldS, ok := oldSigner.(ociRequestSigner); ok {
s := ociRequestSigner{
KeyProvider: oldS.KeyProvider,
GenericHeaders: oldS.GenericHeaders,
BodyHeaders: oldS.BodyHeaders,
ShouldHashBody: predicate,
}
return s, nil
}
return nil, fmt.Errorf("can not create a signer, input signer needs to be of type ociRequestSigner")
}
// 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 {
@ -100,6 +127,7 @@ func (signer ociRequestSigner) getSigningString(request *http.Request) string {
signingParts := make([]string, len(signingHeaders))
for i, part := range signingHeaders {
var value string
part = strings.ToLower(part)
switch part {
case "(request-target)":
value = getRequestTarget(request)
@ -126,13 +154,9 @@ func getRequestTarget(request *http.Request) string {
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(""))
hash, err = GetBodyHash(request)
if err != nil {
return
}
request.Header.Set(requestHeaderXContentSHA256, hash)
return
@ -167,7 +191,9 @@ func hashAndEncode(data []byte) string {
// 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?")
request.ContentLength = 0
request.Header.Set(requestHeaderContentLength, fmt.Sprintf("%v", request.ContentLength))
return hashAndEncode([]byte("")), nil
}
var data []byte
@ -181,6 +207,11 @@ func GetBodyHash(request *http.Request) (hashString string, err error) {
if err != nil {
return "", fmt.Errorf("can not read body of request while calculating body hash: %s", err.Error())
}
// Since the request can be coming from a binary body. Make an attempt to set the body length
request.ContentLength = int64(len(data))
request.Header.Set(requestHeaderContentLength, fmt.Sprintf("%v", request.ContentLength))
hashString = hashAndEncode(data)
return
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
package common
@ -7,58 +8,164 @@ import (
"io/ioutil"
"log"
"os"
"strings"
"sync"
)
// Simple logging proxy to distinguish control for logging messages
//sdkLogger an interface for logging in the SDK
type sdkLogger interface {
//LogLevel returns the log level of sdkLogger
LogLevel() int
//Log logs v with the provided format if the current log level is loglevel
Log(logLevel int, format string, v ...interface{}) error
}
//noLogging no logging messages
const noLogging = 0
//infoLogging minimal logging messages
const infoLogging = 1
//debugLogging some logging messages
const debugLogging = 2
//verboseLogging all logging messages
const verboseLogging = 3
//defaultSDKLogger the default implementation of the sdkLogger
type defaultSDKLogger struct {
currentLoggingLevel int
verboseLogger *log.Logger
debugLogger *log.Logger
infoLogger *log.Logger
nullLogger *log.Logger
}
//defaultLogger is the defaultLogger in the SDK
var defaultLogger sdkLogger
var loggerLock sync.Mutex
//initializes the SDK defaultLogger as a defaultLogger
func init() {
l, _ := newSDKLogger()
setSDKLogger(l)
}
//setSDKLogger sets the logger used by the sdk
func setSDKLogger(logger sdkLogger) {
loggerLock.Lock()
defaultLogger = logger
loggerLock.Unlock()
}
// newSDKLogger creates a defaultSDKLogger
// 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
// The value of the "OCI_GO_SDK_DEBUG" environment variable controls the logging level.
// "null" outputs no log messages
// "i" or "info" outputs minimal log messages
// "d" or "debug" outputs some logs messages
// "v" or "verbose" outputs all logs messages, including body of requests
func newSDKLogger() (defaultSDKLogger, error) {
logger := defaultSDKLogger{}
func setOutputForEnv() {
checkDebug.Do(func() {
isDebugLogEnabled = *new(bool)
_, isDebugLogEnabled = os.LookupEnv("OCI_GO_SDK_DEBUG")
logger.currentLoggingLevel = noLogging
logger.verboseLogger = log.New(os.Stderr, "VERBOSE ", log.Ldate|log.Lmicroseconds|log.Lshortfile)
logger.debugLogger = log.New(os.Stderr, "DEBUG ", log.Ldate|log.Lmicroseconds|log.Lshortfile)
logger.infoLogger = log.New(os.Stderr, "INFO ", log.Ldate|log.Lmicroseconds|log.Lshortfile)
logger.nullLogger = log.New(ioutil.Discard, "", log.Ldate|log.Lmicroseconds|log.Lshortfile)
if !isDebugLogEnabled {
debugLog.SetOutput(ioutil.Discard)
configured, isLogEnabled := os.LookupEnv("OCI_GO_SDK_DEBUG")
// If env variable not present turn logging of
if !isLogEnabled {
logger.currentLoggingLevel = noLogging
} else {
switch strings.ToLower(configured) {
case "null":
logger.currentLoggingLevel = noLogging
break
case "i", "info":
logger.currentLoggingLevel = infoLogging
break
case "d", "debug":
logger.currentLoggingLevel = debugLogging
break
//1 here for backwards compatibility
case "v", "verbose", "1":
logger.currentLoggingLevel = verboseLogging
break
default:
logger.currentLoggingLevel = infoLogging
}
})
logger.infoLogger.Println("logger level set to: ", logger.currentLoggingLevel)
}
return logger, nil
}
// Debugf logs v with the provided format if debug mode is set
func Debugf(format string, v ...interface{}) {
setOutputForEnv()
debugLog.Output(3, fmt.Sprintf(format, v...))
}
func (l defaultSDKLogger) getLoggerForLevel(logLevel int) *log.Logger {
if logLevel > l.currentLoggingLevel {
return l.nullLogger
}
// Debug logs v if debug mode is set
func Debug(v ...interface{}) {
setOutputForEnv()
debugLog.Output(3, fmt.Sprint(v...))
}
// Debugln logs v appending a new line if debug mode is set
func Debugln(v ...interface{}) {
setOutputForEnv()
debugLog.Output(3, fmt.Sprintln(v...))
}
// IfDebug executes closure if debug is enabled
func IfDebug(fn func()) {
if isDebugLogEnabled {
fn()
switch logLevel {
case noLogging:
return l.nullLogger
case infoLogging:
return l.infoLogger
case debugLogging:
return l.debugLogger
case verboseLogging:
return l.verboseLogger
default:
return l.nullLogger
}
}
// Logln logs v appending a new line at the end
//LogLevel returns the current debug level
func (l defaultSDKLogger) LogLevel() int {
return l.currentLoggingLevel
}
func (l defaultSDKLogger) Log(logLevel int, format string, v ...interface{}) error {
logger := l.getLoggerForLevel(logLevel)
logger.Output(4, fmt.Sprintf(format, v...))
return nil
}
//Logln logs v appending a new line at the end
//Deprecated
func Logln(v ...interface{}) {
mainLog.Output(3, fmt.Sprintln(v...))
defaultLogger.Log(infoLogging, "%v\n", v...)
}
// Logf logs v with the provided format
func Logf(format string, v ...interface{}) {
mainLog.Output(3, fmt.Sprintf(format, v...))
defaultLogger.Log(infoLogging, format, v...)
}
// Debugf logs v with the provided format if debug mode is set
func Debugf(format string, v ...interface{}) {
defaultLogger.Log(debugLogging, format, v...)
}
// Debug logs v if debug mode is set
func Debug(v ...interface{}) {
m := fmt.Sprint(v...)
defaultLogger.Log(debugLogging, "%s", m)
}
// Debugln logs v appending a new line if debug mode is set
func Debugln(v ...interface{}) {
m := fmt.Sprint(v...)
defaultLogger.Log(debugLogging, "%s\n", m)
}
// IfDebug executes closure if debug is enabled
func IfDebug(fn func()) {
if defaultLogger.LogLevel() >= debugLogging {
fn()
}
}

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"math/rand"
"runtime"
"time"
)
@ -12,7 +13,7 @@ const (
UnlimitedNumAttemptsValue = uint(0)
// number of characters contained in the generated retry token
generatedRetryTokenLength = 30
generatedRetryTokenLength = 32
)
// OCIRetryableRequest represents a request that can be reissued according to the specified policy.
@ -86,8 +87,8 @@ func shouldContinueIssuingRequests(current, maximum uint) bool {
return maximum == UnlimitedNumAttemptsValue || current <= maximum
}
// generateRetryToken generates a retry token that must be included on any request passed to the Retry method.
func generateRetryToken() string {
// RetryToken generates a retry token that must be included on any request passed to the Retry method.
func RetryToken() string {
alphanumericChars := []rune("abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")
retryToken := make([]rune, generatedRetryTokenLength)
for i := range retryToken {
@ -98,42 +99,61 @@ func generateRetryToken() string {
// Retry is a package-level operation that executes the retryable request using the specified operation and retry policy.
func Retry(ctx context.Context, request OCIRetryableRequest, operation OCIOperation, policy RetryPolicy) (OCIResponse, error) {
// use a one-based counter because it's easier to think about operation retry in terms of attempt numbering
for currentOperationAttempt := uint(1); shouldContinueIssuingRequests(currentOperationAttempt, policy.MaximumNumberAttempts); currentOperationAttempt++ {
Debugln(fmt.Sprintf("operation attempt #%v", currentOperationAttempt))
response, err := operation(ctx, request)
operationResponse := NewOCIOperationResponse(response, err, currentOperationAttempt)
select {
case <-ctx.Done():
// return why the request was aborted (could be user interrupted or deadline exceeded)
// => include last received response for information (user may choose to re-issue request)
return response, ctx.Err()
default:
// non-blocking select
}
if policy.ShouldRetryOperation(operationResponse) {
// this conditional is explicitly not added to the encompassing if condition to retry based on response
// => it is only to determine if, on the last round of this loop, we still skip sleeping (if we're the
// last attempt, then there's no point sleeping before we round the loop again and fall out to the
// Maximum Number Attempts exceeded error)
if currentOperationAttempt != policy.MaximumNumberAttempts {
// sleep before retrying the operation
duration := policy.NextDuration(operationResponse)
if deadline, ok := ctx.Deadline(); ok && time.Now().Add(duration).After(deadline) {
// we want to retry the operation, but the policy is telling us to wait for a duration that exceeds
// the specified overall deadline for the operation => instead of waiting for however long that
// time period is and then aborting, abort now and save the cycles
return response, DeadlineExceededByBackoff
}
Debugln(fmt.Sprintf("waiting %v before retrying operation", duration))
time.Sleep(duration)
}
} else {
// we should NOT retry operation based on response and/or error => return
return response, err
}
type retrierResult struct {
response OCIResponse
err error
}
var response OCIResponse
var err error
retrierChannel := make(chan retrierResult)
go func() {
// Deal with panics more graciously
defer func() {
if r := recover(); r != nil {
stackBuffer := make([]byte, 1024)
bytesWritten := runtime.Stack(stackBuffer, false)
stack := string(stackBuffer[:bytesWritten])
retrierChannel <- retrierResult{nil, fmt.Errorf("panicked while retrying operation. Panic was: %s\nStack: %s", r, stack)}
}
}()
// use a one-based counter because it's easier to think about operation retry in terms of attempt numbering
for currentOperationAttempt := uint(1); shouldContinueIssuingRequests(currentOperationAttempt, policy.MaximumNumberAttempts); currentOperationAttempt++ {
Debugln(fmt.Sprintf("operation attempt #%v", currentOperationAttempt))
response, err = operation(ctx, request)
operationResponse := NewOCIOperationResponse(response, err, currentOperationAttempt)
if !policy.ShouldRetryOperation(operationResponse) {
// we should NOT retry operation based on response and/or error => return
retrierChannel <- retrierResult{response, err}
return
}
duration := policy.NextDuration(operationResponse)
//The following condition is kept for backwards compatibility reasons
if deadline, ok := ctx.Deadline(); ok && time.Now().Add(duration).After(deadline) {
// we want to retry the operation, but the policy is telling us to wait for a duration that exceeds
// the specified overall deadline for the operation => instead of waiting for however long that
// time period is and then aborting, abort now and save the cycles
retrierChannel <- retrierResult{response, DeadlineExceededByBackoff}
return
}
Debugln(fmt.Sprintf("waiting %v before retrying operation", duration))
// sleep before retrying the operation
<-time.After(duration)
}
retrierChannel <- retrierResult{response, err}
}()
select {
case <-ctx.Done():
return response, ctx.Err()
case result := <-retrierChannel:
return result.response, result.err
}
return nil, fmt.Errorf("maximum number of attempts exceeded (%v)", policy.MaximumNumberAttempts)
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated by go generate; DO NOT EDIT
package common
@ -10,8 +11,8 @@ import (
)
const (
major = "1"
minor = "8"
major = "18"
minor = "0"
patch = "0"
tag = ""
)
@ -26,7 +27,7 @@ func Version() string {
verBuilder := bytes.NewBufferString(ver)
if tag != "" && tag != "-" {
_, err := verBuilder.WriteString(tag)
if err == nil {
if err != nil {
verBuilder = bytes.NewBufferString(ver)
}
}

View File

@ -0,0 +1,27 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AddImageShapeCompatibilityEntryDetails Image shape compatibility details.
type AddImageShapeCompatibilityEntryDetails struct {
OcpuConstraints *ImageOcpuConstraints `mandatory:"false" json:"ocpuConstraints"`
}
func (m AddImageShapeCompatibilityEntryDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,68 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// AddImageShapeCompatibilityEntryRequest wrapper for the AddImageShapeCompatibilityEntry operation
type AddImageShapeCompatibilityEntryRequest struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the image.
ImageId *string `mandatory:"true" contributesTo:"path" name:"imageId"`
// Shape name.
ShapeName *string `mandatory:"true" contributesTo:"path" name:"shapeName"`
// Image shape compatibility details
AddImageShapeCompatibilityEntryDetails `contributesTo:"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 `mandatory:"false" contributesTo:"header" name:"opc-request-id"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request AddImageShapeCompatibilityEntryRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request AddImageShapeCompatibilityEntryRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request AddImageShapeCompatibilityEntryRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// AddImageShapeCompatibilityEntryResponse wrapper for the AddImageShapeCompatibilityEntry operation
type AddImageShapeCompatibilityEntryResponse struct {
// The underlying http response
RawResponse *http.Response
// The ImageShapeCompatibilityEntry instance
ImageShapeCompatibilityEntry `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 AddImageShapeCompatibilityEntryResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response AddImageShapeCompatibilityEntryResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AddNetworkSecurityGroupSecurityRulesDetails The representation of AddNetworkSecurityGroupSecurityRulesDetails
type AddNetworkSecurityGroupSecurityRulesDetails struct {
// The NSG security rules to add.
SecurityRules []AddSecurityRuleDetails `mandatory:"false" json:"securityRules"`
}
func (m AddNetworkSecurityGroupSecurityRulesDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,65 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// AddNetworkSecurityGroupSecurityRulesRequest wrapper for the AddNetworkSecurityGroupSecurityRules operation
type AddNetworkSecurityGroupSecurityRulesRequest struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the network security group.
NetworkSecurityGroupId *string `mandatory:"true" contributesTo:"path" name:"networkSecurityGroupId"`
// Request with one or more security rules to be associated with the network security group.
AddNetworkSecurityGroupSecurityRulesDetails `contributesTo:"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 `mandatory:"false" contributesTo:"header" name:"opc-request-id"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request AddNetworkSecurityGroupSecurityRulesRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request AddNetworkSecurityGroupSecurityRulesRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request AddNetworkSecurityGroupSecurityRulesRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// AddNetworkSecurityGroupSecurityRulesResponse wrapper for the AddNetworkSecurityGroupSecurityRules operation
type AddNetworkSecurityGroupSecurityRulesResponse struct {
// The underlying http response
RawResponse *http.Response
// The AddedNetworkSecurityGroupSecurityRules instance
AddedNetworkSecurityGroupSecurityRules `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 AddNetworkSecurityGroupSecurityRulesResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response AddNetworkSecurityGroupSecurityRulesResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,184 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AddSecurityRuleDetails A rule for allowing inbound (INGRESS) or outbound (EGRESS) IP packets.
type AddSecurityRuleDetails struct {
// Direction of the security rule. Set to `EGRESS` for rules to allow outbound IP packets, or `INGRESS` for rules to allow inbound IP packets.
Direction AddSecurityRuleDetailsDirectionEnum `mandatory:"true" json:"direction"`
// 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"), UDP ("17"), and ICMPv6 ("58").
Protocol *string `mandatory:"true" json:"protocol"`
// An optional description of your choice for the rule. Avoid entering confidential information.
Description *string `mandatory:"false" json:"description"`
// Conceptually, this is the range of IP addresses that a packet originating from the instance
// can go to.
// Allowed values:
// * An IP address range in CIDR notation. For example: `192.168.1.0/24` or `2001:0db8:0123:45::/56`
// Note that IPv6 addressing is currently supported only in certain regions. See
// IPv6 Addresses (https://docs.cloud.oracle.com/Content/Network/Concepts/ipv6.htm).
// * The `cidrBlock` value for a Service, if you're
// setting up a security rule for traffic destined for a particular `Service` through
// a service gateway. For example: `oci-phx-objectstorage`.
// * The OCID of a NetworkSecurityGroup in the same
// VCN. The value can be the NSG that the rule belongs to if the rule's intent is to control
// traffic between VNICs in the same NSG.
Destination *string `mandatory:"false" json:"destination"`
// Type of destination for the rule. Required if `direction` = `EGRESS`.
// Allowed values:
// * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation.
// * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a
// Service (the rule is for traffic destined for a
// particular `Service` through a service gateway).
// * `NETWORK_SECURITY_GROUP`: If the rule's `destination` is the OCID of a
// NetworkSecurityGroup.
DestinationType AddSecurityRuleDetailsDestinationTypeEnum `mandatory:"false" json:"destinationType,omitempty"`
// Optional and valid only for ICMP and ICMPv6. Use to specify a particular ICMP type and code
// as defined in:
// - ICMP Parameters (http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml)
// - ICMPv6 Parameters (https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml)
// If you specify ICMP or ICMPv6 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 via IPv4, 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"`
// Conceptually, this is the range of IP addresses that a packet coming into the instance
// can come from.
// Allowed values:
// * An IP address range in CIDR notation. For example: `192.168.1.0/24` or `2001:0db8:0123:45::/56`
// Note that IPv6 addressing is currently supported only in certain regions. See
// IPv6 Addresses (https://docs.cloud.oracle.com/Content/Network/Concepts/ipv6.htm).
// * The `cidrBlock` value for a Service, if you're
// setting up a security rule for traffic coming from a particular `Service` through
// a service gateway. For example: `oci-phx-objectstorage`.
// * The OCID of a NetworkSecurityGroup in the same
// VCN. The value can be the NSG that the rule belongs to if the rule's intent is to control
// traffic between VNICs in the same NSG.
Source *string `mandatory:"false" json:"source"`
// Type of source for the rule. Required if `direction` = `INGRESS`.
// * `CIDR_BLOCK`: If the rule's `source` is an IP address range in CIDR notation.
// * `SERVICE_CIDR_BLOCK`: If the rule's `source` is the `cidrBlock` value for a
// Service (the rule is for traffic coming from a
// particular `Service` through a service gateway).
// * `NETWORK_SECURITY_GROUP`: If the rule's `source` is the OCID of a
// NetworkSecurityGroup.
SourceType AddSecurityRuleDetailsSourceTypeEnum `mandatory:"false" json:"sourceType,omitempty"`
// 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 AddSecurityRuleDetails) String() string {
return common.PointerString(m)
}
// AddSecurityRuleDetailsDestinationTypeEnum Enum with underlying type: string
type AddSecurityRuleDetailsDestinationTypeEnum string
// Set of constants representing the allowable values for AddSecurityRuleDetailsDestinationTypeEnum
const (
AddSecurityRuleDetailsDestinationTypeCidrBlock AddSecurityRuleDetailsDestinationTypeEnum = "CIDR_BLOCK"
AddSecurityRuleDetailsDestinationTypeServiceCidrBlock AddSecurityRuleDetailsDestinationTypeEnum = "SERVICE_CIDR_BLOCK"
AddSecurityRuleDetailsDestinationTypeNetworkSecurityGroup AddSecurityRuleDetailsDestinationTypeEnum = "NETWORK_SECURITY_GROUP"
)
var mappingAddSecurityRuleDetailsDestinationType = map[string]AddSecurityRuleDetailsDestinationTypeEnum{
"CIDR_BLOCK": AddSecurityRuleDetailsDestinationTypeCidrBlock,
"SERVICE_CIDR_BLOCK": AddSecurityRuleDetailsDestinationTypeServiceCidrBlock,
"NETWORK_SECURITY_GROUP": AddSecurityRuleDetailsDestinationTypeNetworkSecurityGroup,
}
// GetAddSecurityRuleDetailsDestinationTypeEnumValues Enumerates the set of values for AddSecurityRuleDetailsDestinationTypeEnum
func GetAddSecurityRuleDetailsDestinationTypeEnumValues() []AddSecurityRuleDetailsDestinationTypeEnum {
values := make([]AddSecurityRuleDetailsDestinationTypeEnum, 0)
for _, v := range mappingAddSecurityRuleDetailsDestinationType {
values = append(values, v)
}
return values
}
// AddSecurityRuleDetailsDirectionEnum Enum with underlying type: string
type AddSecurityRuleDetailsDirectionEnum string
// Set of constants representing the allowable values for AddSecurityRuleDetailsDirectionEnum
const (
AddSecurityRuleDetailsDirectionEgress AddSecurityRuleDetailsDirectionEnum = "EGRESS"
AddSecurityRuleDetailsDirectionIngress AddSecurityRuleDetailsDirectionEnum = "INGRESS"
)
var mappingAddSecurityRuleDetailsDirection = map[string]AddSecurityRuleDetailsDirectionEnum{
"EGRESS": AddSecurityRuleDetailsDirectionEgress,
"INGRESS": AddSecurityRuleDetailsDirectionIngress,
}
// GetAddSecurityRuleDetailsDirectionEnumValues Enumerates the set of values for AddSecurityRuleDetailsDirectionEnum
func GetAddSecurityRuleDetailsDirectionEnumValues() []AddSecurityRuleDetailsDirectionEnum {
values := make([]AddSecurityRuleDetailsDirectionEnum, 0)
for _, v := range mappingAddSecurityRuleDetailsDirection {
values = append(values, v)
}
return values
}
// AddSecurityRuleDetailsSourceTypeEnum Enum with underlying type: string
type AddSecurityRuleDetailsSourceTypeEnum string
// Set of constants representing the allowable values for AddSecurityRuleDetailsSourceTypeEnum
const (
AddSecurityRuleDetailsSourceTypeCidrBlock AddSecurityRuleDetailsSourceTypeEnum = "CIDR_BLOCK"
AddSecurityRuleDetailsSourceTypeServiceCidrBlock AddSecurityRuleDetailsSourceTypeEnum = "SERVICE_CIDR_BLOCK"
AddSecurityRuleDetailsSourceTypeNetworkSecurityGroup AddSecurityRuleDetailsSourceTypeEnum = "NETWORK_SECURITY_GROUP"
)
var mappingAddSecurityRuleDetailsSourceType = map[string]AddSecurityRuleDetailsSourceTypeEnum{
"CIDR_BLOCK": AddSecurityRuleDetailsSourceTypeCidrBlock,
"SERVICE_CIDR_BLOCK": AddSecurityRuleDetailsSourceTypeServiceCidrBlock,
"NETWORK_SECURITY_GROUP": AddSecurityRuleDetailsSourceTypeNetworkSecurityGroup,
}
// GetAddSecurityRuleDetailsSourceTypeEnumValues Enumerates the set of values for AddSecurityRuleDetailsSourceTypeEnum
func GetAddSecurityRuleDetailsSourceTypeEnumValues() []AddSecurityRuleDetailsSourceTypeEnum {
values := make([]AddSecurityRuleDetailsSourceTypeEnum, 0)
for _, v := range mappingAddSecurityRuleDetailsSourceType {
values = append(values, v)
}
return values
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AddedNetworkSecurityGroupSecurityRules The representation of AddedNetworkSecurityGroupSecurityRules
type AddedNetworkSecurityGroupSecurityRules struct {
// The NSG security rules that were added.
SecurityRules []SecurityRule `mandatory:"false" json:"securityRules"`
}
func (m AddedNetworkSecurityGroupSecurityRules) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,51 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AppCatalogListing Listing details.
type AppCatalogListing struct {
// Listing's contact URL.
ContactUrl *string `mandatory:"false" json:"contactUrl"`
// Description of the listing.
Description *string `mandatory:"false" json:"description"`
// The OCID of the listing.
ListingId *string `mandatory:"false" json:"listingId"`
// Name of the listing.
DisplayName *string `mandatory:"false" json:"displayName"`
// Date and time the listing was published, in RFC3339 format.
// Example: `2018-03-20T12:32:53.532Z`
TimePublished *common.SDKTime `mandatory:"false" json:"timePublished"`
// Publisher's logo URL.
PublisherLogoUrl *string `mandatory:"false" json:"publisherLogoUrl"`
// Name of the publisher who published this listing.
PublisherName *string `mandatory:"false" json:"publisherName"`
// Summary of the listing.
Summary *string `mandatory:"false" json:"summary"`
}
func (m AppCatalogListing) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,89 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AppCatalogListingResourceVersion Listing Resource Version
type AppCatalogListingResourceVersion struct {
// The OCID of the listing this resource version belongs to.
ListingId *string `mandatory:"false" json:"listingId"`
// Date and time the listing resource version was published, in RFC3339 format.
// Example: `2018-03-20T12:32:53.532Z`
TimePublished *common.SDKTime `mandatory:"false" json:"timePublished"`
// OCID of the listing resource.
ListingResourceId *string `mandatory:"false" json:"listingResourceId"`
// Resource Version.
ListingResourceVersion *string `mandatory:"false" json:"listingResourceVersion"`
// List of regions that this listing resource version is available.
// For information about Regions, see
// Regions (https://docs.cloud.oracle.comGeneral/Concepts/regions.htm).
// Example: `["us-ashburn-1", "us-phoenix-1"]`
AvailableRegions []string `mandatory:"false" json:"availableRegions"`
// Array of shapes compatible with this resource.
// You may enumerate all available shapes by calling listShapes.
// Example: `["VM.Standard1.1", "VM.Standard1.2"]`
CompatibleShapes []string `mandatory:"false" json:"compatibleShapes"`
// List of accessible ports for instances launched with this listing resource version.
AccessiblePorts []int `mandatory:"false" json:"accessiblePorts"`
// Allowed actions for the listing resource.
AllowedActions []AppCatalogListingResourceVersionAllowedActionsEnum `mandatory:"false" json:"allowedActions,omitempty"`
}
func (m AppCatalogListingResourceVersion) String() string {
return common.PointerString(m)
}
// AppCatalogListingResourceVersionAllowedActionsEnum Enum with underlying type: string
type AppCatalogListingResourceVersionAllowedActionsEnum string
// Set of constants representing the allowable values for AppCatalogListingResourceVersionAllowedActionsEnum
const (
AppCatalogListingResourceVersionAllowedActionsSnapshot AppCatalogListingResourceVersionAllowedActionsEnum = "SNAPSHOT"
AppCatalogListingResourceVersionAllowedActionsBootVolumeDetach AppCatalogListingResourceVersionAllowedActionsEnum = "BOOT_VOLUME_DETACH"
AppCatalogListingResourceVersionAllowedActionsPreserveBootVolume AppCatalogListingResourceVersionAllowedActionsEnum = "PRESERVE_BOOT_VOLUME"
AppCatalogListingResourceVersionAllowedActionsSerialConsoleAccess AppCatalogListingResourceVersionAllowedActionsEnum = "SERIAL_CONSOLE_ACCESS"
AppCatalogListingResourceVersionAllowedActionsBootRecovery AppCatalogListingResourceVersionAllowedActionsEnum = "BOOT_RECOVERY"
AppCatalogListingResourceVersionAllowedActionsBackupBootVolume AppCatalogListingResourceVersionAllowedActionsEnum = "BACKUP_BOOT_VOLUME"
AppCatalogListingResourceVersionAllowedActionsCaptureConsoleHistory AppCatalogListingResourceVersionAllowedActionsEnum = "CAPTURE_CONSOLE_HISTORY"
)
var mappingAppCatalogListingResourceVersionAllowedActions = map[string]AppCatalogListingResourceVersionAllowedActionsEnum{
"SNAPSHOT": AppCatalogListingResourceVersionAllowedActionsSnapshot,
"BOOT_VOLUME_DETACH": AppCatalogListingResourceVersionAllowedActionsBootVolumeDetach,
"PRESERVE_BOOT_VOLUME": AppCatalogListingResourceVersionAllowedActionsPreserveBootVolume,
"SERIAL_CONSOLE_ACCESS": AppCatalogListingResourceVersionAllowedActionsSerialConsoleAccess,
"BOOT_RECOVERY": AppCatalogListingResourceVersionAllowedActionsBootRecovery,
"BACKUP_BOOT_VOLUME": AppCatalogListingResourceVersionAllowedActionsBackupBootVolume,
"CAPTURE_CONSOLE_HISTORY": AppCatalogListingResourceVersionAllowedActionsCaptureConsoleHistory,
}
// GetAppCatalogListingResourceVersionAllowedActionsEnumValues Enumerates the set of values for AppCatalogListingResourceVersionAllowedActionsEnum
func GetAppCatalogListingResourceVersionAllowedActionsEnumValues() []AppCatalogListingResourceVersionAllowedActionsEnum {
values := make([]AppCatalogListingResourceVersionAllowedActionsEnum, 0)
for _, v := range mappingAppCatalogListingResourceVersionAllowedActions {
values = append(values, v)
}
return values
}

View File

@ -0,0 +1,45 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AppCatalogListingResourceVersionAgreements Agreements for a listing resource version.
type AppCatalogListingResourceVersionAgreements struct {
// The OCID of the listing associated with these agreements.
ListingId *string `mandatory:"false" json:"listingId"`
// Listing resource version associated with these agreements.
ListingResourceVersion *string `mandatory:"false" json:"listingResourceVersion"`
// Oracle TOU link
OracleTermsOfUseLink *string `mandatory:"false" json:"oracleTermsOfUseLink"`
// EULA link
EulaLink *string `mandatory:"false" json:"eulaLink"`
// Date and time the agreements were retrieved, in RFC3339 format.
// Example: `2018-03-20T12:32:53.532Z`
TimeRetrieved *common.SDKTime `mandatory:"false" json:"timeRetrieved"`
// A generated signature for this agreement retrieval operation which should be used in the create subscription call.
Signature *string `mandatory:"false" json:"signature"`
}
func (m AppCatalogListingResourceVersionAgreements) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,39 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AppCatalogListingResourceVersionSummary Listing Resource Version summary
type AppCatalogListingResourceVersionSummary struct {
// The OCID of the listing this resource version belongs to.
ListingId *string `mandatory:"false" json:"listingId"`
// Date and time the listing resource version was published, in RFC3339 format.
// Example: `2018-03-20T12:32:53.532Z`
TimePublished *common.SDKTime `mandatory:"false" json:"timePublished"`
// OCID of the listing resource.
ListingResourceId *string `mandatory:"false" json:"listingResourceId"`
// Resource Version.
ListingResourceVersion *string `mandatory:"false" json:"listingResourceVersion"`
}
func (m AppCatalogListingResourceVersionSummary) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,38 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AppCatalogListingSummary A summary of a listing.
type AppCatalogListingSummary struct {
// the region free ocid of the listing resource.
ListingId *string `mandatory:"false" json:"listingId"`
// The display name of the listing.
DisplayName *string `mandatory:"false" json:"displayName"`
// The short summary for the listing.
Summary *string `mandatory:"false" json:"summary"`
// The name of the publisher who published this listing.
PublisherName *string `mandatory:"false" json:"publisherName"`
}
func (m AppCatalogListingSummary) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,51 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AppCatalogSubscription a subscription for a listing resource version.
type AppCatalogSubscription struct {
// Name of the publisher who published this listing.
PublisherName *string `mandatory:"false" json:"publisherName"`
// The ocid of the listing resource.
ListingId *string `mandatory:"false" json:"listingId"`
// Listing resource version.
ListingResourceVersion *string `mandatory:"false" json:"listingResourceVersion"`
// Listing resource id.
ListingResourceId *string `mandatory:"false" json:"listingResourceId"`
// The display name of the listing.
DisplayName *string `mandatory:"false" json:"displayName"`
// The short summary to the listing.
Summary *string `mandatory:"false" json:"summary"`
// The compartmentID of the subscription.
CompartmentId *string `mandatory:"false" json:"compartmentId"`
// Date and time at which the subscription was created, in RFC3339 format.
// Example: `2018-03-20T12:32:53.532Z`
TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"`
}
func (m AppCatalogSubscription) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,51 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AppCatalogSubscriptionSummary a subscription summary for a listing resource version.
type AppCatalogSubscriptionSummary struct {
// Name of the publisher who published this listing.
PublisherName *string `mandatory:"false" json:"publisherName"`
// The ocid of the listing resource.
ListingId *string `mandatory:"false" json:"listingId"`
// Listing resource version.
ListingResourceVersion *string `mandatory:"false" json:"listingResourceVersion"`
// Listing resource id.
ListingResourceId *string `mandatory:"false" json:"listingResourceId"`
// The display name of the listing.
DisplayName *string `mandatory:"false" json:"displayName"`
// The short summary to the listing.
Summary *string `mandatory:"false" json:"summary"`
// The compartmentID of the subscription.
CompartmentId *string `mandatory:"false" json:"compartmentId"`
// Date and time at which the subscription was created, in RFC3339 format.
// Example: `2018-03-20T12:32:53.532Z`
TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"`
}
func (m AppCatalogSubscriptionSummary) String() string {
return common.PointerString(m)
}

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
@ -56,8 +57,8 @@ type AttachBootVolumeResponse struct {
// 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.
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
}

View File

@ -0,0 +1,92 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
)
// AttachEmulatedVolumeDetails The representation of AttachEmulatedVolumeDetails
type AttachEmulatedVolumeDetails struct {
// The OCID of the instance.
InstanceId *string `mandatory:"true" json:"instanceId"`
// The OCID of the volume.
VolumeId *string `mandatory:"true" json:"volumeId"`
// The device name.
Device *string `mandatory:"false" json:"device"`
// 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 the attachment was created in read-only mode.
IsReadOnly *bool `mandatory:"false" json:"isReadOnly"`
// Whether the attachment should be created in shareable mode. If an attachment
// is created in shareable mode, then other instances can attach the same volume, provided
// that they also create their attachments in shareable mode. Only certain volume types can
// be attached in shareable mode. Defaults to false if not specified.
IsShareable *bool `mandatory:"false" json:"isShareable"`
}
//GetDevice returns Device
func (m AttachEmulatedVolumeDetails) GetDevice() *string {
return m.Device
}
//GetDisplayName returns DisplayName
func (m AttachEmulatedVolumeDetails) GetDisplayName() *string {
return m.DisplayName
}
//GetInstanceId returns InstanceId
func (m AttachEmulatedVolumeDetails) GetInstanceId() *string {
return m.InstanceId
}
//GetIsReadOnly returns IsReadOnly
func (m AttachEmulatedVolumeDetails) GetIsReadOnly() *bool {
return m.IsReadOnly
}
//GetIsShareable returns IsShareable
func (m AttachEmulatedVolumeDetails) GetIsShareable() *bool {
return m.IsShareable
}
//GetVolumeId returns VolumeId
func (m AttachEmulatedVolumeDetails) GetVolumeId() *string {
return m.VolumeId
}
func (m AttachEmulatedVolumeDetails) String() string {
return common.PointerString(m)
}
// MarshalJSON marshals to json representation
func (m AttachEmulatedVolumeDetails) MarshalJSON() (buff []byte, e error) {
type MarshalTypeAttachEmulatedVolumeDetails AttachEmulatedVolumeDetails
s := struct {
DiscriminatorParam string `json:"type"`
MarshalTypeAttachEmulatedVolumeDetails
}{
"emulated",
(MarshalTypeAttachEmulatedVolumeDetails)(m),
}
return json.Marshal(&s)
}

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
@ -22,16 +27,30 @@ type AttachIScsiVolumeDetails struct {
// The OCID of the volume.
VolumeId *string `mandatory:"true" json:"volumeId"`
// The device name.
Device *string `mandatory:"false" json:"device"`
// 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 the attachment was created in read-only mode.
IsReadOnly *bool `mandatory:"false" json:"isReadOnly"`
// Whether the attachment should be created in shareable mode. If an attachment
// is created in shareable mode, then other instances can attach the same volume, provided
// that they also create their attachments in shareable mode. Only certain volume types can
// be attached in shareable mode. Defaults to false if not specified.
IsShareable *bool `mandatory:"false" json:"isShareable"`
// Whether to use CHAP authentication for the volume attachment. Defaults to false.
UseChap *bool `mandatory:"false" json:"useChap"`
}
//GetDevice returns Device
func (m AttachIScsiVolumeDetails) GetDevice() *string {
return m.Device
}
//GetDisplayName returns DisplayName
func (m AttachIScsiVolumeDetails) GetDisplayName() *string {
return m.DisplayName
@ -47,6 +66,11 @@ func (m AttachIScsiVolumeDetails) GetIsReadOnly() *bool {
return m.IsReadOnly
}
//GetIsShareable returns IsShareable
func (m AttachIScsiVolumeDetails) GetIsShareable() *bool {
return m.IsShareable
}
//GetVolumeId returns VolumeId
func (m AttachIScsiVolumeDetails) GetVolumeId() *string {
return m.VolumeId

View File

@ -0,0 +1,38 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// AttachLoadBalancerDetails Represents a load balancer that is to be attached to an instance pool.
type AttachLoadBalancerDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the load balancer to attach to the instance pool.
LoadBalancerId *string `mandatory:"true" json:"loadBalancerId"`
// The name of the backend set on the load balancer to add instances to.
BackendSetName *string `mandatory:"true" json:"backendSetName"`
// The port value to use when creating the backend set.
Port *int `mandatory:"true" json:"port"`
// Indicates which VNIC on each instance in the pool should be used to associate with the load balancer. Possible values are "PrimaryVnic" or the displayName of one of the secondary VNICs on the instance configuration that is associated with the instance pool.
VnicSelection *string `mandatory:"true" json:"vnicSelection"`
}
func (m AttachLoadBalancerDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,80 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// AttachLoadBalancerRequest wrapper for the AttachLoadBalancer operation
type AttachLoadBalancerRequest struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the instance pool.
InstancePoolId *string `mandatory:"true" contributesTo:"path" name:"instancePoolId"`
// Load balancer being attached
AttachLoadBalancerDetails `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"`
// 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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request AttachLoadBalancerRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request AttachLoadBalancerRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request AttachLoadBalancerRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// AttachLoadBalancerResponse wrapper for the AttachLoadBalancer operation
type AttachLoadBalancerResponse struct {
// The underlying http response
RawResponse *http.Response
// The InstancePool instance
InstancePool `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 AttachLoadBalancerResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response AttachLoadBalancerResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
@ -22,11 +27,28 @@ type AttachParavirtualizedVolumeDetails struct {
// The OCID of the volume.
VolumeId *string `mandatory:"true" json:"volumeId"`
// The device name.
Device *string `mandatory:"false" json:"device"`
// 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 the attachment was created in read-only mode.
IsReadOnly *bool `mandatory:"false" json:"isReadOnly"`
// Whether the attachment should be created in shareable mode. If an attachment
// is created in shareable mode, then other instances can attach the same volume, provided
// that they also create their attachments in shareable mode. Only certain volume types can
// be attached in shareable mode. Defaults to false if not specified.
IsShareable *bool `mandatory:"false" json:"isShareable"`
// Whether to enable in-transit encryption for the data volume's paravirtualized attachment. The default value is false.
IsPvEncryptionInTransitEnabled *bool `mandatory:"false" json:"isPvEncryptionInTransitEnabled"`
}
//GetDevice returns Device
func (m AttachParavirtualizedVolumeDetails) GetDevice() *string {
return m.Device
}
//GetDisplayName returns DisplayName
@ -44,6 +66,11 @@ func (m AttachParavirtualizedVolumeDetails) GetIsReadOnly() *bool {
return m.IsReadOnly
}
//GetIsShareable returns IsShareable
func (m AttachParavirtualizedVolumeDetails) GetIsShareable() *bool {
return m.IsShareable
}
//GetVolumeId returns VolumeId
func (m AttachParavirtualizedVolumeDetails) GetVolumeId() *string {
return m.VolumeId

View File

@ -0,0 +1,92 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
)
// AttachServiceDeterminedVolumeDetails The representation of AttachServiceDeterminedVolumeDetails
type AttachServiceDeterminedVolumeDetails struct {
// The OCID of the instance.
InstanceId *string `mandatory:"true" json:"instanceId"`
// The OCID of the volume.
VolumeId *string `mandatory:"true" json:"volumeId"`
// The device name.
Device *string `mandatory:"false" json:"device"`
// 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 the attachment was created in read-only mode.
IsReadOnly *bool `mandatory:"false" json:"isReadOnly"`
// Whether the attachment should be created in shareable mode. If an attachment
// is created in shareable mode, then other instances can attach the same volume, provided
// that they also create their attachments in shareable mode. Only certain volume types can
// be attached in shareable mode. Defaults to false if not specified.
IsShareable *bool `mandatory:"false" json:"isShareable"`
}
//GetDevice returns Device
func (m AttachServiceDeterminedVolumeDetails) GetDevice() *string {
return m.Device
}
//GetDisplayName returns DisplayName
func (m AttachServiceDeterminedVolumeDetails) GetDisplayName() *string {
return m.DisplayName
}
//GetInstanceId returns InstanceId
func (m AttachServiceDeterminedVolumeDetails) GetInstanceId() *string {
return m.InstanceId
}
//GetIsReadOnly returns IsReadOnly
func (m AttachServiceDeterminedVolumeDetails) GetIsReadOnly() *bool {
return m.IsReadOnly
}
//GetIsShareable returns IsShareable
func (m AttachServiceDeterminedVolumeDetails) GetIsShareable() *bool {
return m.IsShareable
}
//GetVolumeId returns VolumeId
func (m AttachServiceDeterminedVolumeDetails) GetVolumeId() *string {
return m.VolumeId
}
func (m AttachServiceDeterminedVolumeDetails) String() string {
return common.PointerString(m)
}
// MarshalJSON marshals to json representation
func (m AttachServiceDeterminedVolumeDetails) MarshalJSON() (buff []byte, e error) {
type MarshalTypeAttachServiceDeterminedVolumeDetails AttachServiceDeterminedVolumeDetails
s := struct {
DiscriminatorParam string `json:"type"`
MarshalTypeAttachServiceDeterminedVolumeDetails
}{
"service_determined",
(MarshalTypeAttachServiceDeterminedVolumeDetails)(m),
}
return json.Marshal(&s)
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
@ -11,10 +12,10 @@ import (
// AttachServiceIdRequest wrapper for the AttachServiceId operation
type AttachServiceIdRequest struct {
// The service gateway's OCID (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm).
// The service gateway's OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm).
ServiceGatewayId *string `mandatory:"true" contributesTo:"path" name:"serviceGatewayId"`
// ServiceId of Service to be attached to a Service Gateway.
// ServiceId of Service to be attached to a service gateway.
AttachServiceDetails ServiceIdRequestDetails `contributesTo:"body"`
// For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
@ -54,8 +55,8 @@ type AttachServiceIdResponse struct {
// The ServiceGateway instance
ServiceGateway `presentIn:"body"`
// Unique Oracle-assigned identifier for the request. If you need to contact Oracle about
// a particular request, please provide the request ID.
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
}

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
@ -22,13 +27,14 @@ type AttachVnicDetails struct {
InstanceId *string `mandatory:"true" json:"instanceId"`
// A user-friendly name for the attachment. Does not have to be unique, and it cannot be changed.
// Avoid entering confidential information.
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).
// Virtual Network Interface Cards (VNICs) (https://docs.cloud.oracle.com/Content/Network/Tasks/managingVNICs.htm).
NicIndex *int `mandatory:"false" json:"nicIndex"`
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
@ -56,8 +57,8 @@ type AttachVnicResponse struct {
// 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.
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
}

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
@ -22,19 +27,30 @@ type AttachVolumeDetails interface {
// The OCID of the volume.
GetVolumeId() *string
// The device name.
GetDevice() *string
// A user-friendly name. Does not have to be unique, and it cannot be changed. Avoid entering confidential information.
GetDisplayName() *string
// Whether the attachment was created in read-only mode.
GetIsReadOnly() *bool
// Whether the attachment should be created in shareable mode. If an attachment
// is created in shareable mode, then other instances can attach the same volume, provided
// that they also create their attachments in shareable mode. Only certain volume types can
// be attached in shareable mode. Defaults to false if not specified.
GetIsShareable() *bool
}
type attachvolumedetails struct {
JsonData []byte
InstanceId *string `mandatory:"true" json:"instanceId"`
VolumeId *string `mandatory:"true" json:"volumeId"`
Device *string `mandatory:"false" json:"device"`
DisplayName *string `mandatory:"false" json:"displayName"`
IsReadOnly *bool `mandatory:"false" json:"isReadOnly"`
IsShareable *bool `mandatory:"false" json:"isShareable"`
Type string `json:"type"`
}
@ -51,8 +67,10 @@ func (m *attachvolumedetails) UnmarshalJSON(data []byte) error {
}
m.InstanceId = s.Model.InstanceId
m.VolumeId = s.Model.VolumeId
m.Device = s.Model.Device
m.DisplayName = s.Model.DisplayName
m.IsReadOnly = s.Model.IsReadOnly
m.IsShareable = s.Model.IsShareable
m.Type = s.Model.Type
return err
@ -60,8 +78,21 @@ func (m *attachvolumedetails) UnmarshalJSON(data []byte) error {
// UnmarshalPolymorphicJSON unmarshals polymorphic json
func (m *attachvolumedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {
if data == nil || string(data) == "null" {
return nil, nil
}
var err error
switch m.Type {
case "service_determined":
mm := AttachServiceDeterminedVolumeDetails{}
err = json.Unmarshal(data, &mm)
return mm, err
case "emulated":
mm := AttachEmulatedVolumeDetails{}
err = json.Unmarshal(data, &mm)
return mm, err
case "iscsi":
mm := AttachIScsiVolumeDetails{}
err = json.Unmarshal(data, &mm)
@ -71,7 +102,7 @@ func (m *attachvolumedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}
err = json.Unmarshal(data, &mm)
return mm, err
default:
return m, nil
return *m, nil
}
}
@ -85,6 +116,11 @@ func (m attachvolumedetails) GetVolumeId() *string {
return m.VolumeId
}
//GetDevice returns Device
func (m attachvolumedetails) GetDevice() *string {
return m.Device
}
//GetDisplayName returns DisplayName
func (m attachvolumedetails) GetDisplayName() *string {
return m.DisplayName
@ -95,6 +131,11 @@ func (m attachvolumedetails) GetIsReadOnly() *bool {
return m.IsReadOnly
}
//GetIsShareable returns IsShareable
func (m attachvolumedetails) GetIsShareable() *bool {
return m.IsShareable
}
func (m attachvolumedetails) String() string {
return common.PointerString(m)
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
@ -56,8 +57,8 @@ type AttachVolumeResponse struct {
// 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.
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
}

View File

@ -0,0 +1,83 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// BgpSessionInfo Information for establishing a BGP session for the IPSec tunnel.
type BgpSessionInfo struct {
// The IP address for the Oracle end of the inside tunnel interface.
// If the tunnel's `routing` attribute is set to `BGP`
// (see IPSecConnectionTunnel), this IP address
// is required and used for the tunnel's BGP session.
// If `routing` is instead set to `STATIC`, this IP address is optional. You can set this IP
// address so you can troubleshoot or monitor the tunnel.
// The value must be a /30 or /31.
// Example: `10.0.0.4/31`
OracleInterfaceIp *string `mandatory:"false" json:"oracleInterfaceIp"`
// The IP address for the CPE end of the inside tunnel interface.
// If the tunnel's `routing` attribute is set to `BGP`
// (see IPSecConnectionTunnel), this IP address
// is required and used for the tunnel's BGP session.
// If `routing` is instead set to `STATIC`, this IP address is optional. You can set this IP
// address so you can troubleshoot or monitor the tunnel.
// The value must be a /30 or /31.
// Example: `10.0.0.5/31`
CustomerInterfaceIp *string `mandatory:"false" json:"customerInterfaceIp"`
// The Oracle BGP ASN.
OracleBgpAsn *string `mandatory:"false" json:"oracleBgpAsn"`
// If the tunnel's `routing` attribute is set to `BGP`
// (see IPSecConnectionTunnel), this ASN
// is required and used for the tunnel's BGP session. This is the ASN of the network on the
// CPE end of the BGP session. Can be a 2-byte or 4-byte ASN. Uses "asplain" format.
// If the tunnel uses static routing, the `customerBgpAsn` must be null.
// Example: `12345` (2-byte) or `1587232876` (4-byte)
CustomerBgpAsn *string `mandatory:"false" json:"customerBgpAsn"`
// The state of the BGP session.
BgpState BgpSessionInfoBgpStateEnum `mandatory:"false" json:"bgpState,omitempty"`
}
func (m BgpSessionInfo) String() string {
return common.PointerString(m)
}
// BgpSessionInfoBgpStateEnum Enum with underlying type: string
type BgpSessionInfoBgpStateEnum string
// Set of constants representing the allowable values for BgpSessionInfoBgpStateEnum
const (
BgpSessionInfoBgpStateUp BgpSessionInfoBgpStateEnum = "UP"
BgpSessionInfoBgpStateDown BgpSessionInfoBgpStateEnum = "DOWN"
)
var mappingBgpSessionInfoBgpState = map[string]BgpSessionInfoBgpStateEnum{
"UP": BgpSessionInfoBgpStateUp,
"DOWN": BgpSessionInfoBgpStateDown,
}
// GetBgpSessionInfoBgpStateEnumValues Enumerates the set of values for BgpSessionInfoBgpStateEnum
func GetBgpSessionInfoBgpStateEnumValues() []BgpSessionInfoBgpStateEnum {
values := make([]BgpSessionInfoBgpStateEnum, 0)
for _, v := range mappingBgpSessionInfoBgpState {
values = append(values, v)
}
return values
}

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
@ -14,13 +19,15 @@ import (
)
// BootVolume A detachable boot volume device that contains the image used to boot a Compute instance. For more information, see
// Overview of Boot Volumes (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/bootvolumes.htm).
// Overview of Boot Volumes (https://docs.cloud.oracle.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).
// Getting Started with Policies (https://docs.cloud.oracle.com/Content/Identity/Concepts/policygetstarted.htm).
// **Warning:** Oracle recommends that you avoid using any confidential information when you
// supply string values using the API.
type BootVolume struct {
// The Availability Domain of the boot volume.
// The availability domain of the boot volume.
// Example: `Uocm:PHX-AD-1`
AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"`
@ -35,23 +42,26 @@ type BootVolume struct {
// 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"`
SizeInMBs *int64 `mandatory:"true" json:"sizeInMBs"`
// The date and time the boot volume was created. Format defined by RFC3339.
TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"`
// Defined tags for this resource. Each key is predefined and scoped to a namespace.
// For more information, see Resource Tags (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
// Defined tags for this resource. Each key is predefined and scoped to a
// namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
// Example: `{"Operations": {"CostCenter": "42"}}`
DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
// System tags for this resource. Each key is predefined and scoped to a namespace.
// Example: `{"foo-namespace": {"bar-key": "value"}}`
SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"`
// A user-friendly name. Does not have to be unique, and it's changeable.
// Avoid entering confidential information.
DisplayName *string `mandatory:"false" json:"displayName"`
// Free-form tags for this resource. Each tag is a simple key-value pair with no
// predefined name, type, or namespace. For more information, see
// Resource Tags (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
// predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
// Example: `{"Department": "Finance"}`
FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
@ -61,15 +71,26 @@ type BootVolume struct {
// Specifies whether the boot volume's data has finished copying from the source boot volume or boot volume backup.
IsHydrated *bool `mandatory:"false" json:"isHydrated"`
// The size of the boot volume in GBs.
SizeInGBs *int `mandatory:"false" json:"sizeInGBs"`
// The number of volume performance units (VPUs) that will be applied to this boot volume per GB,
// representing the Block Volume service's elastic performance options.
// See Block Volume Elastic Performance (https://docs.cloud.oracle.com/Content/Block/Concepts/blockvolumeelasticperformance.htm) for more information.
// Allowed values:
// * `10`: Represents Balanced option.
// * `20`: Represents Higher Performance option.
VpusPerGB *int64 `mandatory:"false" json:"vpusPerGB"`
// The boot volume source, either an existing boot volume in the same Availability Domain or a boot volume backup.
// The size of the boot volume in GBs.
SizeInGBs *int64 `mandatory:"false" json:"sizeInGBs"`
// The boot volume source, either an existing boot volume in the same availability domain or a boot volume backup.
// If null, this means that the boot volume was created from an image.
SourceDetails BootVolumeSourceDetails `mandatory:"false" json:"sourceDetails"`
// The OCID of the source volume group.
VolumeGroupId *string `mandatory:"false" json:"volumeGroupId"`
// The OCID of the Key Management master encryption key assigned to the boot volume.
KmsKeyId *string `mandatory:"false" json:"kmsKeyId"`
}
func (m BootVolume) String() string {
@ -80,18 +101,21 @@ func (m BootVolume) String() string {
func (m *BootVolume) UnmarshalJSON(data []byte) (e error) {
model := struct {
DefinedTags map[string]map[string]interface{} `json:"definedTags"`
SystemTags map[string]map[string]interface{} `json:"systemTags"`
DisplayName *string `json:"displayName"`
FreeformTags map[string]string `json:"freeformTags"`
ImageId *string `json:"imageId"`
IsHydrated *bool `json:"isHydrated"`
SizeInGBs *int `json:"sizeInGBs"`
VpusPerGB *int64 `json:"vpusPerGB"`
SizeInGBs *int64 `json:"sizeInGBs"`
SourceDetails bootvolumesourcedetails `json:"sourceDetails"`
VolumeGroupId *string `json:"volumeGroupId"`
KmsKeyId *string `json:"kmsKeyId"`
AvailabilityDomain *string `json:"availabilityDomain"`
CompartmentId *string `json:"compartmentId"`
Id *string `json:"id"`
LifecycleState BootVolumeLifecycleStateEnum `json:"lifecycleState"`
SizeInMBs *int `json:"sizeInMBs"`
SizeInMBs *int64 `json:"sizeInMBs"`
TimeCreated *common.SDKTime `json:"timeCreated"`
}{}
@ -99,23 +123,47 @@ func (m *BootVolume) UnmarshalJSON(data []byte) (e error) {
if e != nil {
return
}
var nn interface{}
m.DefinedTags = model.DefinedTags
m.SystemTags = model.SystemTags
m.DisplayName = model.DisplayName
m.FreeformTags = model.FreeformTags
m.ImageId = model.ImageId
m.IsHydrated = model.IsHydrated
m.VpusPerGB = model.VpusPerGB
m.SizeInGBs = model.SizeInGBs
nn, e := model.SourceDetails.UnmarshalPolymorphicJSON(model.SourceDetails.JsonData)
nn, e = model.SourceDetails.UnmarshalPolymorphicJSON(model.SourceDetails.JsonData)
if e != nil {
return
}
m.SourceDetails = nn.(BootVolumeSourceDetails)
if nn != nil {
m.SourceDetails = nn.(BootVolumeSourceDetails)
} else {
m.SourceDetails = nil
}
m.VolumeGroupId = model.VolumeGroupId
m.KmsKeyId = model.KmsKeyId
m.AvailabilityDomain = model.AvailabilityDomain
m.CompartmentId = model.CompartmentId
m.Id = model.Id
m.LifecycleState = model.LifecycleState
m.SizeInMBs = model.SizeInMBs
m.TimeCreated = model.TimeCreated
return
}
@ -123,7 +171,7 @@ func (m *BootVolume) UnmarshalJSON(data []byte) (e error) {
// BootVolumeLifecycleStateEnum Enum with underlying type: string
type BootVolumeLifecycleStateEnum string
// Set of constants representing the allowable values for BootVolumeLifecycleState
// Set of constants representing the allowable values for BootVolumeLifecycleStateEnum
const (
BootVolumeLifecycleStateProvisioning BootVolumeLifecycleStateEnum = "PROVISIONING"
BootVolumeLifecycleStateRestoring BootVolumeLifecycleStateEnum = "RESTORING"
@ -142,7 +190,7 @@ var mappingBootVolumeLifecycleState = map[string]BootVolumeLifecycleStateEnum{
"FAULTY": BootVolumeLifecycleStateFaulty,
}
// GetBootVolumeLifecycleStateEnumValues Enumerates the set of values for BootVolumeLifecycleState
// GetBootVolumeLifecycleStateEnumValues Enumerates the set of values for BootVolumeLifecycleStateEnum
func GetBootVolumeLifecycleStateEnumValues() []BootVolumeLifecycleStateEnum {
values := make([]BootVolumeLifecycleStateEnum, 0)
for _, v := range mappingBootVolumeLifecycleState {

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
@ -13,9 +18,11 @@ import (
)
// BootVolumeAttachment Represents an attachment between a boot volume and an instance.
// **Warning:** Oracle recommends that you avoid using any confidential information when you
// supply string values using the API.
type BootVolumeAttachment struct {
// The Availability Domain of an instance.
// The availability domain of an instance.
// Example: `Uocm:PHX-AD-1`
AvailabilityDomain *string `mandatory:"true" json:"availabilityDomain"`
@ -42,6 +49,9 @@ type BootVolumeAttachment struct {
// Avoid entering confidential information.
// Example: `My boot volume`
DisplayName *string `mandatory:"false" json:"displayName"`
// Whether in-transit encryption for the boot volume's paravirtualized attachment is enabled or not.
IsPvEncryptionInTransitEnabled *bool `mandatory:"false" json:"isPvEncryptionInTransitEnabled"`
}
func (m BootVolumeAttachment) String() string {
@ -51,7 +61,7 @@ func (m BootVolumeAttachment) String() string {
// BootVolumeAttachmentLifecycleStateEnum Enum with underlying type: string
type BootVolumeAttachmentLifecycleStateEnum string
// Set of constants representing the allowable values for BootVolumeAttachmentLifecycleState
// Set of constants representing the allowable values for BootVolumeAttachmentLifecycleStateEnum
const (
BootVolumeAttachmentLifecycleStateAttaching BootVolumeAttachmentLifecycleStateEnum = "ATTACHING"
BootVolumeAttachmentLifecycleStateAttached BootVolumeAttachmentLifecycleStateEnum = "ATTACHED"
@ -66,7 +76,7 @@ var mappingBootVolumeAttachmentLifecycleState = map[string]BootVolumeAttachmentL
"DETACHED": BootVolumeAttachmentLifecycleStateDetached,
}
// GetBootVolumeAttachmentLifecycleStateEnumValues Enumerates the set of values for BootVolumeAttachmentLifecycleState
// GetBootVolumeAttachmentLifecycleStateEnumValues Enumerates the set of values for BootVolumeAttachmentLifecycleStateEnum
func GetBootVolumeAttachmentLifecycleStateEnumValues() []BootVolumeAttachmentLifecycleStateEnum {
values := make([]BootVolumeAttachmentLifecycleStateEnum, 0)
for _, v := range mappingBootVolumeAttachmentLifecycleState {

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
@ -14,11 +19,13 @@ import (
// BootVolumeBackup A point-in-time copy of a boot volume that can then be used to create
// a new boot volume or recover a boot volume. For more information, see Overview
// of Boot Volume Backups (https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/bootvolumebackups.htm)
// of Boot Volume Backups (https://docs.cloud.oracle.com/Content/Block/Concepts/bootvolumebackups.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).
// Policies (https://docs.cloud.oracle.com/Content/Identity/Concepts/policygetstarted.htm).
// **Warning:** Oracle recommends that you avoid using any confidential information when you
// supply string values using the API.
type BootVolumeBackup struct {
// The OCID of the compartment that contains the boot volume backup.
@ -41,11 +48,15 @@ type BootVolumeBackup struct {
// The OCID of the boot volume.
BootVolumeId *string `mandatory:"false" json:"bootVolumeId"`
// Defined tags for this resource. Each key is predefined and scoped to a namespace.
// For more information, see Resource Tags (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
// Defined tags for this resource. Each key is predefined and scoped to a
// namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
// Example: `{"Operations": {"CostCenter": "42"}}`
DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
// System tags for this resource. Each key is predefined and scoped to a namespace.
// Example: `{"foo-namespace": {"bar-key": "value"}}`
SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"`
// The date and time the volume backup will expire and be automatically deleted.
// Format defined by RFC3339. This parameter will always be present for backups that
// were created automatically by a scheduled-backup policy. For manually created backups,
@ -54,16 +65,24 @@ type BootVolumeBackup struct {
ExpirationTime *common.SDKTime `mandatory:"false" json:"expirationTime"`
// Free-form tags for this resource. Each tag is a simple key-value pair with no
// predefined name, type, or namespace. For more information, see
// Resource Tags (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
// predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
// Example: `{"Department": "Finance"}`
FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
// The image OCID used to create the boot volume the backup is taken from.
ImageId *string `mandatory:"false" json:"imageId"`
// The OCID of the Key Management master encryption assigned to the boot volume backup.
// For more information about the Key Management service and encryption keys, see
// Overview of Key Management (https://docs.cloud.oracle.com/Content/KeyManagement/Concepts/keyoverview.htm) and
// Using Keys (https://docs.cloud.oracle.com/Content/KeyManagement/Tasks/usingkeys.htm).
KmsKeyId *string `mandatory:"false" json:"kmsKeyId"`
// The size of the boot volume, in GBs.
SizeInGBs *int `mandatory:"false" json:"sizeInGBs"`
SizeInGBs *int64 `mandatory:"false" json:"sizeInGBs"`
// The OCID of the source boot volume backup.
SourceBootVolumeBackupId *string `mandatory:"false" json:"sourceBootVolumeBackupId"`
// Specifies whether the backup was created manually, or via scheduled backup policy.
SourceType BootVolumeBackupSourceTypeEnum `mandatory:"false" json:"sourceType,omitempty"`
@ -76,7 +95,7 @@ type BootVolumeBackup struct {
// The size used by the backup, in GBs. It is typically smaller than sizeInGBs, depending on the space
// consumed on the boot volume and whether the backup is full or incremental.
UniqueSizeInGBs *int `mandatory:"false" json:"uniqueSizeInGBs"`
UniqueSizeInGBs *int64 `mandatory:"false" json:"uniqueSizeInGBs"`
}
func (m BootVolumeBackup) String() string {
@ -86,7 +105,7 @@ func (m BootVolumeBackup) String() string {
// BootVolumeBackupLifecycleStateEnum Enum with underlying type: string
type BootVolumeBackupLifecycleStateEnum string
// Set of constants representing the allowable values for BootVolumeBackupLifecycleState
// Set of constants representing the allowable values for BootVolumeBackupLifecycleStateEnum
const (
BootVolumeBackupLifecycleStateCreating BootVolumeBackupLifecycleStateEnum = "CREATING"
BootVolumeBackupLifecycleStateAvailable BootVolumeBackupLifecycleStateEnum = "AVAILABLE"
@ -105,7 +124,7 @@ var mappingBootVolumeBackupLifecycleState = map[string]BootVolumeBackupLifecycle
"REQUEST_RECEIVED": BootVolumeBackupLifecycleStateRequestReceived,
}
// GetBootVolumeBackupLifecycleStateEnumValues Enumerates the set of values for BootVolumeBackupLifecycleState
// GetBootVolumeBackupLifecycleStateEnumValues Enumerates the set of values for BootVolumeBackupLifecycleStateEnum
func GetBootVolumeBackupLifecycleStateEnumValues() []BootVolumeBackupLifecycleStateEnum {
values := make([]BootVolumeBackupLifecycleStateEnum, 0)
for _, v := range mappingBootVolumeBackupLifecycleState {
@ -117,7 +136,7 @@ func GetBootVolumeBackupLifecycleStateEnumValues() []BootVolumeBackupLifecycleSt
// BootVolumeBackupSourceTypeEnum Enum with underlying type: string
type BootVolumeBackupSourceTypeEnum string
// Set of constants representing the allowable values for BootVolumeBackupSourceType
// Set of constants representing the allowable values for BootVolumeBackupSourceTypeEnum
const (
BootVolumeBackupSourceTypeManual BootVolumeBackupSourceTypeEnum = "MANUAL"
BootVolumeBackupSourceTypeScheduled BootVolumeBackupSourceTypeEnum = "SCHEDULED"
@ -128,7 +147,7 @@ var mappingBootVolumeBackupSourceType = map[string]BootVolumeBackupSourceTypeEnu
"SCHEDULED": BootVolumeBackupSourceTypeScheduled,
}
// GetBootVolumeBackupSourceTypeEnumValues Enumerates the set of values for BootVolumeBackupSourceType
// GetBootVolumeBackupSourceTypeEnumValues Enumerates the set of values for BootVolumeBackupSourceTypeEnum
func GetBootVolumeBackupSourceTypeEnumValues() []BootVolumeBackupSourceTypeEnum {
values := make([]BootVolumeBackupSourceTypeEnum, 0)
for _, v := range mappingBootVolumeBackupSourceType {
@ -140,7 +159,7 @@ func GetBootVolumeBackupSourceTypeEnumValues() []BootVolumeBackupSourceTypeEnum
// BootVolumeBackupTypeEnum Enum with underlying type: string
type BootVolumeBackupTypeEnum string
// Set of constants representing the allowable values for BootVolumeBackupType
// Set of constants representing the allowable values for BootVolumeBackupTypeEnum
const (
BootVolumeBackupTypeFull BootVolumeBackupTypeEnum = "FULL"
BootVolumeBackupTypeIncremental BootVolumeBackupTypeEnum = "INCREMENTAL"
@ -151,7 +170,7 @@ var mappingBootVolumeBackupType = map[string]BootVolumeBackupTypeEnum{
"INCREMENTAL": BootVolumeBackupTypeIncremental,
}
// GetBootVolumeBackupTypeEnumValues Enumerates the set of values for BootVolumeBackupType
// GetBootVolumeBackupTypeEnumValues Enumerates the set of values for BootVolumeBackupTypeEnum
func GetBootVolumeBackupTypeEnumValues() []BootVolumeBackupTypeEnum {
values := make([]BootVolumeBackupTypeEnum, 0)
for _, v := range mappingBootVolumeBackupType {

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// BootVolumeKmsKey The Key Management master encryption key associated with this volume.
type BootVolumeKmsKey struct {
// The OCID of the Key Management key assigned to this volume. If the volume is not using Key Management, then the `kmsKeyId` will be a null string.
KmsKeyId *string `mandatory:"false" json:"kmsKeyId"`
}
func (m BootVolumeKmsKey) String() string {
return common.PointerString(m)
}

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
@ -40,6 +45,11 @@ func (m *bootvolumesourcedetails) UnmarshalJSON(data []byte) error {
// UnmarshalPolymorphicJSON unmarshals polymorphic json
func (m *bootvolumesourcedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {
if data == nil || string(data) == "null" {
return nil, nil
}
var err error
switch m.Type {
case "bootVolumeBackup":
@ -51,7 +61,7 @@ func (m *bootvolumesourcedetails) UnmarshalPolymorphicJSON(data []byte) (interfa
err = json.Unmarshal(data, &mm)
return mm, err
default:
return m, nil
return *m, nil
}
}

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core

View File

@ -1,9 +1,14 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// APIs for Networking Service, Compute Service, and Block Volume Service.
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
@ -18,17 +23,17 @@ type CaptureConsoleHistoryDetails struct {
// The OCID of the instance to get the console history from.
InstanceId *string `mandatory:"true" json:"instanceId"`
// Defined tags for this resource. Each key is predefined and scoped to a namespace.
// For more information, see Resource Tags (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
// Defined tags for this resource. Each key is predefined and scoped to a
// namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
// Example: `{"Operations": {"CostCenter": "42"}}`
DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
// A user-friendly name. Does not have to be unique, and it's changeable.
// Avoid entering confidential information.
DisplayName *string `mandatory:"false" json:"displayName"`
// Free-form tags for this resource. Each tag is a simple key-value pair with no
// predefined name, type, or namespace. For more information, see
// Resource Tags (https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
// predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
// Example: `{"Department": "Finance"}`
FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
}

View File

@ -1,4 +1,5 @@
// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
@ -56,8 +57,8 @@ type CaptureConsoleHistoryResponse struct {
// 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.
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeBootVolumeBackupCompartmentDetails Contains the details for the compartment to move the boot volume backup to.
type ChangeBootVolumeBackupCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the boot volume backup to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeBootVolumeBackupCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,65 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeBootVolumeBackupCompartmentRequest wrapper for the ChangeBootVolumeBackupCompartment operation
type ChangeBootVolumeBackupCompartmentRequest struct {
// The OCID of the boot volume backup.
BootVolumeBackupId *string `mandatory:"true" contributesTo:"path" name:"bootVolumeBackupId"`
// Request to change the compartment of given boot volume backup.
ChangeBootVolumeBackupCompartmentDetails `contributesTo:"body"`
// Unique 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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeBootVolumeBackupCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeBootVolumeBackupCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeBootVolumeBackupCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeBootVolumeBackupCompartmentResponse wrapper for the ChangeBootVolumeBackupCompartment operation
type ChangeBootVolumeBackupCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeBootVolumeBackupCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeBootVolumeBackupCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeBootVolumeCompartmentDetails Contains the details for the compartment to move the boot volume to.
type ChangeBootVolumeCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the boot volume to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeBootVolumeCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,65 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeBootVolumeCompartmentRequest wrapper for the ChangeBootVolumeCompartment operation
type ChangeBootVolumeCompartmentRequest struct {
// The OCID of the boot volume.
BootVolumeId *string `mandatory:"true" contributesTo:"path" name:"bootVolumeId"`
// Request to change the compartment of given boot volume.
ChangeBootVolumeCompartmentDetails `contributesTo:"body"`
// Unique 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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeBootVolumeCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeBootVolumeCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeBootVolumeCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeBootVolumeCompartmentResponse wrapper for the ChangeBootVolumeCompartment operation
type ChangeBootVolumeCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeBootVolumeCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeBootVolumeCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeClusterNetworkCompartmentDetails The configuration details for the move operation.
type ChangeClusterNetworkCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment
// into which the resource should be moved.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeClusterNetworkCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,77 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeClusterNetworkCompartmentRequest wrapper for the ChangeClusterNetworkCompartment operation
type ChangeClusterNetworkCompartmentRequest struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the cluster network.
ClusterNetworkId *string `mandatory:"true" contributesTo:"path" name:"clusterNetworkId"`
// Request to change the compartment of given cluster network.
ChangeClusterNetworkCompartmentDetails `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"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeClusterNetworkCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeClusterNetworkCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeClusterNetworkCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeClusterNetworkCompartmentResponse wrapper for the ChangeClusterNetworkCompartment operation
type ChangeClusterNetworkCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeClusterNetworkCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeClusterNetworkCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeCpeCompartmentDetails The configuration details for the move operation.
type ChangeCpeCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// CPE object to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeCpeCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeCpeCompartmentRequest wrapper for the ChangeCpeCompartment operation
type ChangeCpeCompartmentRequest struct {
// The OCID of the CPE.
CpeId *string `mandatory:"true" contributesTo:"path" name:"cpeId"`
// Request to change the compartment of a CPE.
ChangeCpeCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeCpeCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeCpeCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeCpeCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeCpeCompartmentResponse wrapper for the ChangeCpeCompartment operation
type ChangeCpeCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeCpeCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeCpeCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeCrossConnectCompartmentDetails The configuration details for the move operation.
type ChangeCrossConnectCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// cross-connect to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeCrossConnectCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeCrossConnectCompartmentRequest wrapper for the ChangeCrossConnectCompartment operation
type ChangeCrossConnectCompartmentRequest struct {
// The OCID of the cross-connect.
CrossConnectId *string `mandatory:"true" contributesTo:"path" name:"crossConnectId"`
// Request to change the compartment of a Cross Connect.
ChangeCrossConnectCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeCrossConnectCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeCrossConnectCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeCrossConnectCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeCrossConnectCompartmentResponse wrapper for the ChangeCrossConnectCompartment operation
type ChangeCrossConnectCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeCrossConnectCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeCrossConnectCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeCrossConnectGroupCompartmentDetails The configuration details for the move operation.
type ChangeCrossConnectGroupCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// cross-connect group to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeCrossConnectGroupCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeCrossConnectGroupCompartmentRequest wrapper for the ChangeCrossConnectGroupCompartment operation
type ChangeCrossConnectGroupCompartmentRequest struct {
// The OCID of the cross-connect group.
CrossConnectGroupId *string `mandatory:"true" contributesTo:"path" name:"crossConnectGroupId"`
// Request to change the compartment of a Cross Connect Group.
ChangeCrossConnectGroupCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeCrossConnectGroupCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeCrossConnectGroupCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeCrossConnectGroupCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeCrossConnectGroupCompartmentResponse wrapper for the ChangeCrossConnectGroupCompartment operation
type ChangeCrossConnectGroupCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeCrossConnectGroupCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeCrossConnectGroupCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeDedicatedVmHostCompartmentDetails Specifies the compartment to move the dedicated virtual machine host to.
type ChangeDedicatedVmHostCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment
// to move the dedicated virtual machine host to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeDedicatedVmHostCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,81 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeDedicatedVmHostCompartmentRequest wrapper for the ChangeDedicatedVmHostCompartment operation
type ChangeDedicatedVmHostCompartmentRequest struct {
// The OCID of the dedicated VM host.
DedicatedVmHostId *string `mandatory:"true" contributesTo:"path" name:"dedicatedVmHostId"`
// The request to move the dedicated virtual machine host to a different compartment.
ChangeDedicatedVmHostCompartmentDetails `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"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeDedicatedVmHostCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeDedicatedVmHostCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeDedicatedVmHostCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeDedicatedVmHostCompartmentResponse wrapper for the ChangeDedicatedVmHostCompartment operation
type ChangeDedicatedVmHostCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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"`
// The OCID of the work request. Use GetWorkRequest (https://docs.cloud.oracle.com/api/#/en/workrequests/20160918/WorkRequest/GetWorkRequest)
// with this ID to track the status of the request.
OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"`
}
func (response ChangeDedicatedVmHostCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeDedicatedVmHostCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeDhcpOptionsCompartmentDetails The configuration details for the move operation.
type ChangeDhcpOptionsCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// set of DHCP options to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeDhcpOptionsCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeDhcpOptionsCompartmentRequest wrapper for the ChangeDhcpOptionsCompartment operation
type ChangeDhcpOptionsCompartmentRequest struct {
// The OCID for the set of DHCP options.
DhcpId *string `mandatory:"true" contributesTo:"path" name:"dhcpId"`
// Request to change the compartment of a set of DHCP Options.
ChangeDhcpOptionsCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeDhcpOptionsCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeDhcpOptionsCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeDhcpOptionsCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeDhcpOptionsCompartmentResponse wrapper for the ChangeDhcpOptionsCompartment operation
type ChangeDhcpOptionsCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeDhcpOptionsCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeDhcpOptionsCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeDrgCompartmentDetails The configuration details for the move operation.
type ChangeDrgCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// DRG to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeDrgCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,76 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeDrgCompartmentRequest wrapper for the ChangeDrgCompartment operation
type ChangeDrgCompartmentRequest struct {
// The OCID of the DRG.
DrgId *string `mandatory:"true" contributesTo:"path" name:"drgId"`
// Request to change the compartment of a DRG.
ChangeDrgCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeDrgCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeDrgCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeDrgCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeDrgCompartmentResponse wrapper for the ChangeDrgCompartment operation
type ChangeDrgCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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"`
// The OCID of the work request. Use GetWorkRequest (https://docs.cloud.oracle.com/api/#/en/workrequests/20160918/WorkRequest/GetWorkRequest)
// with this ID to track the status of the request.
OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"`
}
func (response ChangeDrgCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeDrgCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeIPSecConnectionCompartmentRequest wrapper for the ChangeIPSecConnectionCompartment operation
type ChangeIPSecConnectionCompartmentRequest struct {
// The OCID of the IPSec connection.
IpscId *string `mandatory:"true" contributesTo:"path" name:"ipscId"`
// Request to change the compartment of a Ipsec Connection.
ChangeIpSecConnectionCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeIPSecConnectionCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeIPSecConnectionCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeIPSecConnectionCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeIPSecConnectionCompartmentResponse wrapper for the ChangeIPSecConnectionCompartment operation
type ChangeIPSecConnectionCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeIPSecConnectionCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeIPSecConnectionCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeImageCompartmentDetails The configuration details for the move operation.
type ChangeImageCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment to move the image to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeImageCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,77 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeImageCompartmentRequest wrapper for the ChangeImageCompartment operation
type ChangeImageCompartmentRequest struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the image.
ImageId *string `mandatory:"true" contributesTo:"path" name:"imageId"`
// Request to change the compartment of a given image.
ChangeImageCompartmentDetails `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"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeImageCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeImageCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeImageCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeImageCompartmentResponse wrapper for the ChangeImageCompartment operation
type ChangeImageCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeImageCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeImageCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeInstanceCompartmentDetails The configuration details for the move operation.
type ChangeInstanceCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment to move the instance to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeInstanceCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,81 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeInstanceCompartmentRequest wrapper for the ChangeInstanceCompartment operation
type ChangeInstanceCompartmentRequest struct {
// The OCID of the instance.
InstanceId *string `mandatory:"true" contributesTo:"path" name:"instanceId"`
// Request to change the compartment of a given instance.
ChangeInstanceCompartmentDetails `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"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeInstanceCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeInstanceCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeInstanceCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeInstanceCompartmentResponse wrapper for the ChangeInstanceCompartment operation
type ChangeInstanceCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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"`
// The OCID of the work request. Use GetWorkRequest (https://docs.cloud.oracle.com/api/#/en/workrequests/20160918/WorkRequest/GetWorkRequest)
// with this ID to track the status of the request.
OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"`
}
func (response ChangeInstanceCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeInstanceCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeInstanceConfigurationCompartmentDetails The configuration details for the move operation.
type ChangeInstanceConfigurationCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment to
// move the instance configuration to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeInstanceConfigurationCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,77 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeInstanceConfigurationCompartmentRequest wrapper for the ChangeInstanceConfigurationCompartment operation
type ChangeInstanceConfigurationCompartmentRequest struct {
// The OCID of the instance configuration.
InstanceConfigurationId *string `mandatory:"true" contributesTo:"path" name:"instanceConfigurationId"`
// Request to change the compartment of given instance configuration.
ChangeInstanceConfigurationCompartmentDetails `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"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeInstanceConfigurationCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeInstanceConfigurationCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeInstanceConfigurationCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeInstanceConfigurationCompartmentResponse wrapper for the ChangeInstanceConfigurationCompartment operation
type ChangeInstanceConfigurationCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeInstanceConfigurationCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeInstanceConfigurationCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeInstancePoolCompartmentDetails The configuration details for the move operation.
type ChangeInstancePoolCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment to
// move the instance pool to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeInstancePoolCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,77 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeInstancePoolCompartmentRequest wrapper for the ChangeInstancePoolCompartment operation
type ChangeInstancePoolCompartmentRequest struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the instance pool.
InstancePoolId *string `mandatory:"true" contributesTo:"path" name:"instancePoolId"`
// Request to change the compartment of given instance pool.
ChangeInstancePoolCompartmentDetails `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"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeInstancePoolCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeInstancePoolCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeInstancePoolCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeInstancePoolCompartmentResponse wrapper for the ChangeInstancePoolCompartment operation
type ChangeInstancePoolCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeInstancePoolCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeInstancePoolCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeInternetGatewayCompartmentDetails The configuration details for the move operation.
type ChangeInternetGatewayCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// internet gateway to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeInternetGatewayCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeInternetGatewayCompartmentRequest wrapper for the ChangeInternetGatewayCompartment operation
type ChangeInternetGatewayCompartmentRequest struct {
// The OCID of the internet gateway.
IgId *string `mandatory:"true" contributesTo:"path" name:"igId"`
// Request to change the compartment of an internet gateway.
ChangeInternetGatewayCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeInternetGatewayCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeInternetGatewayCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeInternetGatewayCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeInternetGatewayCompartmentResponse wrapper for the ChangeInternetGatewayCompartment operation
type ChangeInternetGatewayCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeInternetGatewayCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeInternetGatewayCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeIpSecConnectionCompartmentDetails The configuration details for the move operation.
type ChangeIpSecConnectionCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// IPSec connection to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeIpSecConnectionCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeLocalPeeringGatewayCompartmentDetails The configuration details for the move operation.
type ChangeLocalPeeringGatewayCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// local peering gateway to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeLocalPeeringGatewayCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeLocalPeeringGatewayCompartmentRequest wrapper for the ChangeLocalPeeringGatewayCompartment operation
type ChangeLocalPeeringGatewayCompartmentRequest struct {
// The OCID of the local peering gateway.
LocalPeeringGatewayId *string `mandatory:"true" contributesTo:"path" name:"localPeeringGatewayId"`
// Request to change the compartment of a given local peering gateway.
ChangeLocalPeeringGatewayCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeLocalPeeringGatewayCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeLocalPeeringGatewayCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeLocalPeeringGatewayCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeLocalPeeringGatewayCompartmentResponse wrapper for the ChangeLocalPeeringGatewayCompartment operation
type ChangeLocalPeeringGatewayCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeLocalPeeringGatewayCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeLocalPeeringGatewayCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeNatGatewayCompartmentDetails The configuration details for the move operation.
type ChangeNatGatewayCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the NAT gateway to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeNatGatewayCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeNatGatewayCompartmentRequest wrapper for the ChangeNatGatewayCompartment operation
type ChangeNatGatewayCompartmentRequest struct {
// The NAT gateway's OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm).
NatGatewayId *string `mandatory:"true" contributesTo:"path" name:"natGatewayId"`
// Request to change the compartment of a given NAT Gateway.
ChangeNatGatewayCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeNatGatewayCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeNatGatewayCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeNatGatewayCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeNatGatewayCompartmentResponse wrapper for the ChangeNatGatewayCompartment operation
type ChangeNatGatewayCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeNatGatewayCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeNatGatewayCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeNetworkSecurityGroupCompartmentDetails The representation of ChangeNetworkSecurityGroupCompartmentDetails
type ChangeNetworkSecurityGroupCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the network
// security group to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeNetworkSecurityGroupCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangeNetworkSecurityGroupCompartmentRequest wrapper for the ChangeNetworkSecurityGroupCompartment operation
type ChangeNetworkSecurityGroupCompartmentRequest struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the network security group.
NetworkSecurityGroupId *string `mandatory:"true" contributesTo:"path" name:"networkSecurityGroupId"`
// Request to change the compartment of a network security group.
ChangeNetworkSecurityGroupCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangeNetworkSecurityGroupCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeNetworkSecurityGroupCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangeNetworkSecurityGroupCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeNetworkSecurityGroupCompartmentResponse wrapper for the ChangeNetworkSecurityGroupCompartment operation
type ChangeNetworkSecurityGroupCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangeNetworkSecurityGroupCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeNetworkSecurityGroupCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangePublicIpCompartmentDetails The configuration details for the move operation.
type ChangePublicIpCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// public IP to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangePublicIpCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,72 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
package core
import (
"github.com/oracle/oci-go-sdk/common"
"net/http"
)
// ChangePublicIpCompartmentRequest wrapper for the ChangePublicIpCompartment operation
type ChangePublicIpCompartmentRequest struct {
// The OCID of the public IP.
PublicIpId *string `mandatory:"true" contributesTo:"path" name:"publicIpId"`
// Request to change the compartment of a Public IP.
ChangePublicIpCompartmentDetails `contributesTo:"body"`
// Unique 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 (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"`
// Metadata about the request. This information will not be transmitted to the service, but
// represents information that the SDK will consume to drive retry behavior.
RequestMetadata common.RequestMetadata
}
func (request ChangePublicIpCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangePublicIpCompartmentRequest) HTTPRequest(method, path string) (http.Request, error) {
return common.MakeDefaultHTTPRequestWithTaggedStruct(method, path, request)
}
// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request ChangePublicIpCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangePublicIpCompartmentResponse wrapper for the ChangePublicIpCompartment operation
type ChangePublicIpCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// 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 ChangePublicIpCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangePublicIpCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,30 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// API covering the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services. Use this API
// to manage resources such as virtual cloud networks (VCNs), compute instances, and
// block storage volumes.
//
package core
import (
"github.com/oracle/oci-go-sdk/common"
)
// ChangeRemotePeeringConnectionCompartmentDetails The configuration details for the move operation.
type ChangeRemotePeeringConnectionCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment to move the
// remote peering connection to.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeRemotePeeringConnectionCompartmentDetails) String() string {
return common.PointerString(m)
}

Some files were not shown because too many files have changed in this diff Show More