Merge pull request #10833 from harveylowndes/add-oci-flex-shape-support

Support OCI flexible shapes
This commit is contained in:
Megan Marsh 2021-03-30 10:11:47 -07:00 committed by GitHub
commit dfc5d76108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
757 changed files with 12482 additions and 2307 deletions

View File

@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/oracle/oci-go-sdk/core"
"github.com/oracle/oci-go-sdk/v36/core"
)
// Artifact is an artifact implementation that contains a built Custom Image.

View File

@ -12,7 +12,7 @@ import (
"github.com/hashicorp/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
ocommon "github.com/hashicorp/packer/builder/oracle/common"
"github.com/oracle/oci-go-sdk/core"
"github.com/oracle/oci-go-sdk/v36/core"
)
// BuilderId uniquely identifies the builder

View File

@ -1,4 +1,4 @@
//go:generate mapstructure-to-hcl2 -type Config,CreateVNICDetails,ListImagesRequest
//go:generate mapstructure-to-hcl2 -type Config,CreateVNICDetails,ListImagesRequest,FlexShapeConfig
package oci
@ -19,8 +19,8 @@ import (
"github.com/hashicorp/packer-plugin-sdk/pathing"
"github.com/hashicorp/packer-plugin-sdk/template/config"
"github.com/hashicorp/packer-plugin-sdk/template/interpolate"
ocicommon "github.com/oracle/oci-go-sdk/common"
ociauth "github.com/oracle/oci-go-sdk/common/auth"
ocicommon "github.com/oracle/oci-go-sdk/v36/common"
ociauth "github.com/oracle/oci-go-sdk/v36/common/auth"
)
type CreateVNICDetails struct {
@ -46,6 +46,11 @@ type ListImagesRequest struct {
Shape *string `mapstructure:"shape"`
}
type FlexShapeConfig struct {
Ocpus *float32 `mapstructure:"ocpus" required:"false"`
MemoryInGBs *float32 `mapstructure:"memory_in_gbs" required:"false"`
}
type Config struct {
common.PackerConfig `mapstructure:",squash"`
Comm communicator.Config `mapstructure:",squash"`
@ -91,6 +96,7 @@ type Config struct {
InstanceTags map[string]string `mapstructure:"instance_tags"`
InstanceDefinedTags map[string]map[string]interface{} `mapstructure:"instance_defined_tags"`
Shape string `mapstructure:"shape"`
ShapeConfig FlexShapeConfig `mapstructure:"shape_config"`
BootVolumeSizeInGBs int64 `mapstructure:"disk_size"`
// Metadata optionally contains custom metadata key/value pairs provided in the
@ -222,7 +228,7 @@ func (c *Config) Prepare(raws ...interface{}) error {
}
providers := []ocicommon.ConfigurationProvider{
NewRawConfigurationProvider(c.TenancyID, c.UserID, c.Region, c.Fingerprint, string(keyContent), &c.PassPhrase),
ocicommon.NewRawConfigurationProvider(c.TenancyID, c.UserID, c.Region, c.Fingerprint, string(keyContent), &c.PassPhrase),
}
if fileProvider != nil {
@ -277,6 +283,18 @@ func (c *Config) Prepare(raws ...interface{}) error {
errs, errors.New("'shape' must be specified"))
}
if strings.HasSuffix(c.Shape, "Flex") {
if c.ShapeConfig.Ocpus == nil {
errs = packersdk.MultiErrorAppend(
errs, errors.New("'Ocpus' must be specified when using flexible shapes"))
}
}
if c.ShapeConfig.MemoryInGBs != nil && c.ShapeConfig.Ocpus == nil {
errs = packersdk.MultiErrorAppend(
errs, errors.New("'Ocpus' must be specified if memory_in_gbs is specified"))
}
if (c.SubnetID == "") && (c.CreateVnicDetails.SubnetId == nil) {
errs = packersdk.MultiErrorAppend(
errs, errors.New("'subnet_ocid' must be specified"))

View File

@ -1,4 +1,4 @@
// Code generated by "mapstructure-to-hcl2 -type Config,CreateVNICDetails,ListImagesRequest"; DO NOT EDIT.
// Code generated by "mapstructure-to-hcl2 -type Config,CreateVNICDetails,ListImagesRequest,FlexShapeConfig"; DO NOT EDIT.
package oci
@ -88,6 +88,7 @@ type FlatConfig struct {
InstanceTags map[string]string `mapstructure:"instance_tags" cty:"instance_tags" hcl:"instance_tags"`
InstanceDefinedTags map[string]map[string]interface{} `mapstructure:"instance_defined_tags" cty:"instance_defined_tags" hcl:"instance_defined_tags"`
Shape *string `mapstructure:"shape" cty:"shape" hcl:"shape"`
ShapeConfig *FlatFlexShapeConfig `mapstructure:"shape_config" cty:"shape_config" hcl:"shape_config"`
BootVolumeSizeInGBs *int64 `mapstructure:"disk_size" cty:"disk_size" hcl:"disk_size"`
Metadata map[string]string `mapstructure:"metadata" cty:"metadata" hcl:"metadata"`
UserData *string `mapstructure:"user_data" cty:"user_data" hcl:"user_data"`
@ -188,6 +189,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"instance_tags": &hcldec.AttrSpec{Name: "instance_tags", Type: cty.Map(cty.String), Required: false},
"instance_defined_tags": &hcldec.AttrSpec{Name: "instance_defined_tags", Type: cty.Map(cty.String), Required: false},
"shape": &hcldec.AttrSpec{Name: "shape", Type: cty.String, Required: false},
"shape_config": &hcldec.BlockSpec{TypeName: "shape_config", Nested: hcldec.ObjectSpec((*FlatFlexShapeConfig)(nil).HCL2Spec())},
"disk_size": &hcldec.AttrSpec{Name: "disk_size", Type: cty.Number, Required: false},
"metadata": &hcldec.AttrSpec{Name: "metadata", Type: cty.Map(cty.String), Required: false},
"user_data": &hcldec.AttrSpec{Name: "user_data", Type: cty.String, Required: false},
@ -239,6 +241,31 @@ func (*FlatCreateVNICDetails) HCL2Spec() map[string]hcldec.Spec {
return s
}
// FlatFlexShapeConfig is an auto-generated flat version of FlexShapeConfig.
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatFlexShapeConfig struct {
Ocpus *float32 `mapstructure:"ocpus" required:"false" cty:"ocpus" hcl:"ocpus"`
MemoryInGBs *float32 `mapstructure:"memory_in_gbs" required:"false" cty:"memory_in_gbs" hcl:"memory_in_gbs"`
}
// FlatMapstructure returns a new FlatFlexShapeConfig.
// FlatFlexShapeConfig is an auto-generated flat version of FlexShapeConfig.
// Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*FlexShapeConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec } {
return new(FlatFlexShapeConfig)
}
// HCL2Spec returns the hcl spec of a FlexShapeConfig.
// This spec is used by HCL to read the fields of FlexShapeConfig.
// The decoded values from this spec will then be applied to a FlatFlexShapeConfig.
func (*FlatFlexShapeConfig) HCL2Spec() map[string]hcldec.Spec {
s := map[string]hcldec.Spec{
"ocpus": &hcldec.AttrSpec{Name: "ocpus", Type: cty.Number, Required: false},
"memory_in_gbs": &hcldec.AttrSpec{Name: "memory_in_gbs", Type: cty.Number, Required: false},
}
return s
}
// FlatListImagesRequest is an auto-generated flat version of ListImagesRequest.
// Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatListImagesRequest struct {

View File

@ -1,76 +0,0 @@
package oci
import (
"crypto/rsa"
"errors"
"fmt"
"github.com/oracle/oci-go-sdk/common"
)
// rawConfigurationProvider allows a user to simply construct a configuration
// provider from raw values. It errors on access when those values are empty.
type rawConfigurationProvider struct {
tenancy string
user string
region string
fingerprint string
privateKey string
privateKeyPassphrase *string
}
// NewRawConfigurationProvider will create a rawConfigurationProvider.
func NewRawConfigurationProvider(tenancy, user, region, fingerprint, privateKey string, privateKeyPassphrase *string) common.ConfigurationProvider {
return rawConfigurationProvider{tenancy, user, region, fingerprint, privateKey, privateKeyPassphrase}
}
func (p rawConfigurationProvider) PrivateRSAKey() (key *rsa.PrivateKey, err error) {
return common.PrivateKeyFromBytes([]byte(p.privateKey), p.privateKeyPassphrase)
}
func (p rawConfigurationProvider) KeyID() (keyID string, err error) {
tenancy, err := p.TenancyOCID()
if err != nil {
return
}
user, err := p.UserOCID()
if err != nil {
return
}
fingerprint, err := p.KeyFingerprint()
if err != nil {
return
}
return fmt.Sprintf("%s/%s/%s", tenancy, user, fingerprint), nil
}
func (p rawConfigurationProvider) TenancyOCID() (string, error) {
if p.tenancy == "" {
return "", errors.New("no tenancy provided")
}
return p.tenancy, nil
}
func (p rawConfigurationProvider) UserOCID() (string, error) {
if p.user == "" {
return "", errors.New("no user provided")
}
return p.user, nil
}
func (p rawConfigurationProvider) KeyFingerprint() (string, error) {
if p.fingerprint == "" {
return "", errors.New("no fingerprint provided")
}
return p.fingerprint, nil
}
func (p rawConfigurationProvider) Region() (string, error) {
if p.region == "" {
return "", errors.New("no region provided")
}
return p.region, nil
}

View File

@ -131,7 +131,7 @@ func TestConfig(t *testing.T) {
t.Run("NoAccessConfig", func(t *testing.T) {
raw := testConfig(cfgFile)
delete(raw, "access_cfg_file")
raw["access_cfg_file"] = "/tmp/random/access/config/file/should/not/exist"
var c Config
errs := c.Prepare(raw)
@ -140,6 +140,10 @@ func TestConfig(t *testing.T) {
"'user_ocid'", "'tenancy_ocid'", "'fingerprint'", "'key_file'",
}
if errs == nil {
t.Fatalf("Expected errors %q but got none", expectedErrors)
}
s := errs.Error()
for _, expected := range expectedErrors {
if !strings.Contains(s, expected) {

View File

@ -3,7 +3,7 @@ package oci
import (
"context"
"github.com/oracle/oci-go-sdk/core"
"github.com/oracle/oci-go-sdk/v36/core"
)
// Driver interfaces between the builder steps and the OCI SDK.

View File

@ -3,7 +3,7 @@ package oci
import (
"context"
"github.com/oracle/oci-go-sdk/core"
"github.com/oracle/oci-go-sdk/v36/core"
)
// driverMock implements the Driver interface and communicates with Oracle

View File

@ -11,8 +11,8 @@ import (
"sync/atomic"
"time"
"github.com/oracle/oci-go-sdk/common"
core "github.com/oracle/oci-go-sdk/core"
"github.com/oracle/oci-go-sdk/v36/common"
core "github.com/oracle/oci-go-sdk/v36/core"
)
// driverOCI implements the Driver interface and communicates with Oracle
@ -158,6 +158,14 @@ func (d *driverOCI) CreateInstance(ctx context.Context, publicKey string) (strin
Metadata: metadata,
}
if d.cfg.ShapeConfig.Ocpus != nil {
LaunchInstanceShapeConfigDetails := core.LaunchInstanceShapeConfigDetails{
Ocpus: d.cfg.ShapeConfig.Ocpus,
MemoryInGBs: d.cfg.ShapeConfig.MemoryInGBs,
}
instanceDetails.ShapeConfig = &LaunchInstanceShapeConfigDetails
}
instance, err := d.computeClient.LaunchInstance(context.TODO(), core.LaunchInstanceRequest{
LaunchInstanceDetails: instanceDetails,
RequestMetadata: requestMetadata,

View File

@ -3,6 +3,8 @@ package oci
import (
"crypto/rand"
"crypto/rsa"
"github.com/oracle/oci-go-sdk/v36/common"
)
// Mock struct to be used during testing to obtain Instance Principals.
@ -32,3 +34,10 @@ func (p instancePrincipalConfigurationProviderMock) KeyFingerprint() (string, er
func (p instancePrincipalConfigurationProviderMock) Region() (string, error) {
return "some_random_region", nil
}
func (p instancePrincipalConfigurationProviderMock) AuthType() (common.AuthConfig, error) {
return common.AuthConfig{
AuthType: common.InstancePrincipal,
IsFromConfigFile: false,
OboToken: nil}, nil
}

3
go.mod
View File

@ -70,7 +70,8 @@ require (
github.com/mitchellh/prefixedio v0.0.0-20151214002211-6e6954073784
github.com/mitchellh/reflectwalk v1.0.0
github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b
github.com/oracle/oci-go-sdk v24.3.0+incompatible
github.com/oracle/oci-go-sdk v18.0.0+incompatible // indirect
github.com/oracle/oci-go-sdk/v36 v36.2.0
github.com/outscale/osc-sdk-go/osc v0.0.0-20200722135656-d654809d0699
github.com/pierrec/lz4 v2.0.5+incompatible
github.com/pkg/errors v0.9.1

3
go.sum
View File

@ -569,9 +569,12 @@ github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQ
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 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/oracle/oci-go-sdk v24.3.0+incompatible h1:x4mcfb4agelf1O4/1/auGlZ1lr97jXRSSN5MxTgG/zU=
github.com/oracle/oci-go-sdk v24.3.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
github.com/oracle/oci-go-sdk/v36 v36.2.0 h1:oBaN/FnBDy3ohMyVZ/rKfekYxnyksG2KK0YAhT5HSnk=
github.com/oracle/oci-go-sdk/v36 v36.2.0/go.mod h1:t8Y/M3Lh8X4BOJhtThJKe1skRTg7qom7oWyHiNjo4RM=
github.com/outscale/osc-sdk-go/osc v0.0.0-20200722135656-d654809d0699 h1:SHe9i7h5cHe+cB77fQ6lsEgIwKg3ckNU90P03CjGMnI=
github.com/outscale/osc-sdk-go/osc v0.0.0-20200722135656-d654809d0699/go.mod h1:5AqqNH1X8zCHescKVlpSHRzrat1KCKDXqZoQPe8fY3A=
github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a h1:A3QMuteviunoaY/8ex+RKFqwhcZJ/Cf3fCW3IwL2wx4=

View File

@ -1,34 +0,0 @@
// 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"
)
// InstanceConfigurationLaunchInstanceAgentConfigDetails Instance agent configuration options to choose for launching the instance
type InstanceConfigurationLaunchInstanceAgentConfigDetails struct {
// Whether the agent running on the instance can gather performance metrics and monitor the instance.
// Default value is false.
IsMonitoringDisabled *bool `mandatory:"false" json:"isMonitoringDisabled"`
// Whether the agent running on the instance can run all the available management plugins.
// Default value is false.
IsManagementDisabled *bool `mandatory:"false" json:"isManagementDisabled"`
}
func (m InstanceConfigurationLaunchInstanceAgentConfigDetails) String() string {
return common.PointerString(m)
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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,7 +9,7 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
"sync"
)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
@ -6,7 +6,7 @@ package auth
import (
"crypto/rsa"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
type instancePrincipalConfigurationProvider struct {
@ -104,3 +104,7 @@ func (p instancePrincipalConfigurationProvider) Region() (string, error) {
}
return string(*p.region), nil
}
func (p instancePrincipalConfigurationProvider) AuthType() (common.AuthConfig, error) {
return common.AuthConfig{common.InstancePrincipal, false, nil}, fmt.Errorf("unsupported, keep the interface")
}

View File

@ -1,9 +1,9 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
import "github.com/oracle/oci-go-sdk/common"
import "github.com/oracle/oci-go-sdk/v36/common"
//dispatcherModifier gives ability to modify a HTTPRequestDispatcher before use.
type dispatcherModifier struct {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
@ -12,7 +12,7 @@ import (
"encoding/pem"
"errors"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
"io/ioutil"
"net/http"
"os"
@ -107,7 +107,7 @@ func newFileBasedFederationClient(securityTokenPath string, supplier sessionKeyS
}
var newToken securityToken
if newToken, err = newInstancePrincipalToken(string(content)); err != nil {
if newToken, err = newPrincipalToken(string(content)); err != nil {
return nil, fmt.Errorf("failed to read security token from :%s. Due to: %s", securityTokenPath, err.Error())
}
@ -119,7 +119,7 @@ func newFileBasedFederationClient(securityTokenPath string, supplier sessionKeyS
func newStaticFederationClient(sessionToken string, supplier sessionKeySupplier) (*genericFederationClient, error) {
var newToken securityToken
var err error
if newToken, err = newInstancePrincipalToken(string(sessionToken)); err != nil {
if newToken, err = newPrincipalToken(string(sessionToken)); err != nil {
return nil, fmt.Errorf("failed to read security token. Due to: %s", err.Error())
}
@ -307,7 +307,7 @@ func (c *x509FederationClient) getSecurityToken() (securityToken, error) {
return nil, fmt.Errorf("failed to unmarshal the response: %s", err.Error())
}
return newInstancePrincipalToken(response.Token.Token)
return newPrincipalToken(response.Token.Token)
}
func (c *x509FederationClient) GetClaim(key string) (interface{}, error) {
@ -535,24 +535,24 @@ type securityToken interface {
ClaimHolder
}
type instancePrincipalToken struct {
type principalToken struct {
tokenString string
jwtToken *jwtToken
}
func newInstancePrincipalToken(tokenString string) (newToken securityToken, err error) {
func newPrincipalToken(tokenString string) (newToken securityToken, err error) {
var jwtToken *jwtToken
if jwtToken, err = parseJwt(tokenString); err != nil {
return nil, fmt.Errorf("failed to parse the token string \"%s\": %s", tokenString, err.Error())
}
return &instancePrincipalToken{tokenString, jwtToken}, nil
return &principalToken{tokenString, jwtToken}, nil
}
func (t *instancePrincipalToken) String() string {
func (t *principalToken) String() string {
return t.tokenString
}
func (t *instancePrincipalToken) Valid() bool {
func (t *principalToken) Valid() bool {
return !t.jwtToken.expired()
}
@ -561,7 +561,7 @@ var (
ErrNoSuchClaim = errors.New("no such claim")
)
func (t *instancePrincipalToken) GetClaim(key string) (interface{}, error) {
func (t *principalToken) GetClaim(key string) (interface{}, error) {
if value, ok := t.jwtToken.payload[key]; ok {
return value, nil
}

View File

@ -0,0 +1,67 @@
// Copyright (c) 2016, 2018, 2021, 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
import (
"crypto/rsa"
"fmt"
"github.com/oracle/oci-go-sdk/v36/common"
)
type instancePrincipalDelegationTokenConfigurationProvider struct {
instancePrincipalKeyProvider instancePrincipalKeyProvider
delegationToken string
}
//InstancePrincipalDelegationTokenConfigurationProvider returns a configuration for obo token instance principals
func InstancePrincipalDelegationTokenConfigurationProvider(delegationToken *string) (common.ConfigurationProvider, error) {
if delegationToken == nil || len(*delegationToken) == 0 {
return nil, fmt.Errorf("failed to create a delagationTokenConfigurationProvider: token is a mondatory input paras")
}
return newInstancePrincipalDelegationTokenConfigurationProvider(delegationToken, nil)
}
func newInstancePrincipalDelegationTokenConfigurationProvider(delegationToken *string, modifier func(common.HTTPRequestDispatcher) (common.HTTPRequestDispatcher,
error)) (common.ConfigurationProvider, error) {
keyProvider, err := newInstancePrincipalKeyProvider(modifier)
if err != nil {
return nil, fmt.Errorf("failed to create a new key provider for instance principal: %s", err.Error())
}
return instancePrincipalDelegationTokenConfigurationProvider{*keyProvider, *delegationToken}, err
}
func (p instancePrincipalDelegationTokenConfigurationProvider) getInstancePrincipalDelegationTokenConfigurationProvider() (instancePrincipalDelegationTokenConfigurationProvider, error) {
return p, nil
}
func (p instancePrincipalDelegationTokenConfigurationProvider) PrivateRSAKey() (*rsa.PrivateKey, error) {
return p.instancePrincipalKeyProvider.PrivateRSAKey()
}
func (p instancePrincipalDelegationTokenConfigurationProvider) KeyID() (string, error) {
return p.instancePrincipalKeyProvider.KeyID()
}
func (p instancePrincipalDelegationTokenConfigurationProvider) TenancyOCID() (string, error) {
return p.instancePrincipalKeyProvider.TenancyOCID()
}
func (p instancePrincipalDelegationTokenConfigurationProvider) UserOCID() (string, error) {
return "", nil
}
func (p instancePrincipalDelegationTokenConfigurationProvider) KeyFingerprint() (string, error) {
return "", nil
}
func (p instancePrincipalDelegationTokenConfigurationProvider) Region() (string, error) {
region := p.instancePrincipalKeyProvider.RegionForFederationClient()
return string(region), nil
}
func (p instancePrincipalDelegationTokenConfigurationProvider) AuthType() (common.AuthConfig, error) {
token := p.delegationToken
return common.AuthConfig{common.InstancePrincipalDelegationToken, false, &token}, nil
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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,7 +7,7 @@ import (
"bytes"
"crypto/rsa"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
"strings"
)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
@ -8,7 +8,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
"strings"
"time"
)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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,13 +7,13 @@ import (
"crypto/rsa"
"errors"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
"os"
"path"
)
const (
//ResourcePrincipalVersion2_2 supported version for resource principals
//ResourcePrincipalVersion2_2 is a supported version for resource principals
ResourcePrincipalVersion2_2 = "2.2"
//ResourcePrincipalVersionEnvVar environment var name for version
ResourcePrincipalVersionEnvVar = "OCI_RESOURCE_PRINCIPAL_VERSION"
@ -26,6 +26,13 @@ const (
//ResourcePrincipalRegionEnvVar environment variable holding a region
ResourcePrincipalRegionEnvVar = "OCI_RESOURCE_PRINCIPAL_REGION"
//ResourcePrincipalVersion1_1 is a supported version for resource principals
ResourcePrincipalVersion1_1 = "1.1"
//ResourcePrincipalSessionTokenEndpoint endpoint for retrieving the Resource Principal Session Token
ResourcePrincipalSessionTokenEndpoint = "OCI_RESOURCE_PRINCIPAL_RPST_ENDPOINT"
//ResourcePrincipalTokenEndpoint endpoint for retrieving the Resource Principal Token
ResourcePrincipalTokenEndpoint = "OCI_RESOURCE_PRINCIPAL_RPT_ENDPOINT"
// 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
@ -65,11 +72,45 @@ func ResourcePrincipalConfigurationProvider() (ConfigurationProviderWithClaimAcc
}
return newResourcePrincipalKeyProvider22(
*rpst, *private, passphrase, *region)
case ResourcePrincipalVersion1_1:
return newResourcePrincipalKeyProvider11(DefaultRptPathProvider{})
default:
return nil, fmt.Errorf("can not create resource principal, environment variable: %s, must be valid", ResourcePrincipalVersionEnvVar)
}
}
// ResourcePrincipalConfigurationProviderWithPathProvider returns a resource principal configuration provider using path provider.
func ResourcePrincipalConfigurationProviderWithPathProvider(pathProvider PathProvider) (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)
} else if version != ResourcePrincipalVersion1_1 {
return nil, fmt.Errorf("can not create resource principal, environment variable: %s, must be %s", ResourcePrincipalVersionEnvVar, ResourcePrincipalVersion1_1)
}
return newResourcePrincipalKeyProvider11(pathProvider)
}
func newResourcePrincipalKeyProvider11(pathProvider PathProvider) (ConfigurationProviderWithClaimAccess, error) {
rptEndpoint := requireEnv(ResourcePrincipalTokenEndpoint)
if rptEndpoint == nil {
return nil, fmt.Errorf("can not create resource principal, environment variable: %s, not present", ResourcePrincipalTokenEndpoint)
}
rptPath, err := pathProvider.Path()
if err != nil {
return nil, fmt.Errorf("can not create resource principal, due to: %s ", err.Error())
}
resourceID, err := pathProvider.ResourceID()
if err != nil {
return nil, fmt.Errorf("can not create resource principal, due to: %s ", err.Error())
}
rp, err := resourcePrincipalConfigurationProviderV1(*rptEndpoint+*rptPath, *resourceID)
if err != nil {
return nil, fmt.Errorf("can not create resource principal, due to: %s ", err.Error())
}
return rp, nil
}
func requireEnv(key string) *string {
if val, ok := os.LookupEnv(key); ok {
return &val
@ -179,6 +220,10 @@ func (p *resourcePrincipalKeyProvider) UserOCID() (string, error) {
return "", nil
}
func (p *resourcePrincipalKeyProvider) AuthType() (common.AuthConfig, error) {
return common.AuthConfig{common.UnknownAuthenticationType, false, nil}, fmt.Errorf("unsupported, keep the interface")
}
// 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 {

View File

@ -0,0 +1,138 @@
// Copyright (c) 2016, 2018, 2021, 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
import (
"fmt"
"io/ioutil"
"net/http"
)
const (
imdsPathTemplate = "/20180711/resourcePrincipalToken/{id}"
instanceIDURL = `http://169.254.169.254/opc/v2/instance/id`
//ResourcePrincipalTokenPath path for retrieving the Resource Principal Token
ResourcePrincipalTokenPath = "OCI_RESOURCE_PRINCIPAL_RPT_PATH"
//ResourceID OCID for the resource for Resource Principal
ResourceID = "OCI_RESOURCE_PRINCIPAL_RPT_ID"
)
// PathProvider is an interface that returns path and resource ID
type PathProvider interface {
Path() (*string, error)
ResourceID() (*string, error)
}
// StringRptPathProvider is a simple path provider that takes a string and returns it
type StringRptPathProvider struct {
path string
resourceID string
}
// Path returns the resource principal token path
func (pp StringRptPathProvider) Path() (*string, error) {
return &pp.path, nil
}
// ResourceID returns the resource associated with the resource principal
func (pp StringRptPathProvider) ResourceID() (*string, error) {
return &pp.resourceID, nil
}
// ImdsRptPathProvider sets the path from a default value and the resource ID from instance metadata
type ImdsRptPathProvider struct{}
// Path returns the resource principal token path
func (pp ImdsRptPathProvider) Path() (*string, error) {
path := imdsPathTemplate
return &path, nil
}
// ResourceID returns the resource associated with the resource principal
func (pp ImdsRptPathProvider) ResourceID() (*string, error) {
instanceID, err := getInstanceIDFromMetadata()
return &instanceID, err
}
// EnvRptPathProvider sets the path and resource ID from environment variables
type EnvRptPathProvider struct{}
// Path returns the resource principal token path
func (pp EnvRptPathProvider) Path() (*string, error) {
path := requireEnv(ResourcePrincipalTokenPath)
if path == nil {
return nil, fmt.Errorf("missing %s env var", ResourcePrincipalTokenPath)
}
return path, nil
}
// ResourceID returns the resource associated with the resource principal
func (pp EnvRptPathProvider) ResourceID() (*string, error) {
rpID := requireEnv(ResourceID)
if rpID == nil {
return nil, fmt.Errorf("missing %s env var", ResourceID)
}
return rpID, nil
}
//DefaultRptPathProvider path provider makes sure the behavior happens with the correct fallback.
//
//For the path,
//Use the contents of the OCI_RESOURCE_PRINCIPAL_RPT_PATH environment variable, if set.
//Otherwise, use the current path: "/20180711/resourcePrincipalToken/{id}"
//
//For the resource id,
//Use the contents of the OCI_RESOURCE_PRINCIPAL_RPT_ID environment variable, if set.
//Otherwise, use IMDS to get the instance id
//
//This path provider is used when the caller doesn't provide a specific path provider to the resource principals signer
type DefaultRptPathProvider struct {
path string
resourceID string
}
// Path returns the resource principal token path
func (pp DefaultRptPathProvider) Path() (*string, error) {
path := requireEnv(ResourcePrincipalTokenPath)
if path == nil {
rpPath := imdsPathTemplate
return &rpPath, nil
}
return path, nil
}
// ResourceID returns the resource associated with the resource principal
func (pp DefaultRptPathProvider) ResourceID() (*string, error) {
rpID := requireEnv(ResourceID)
if rpID == nil {
instanceID, err := getInstanceIDFromMetadata()
if err != nil {
return nil, err
}
return &instanceID, nil
}
return rpID, nil
}
func getInstanceIDFromMetadata() (instanceID string, err error) {
client := &http.Client{}
req, err := http.NewRequest("GET", instanceIDURL, nil)
if err != nil {
return "", err
}
req.Header.Set("Authorization", "Bearer Oracle")
resp, err := client.Do(req)
if err != nil {
return "", err
}
defer resp.Body.Close()
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return "", err
}
bodyString := string(bodyBytes)
return bodyString, nil
}

View File

@ -0,0 +1,373 @@
// Copyright (c) 2016, 2018, 2021, 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
import (
"context"
"crypto/rsa"
"fmt"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
"net/url"
"sync"
"time"
)
// resourcePrincipalFederationClient is the client used to to talk acquire resource principals
// No auth client, leaf or intermediate retrievers. We use certificates retrieved by instance principals to sign the operations of
// resource principals
type resourcePrincipalFederationClient struct {
tenancyID string
instanceID string
sessionKeySupplier sessionKeySupplier
mux sync.Mutex
securityToken securityToken
path string
//instancePrincipalKeyProvider the instance Principal Key container
instancePrincipalKeyProvider instancePrincipalKeyProvider
//ResourcePrincipalTargetServiceClient client that calls the target service to acquire a resource principal token
ResourcePrincipalTargetServiceClient common.BaseClient
//ResourcePrincipalSessionTokenClient. The client used to communicate with identity to exchange a resource principal for
// resource principal session token
ResourcePrincipalSessionTokenClient common.BaseClient
}
type resourcePrincipalTokenRequest struct {
InstanceID string `contributesTo:"path" name:"id"`
}
type resourcePrincipalTokenResponse struct {
Body struct {
ResourcePrincipalToken string `json:"resourcePrincipalToken"`
ServicePrincipalSessionToken string `json:"servicePrincipalSessionToken"`
} `presentIn:"body"`
}
type resourcePrincipalSessionTokenRequestBody struct {
ResourcePrincipalToken string `json:"resourcePrincipalToken,omitempty"`
ServicePrincipalSessionToken string `json:"servicePrincipalSessionToken,omitempty"`
SessionPublicKey string `json:"sessionPublicKey,omitempty"`
}
type resourcePrincipalSessionTokenRequest struct {
Body resourcePrincipalSessionTokenRequestBody `contributesTo:"body"`
}
//acquireResourcePrincipalToken acquires the resource principal from the target service
func (c *resourcePrincipalFederationClient) acquireResourcePrincipalToken() (tokenResponse resourcePrincipalTokenResponse, err error) {
rpServiceClient := c.ResourcePrincipalTargetServiceClient
//Set the signer of this client to be the instance principal provider
rpServiceClient.Signer = common.DefaultRequestSigner(&c.instancePrincipalKeyProvider)
//Create a request with the instanceId
request, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodGet, c.path, resourcePrincipalTokenRequest{InstanceID: c.instanceID})
if err != nil {
return
}
//Call the target service
response, err := rpServiceClient.Call(context.Background(), &request)
if err != nil {
return
}
defer common.CloseBodyIfValid(response)
tokenResponse = resourcePrincipalTokenResponse{}
err = common.UnmarshalResponse(response, &tokenResponse)
return
}
//exchangeToken exchanges a resource principal token from the target service with a session token from identity
func (c *resourcePrincipalFederationClient) exchangeToken(publicKeyBase64 string, tokenResponse resourcePrincipalTokenResponse) (sessionToken string, err error) {
rpServiceClient := c.ResourcePrincipalSessionTokenClient
//Set the signer of this client to be the instance principal provider
rpServiceClient.Signer = common.DefaultRequestSigner(&c.instancePrincipalKeyProvider)
// Call identity service to get resource principal session token
sessionTokenReq := resourcePrincipalSessionTokenRequest{
resourcePrincipalSessionTokenRequestBody{
ServicePrincipalSessionToken: tokenResponse.Body.ServicePrincipalSessionToken,
ResourcePrincipalToken: tokenResponse.Body.ResourcePrincipalToken,
SessionPublicKey: publicKeyBase64,
},
}
sessionTokenHTTPReq, err := common.MakeDefaultHTTPRequestWithTaggedStruct(http.MethodPost,
"", sessionTokenReq)
if err != nil {
return
}
sessionTokenHTTPRes, err := rpServiceClient.Call(context.Background(), &sessionTokenHTTPReq)
if err != nil {
return
}
defer common.CloseBodyIfValid(sessionTokenHTTPRes)
sessionTokenRes := x509FederationResponse{}
err = common.UnmarshalResponse(sessionTokenHTTPRes, &sessionTokenRes)
if err != nil {
return
}
sessionToken = sessionTokenRes.Token.Token
return
}
//getSecurityToken makes the appropiate calls to acquire a resource principal security token
func (c *resourcePrincipalFederationClient) getSecurityToken() (securityToken, error) {
var err error
ipFederationClient := c.instancePrincipalKeyProvider.FederationClient
common.Debugf("Refreshing instance principal token")
//Refresh instance principal token
if refreshable, ok := ipFederationClient.(*x509FederationClient); ok {
err = refreshable.renewSecurityTokenIfNotValid()
if err != nil {
return nil, err
}
}
//Acquire resource principal token from target service
common.Debugf("Acquiring resource principal token from target service")
tokenResponse, err := c.acquireResourcePrincipalToken()
if err != nil {
return nil, err
}
//Read the public key from the session supplier.
pem := c.sessionKeySupplier.PublicKeyPemRaw()
pemSanitized := sanitizeCertificateString(string(pem))
//Exchange resource principal token for session token from identity
common.Debugf("Exchanging resource principal token for resource principal session token")
sessionToken, err := c.exchangeToken(pemSanitized, tokenResponse)
if err != nil {
return nil, err
}
return newPrincipalToken(sessionToken) // should be a resource principal token
}
func (c *resourcePrincipalFederationClient) renewSecurityToken() (err error) {
if err = c.sessionKeySupplier.Refresh(); err != nil {
return fmt.Errorf("failed to refresh session key: %s", err.Error())
}
common.Logf("Renewing resource principal 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("Resource principal security token renewed at: %v\n", time.Now().Format("15:04:05.000"))
return nil
}
//ResourcePrincipal Key provider in charge of resource principal acquiring tokens
type resourcePrincipalKeyProviderV1 struct {
ResourcePrincipalClient resourcePrincipalFederationClient
}
func (c *resourcePrincipalFederationClient) renewSecurityTokenIfNotValid() (err error) {
if c.securityToken == nil || !c.securityToken.Valid() {
if err = c.renewSecurityToken(); err != nil {
return fmt.Errorf("failed to renew resource prinicipal security token: %s", err.Error())
}
}
return nil
}
func (c *resourcePrincipalFederationClient) PrivateKey() (*rsa.PrivateKey, error) {
c.mux.Lock()
defer c.mux.Unlock()
if err := c.renewSecurityTokenIfNotValid(); err != nil {
return nil, err
}
return c.sessionKeySupplier.PrivateKey(), nil
}
func (c *resourcePrincipalFederationClient) SecurityToken() (token string, err error) {
c.mux.Lock()
defer c.mux.Unlock()
if err = c.renewSecurityTokenIfNotValid(); err != nil {
return "", err
}
return c.securityToken.String(), nil
}
func (p *resourcePrincipalConfigurationProvider) PrivateRSAKey() (privateKey *rsa.PrivateKey, err error) {
if privateKey, err = p.keyProvider.ResourcePrincipalClient.PrivateKey(); err != nil {
err = fmt.Errorf("failed to get resource principal private key: %s", err.Error())
return nil, err
}
return privateKey, nil
}
func (p *resourcePrincipalConfigurationProvider) KeyID() (string, error) {
var securityToken string
var err error
if securityToken, err = p.keyProvider.ResourcePrincipalClient.SecurityToken(); err != nil {
return "", fmt.Errorf("failed to get resource principal security token: %s", err.Error())
}
return fmt.Sprintf("ST$%s", securityToken), nil
}
func (p *resourcePrincipalConfigurationProvider) TenancyOCID() (string, error) {
return p.keyProvider.ResourcePrincipalClient.instancePrincipalKeyProvider.TenancyOCID()
}
// todo what is this
func (p *resourcePrincipalConfigurationProvider) GetClaim(key string) (interface{}, error) {
return nil, nil
}
//Resource Principals
type resourcePrincipalConfigurationProvider struct {
keyProvider resourcePrincipalKeyProviderV1
region *common.Region
}
func newResourcePrincipalKeyProvider(ipKeyProvider instancePrincipalKeyProvider, rpTokenTargetServiceClient, rpSessionTokenClient common.BaseClient, instanceID, path string) (keyProvider resourcePrincipalKeyProviderV1, err error) {
rpFedClient := resourcePrincipalFederationClient{}
rpFedClient.tenancyID = ipKeyProvider.TenancyID
rpFedClient.instanceID = instanceID
rpFedClient.sessionKeySupplier = newSessionKeySupplier()
rpFedClient.ResourcePrincipalTargetServiceClient = rpTokenTargetServiceClient
rpFedClient.ResourcePrincipalSessionTokenClient = rpSessionTokenClient
rpFedClient.instancePrincipalKeyProvider = ipKeyProvider
rpFedClient.path = path
keyProvider = resourcePrincipalKeyProviderV1{ResourcePrincipalClient: rpFedClient}
return
}
func (p *resourcePrincipalConfigurationProvider) AuthType() (common.AuthConfig, error) {
return common.AuthConfig{common.UnknownAuthenticationType, false, nil},
fmt.Errorf("unsupported, keep the interface")
}
func (p resourcePrincipalConfigurationProvider) UserOCID() (string, error) {
return "", nil
}
func (p resourcePrincipalConfigurationProvider) KeyFingerprint() (string, error) {
return "", nil
}
func (p resourcePrincipalConfigurationProvider) Region() (string, error) {
if p.region == nil {
region := p.keyProvider.ResourcePrincipalClient.instancePrincipalKeyProvider.RegionForFederationClient()
common.Debugf("Region in resource principal configuration provider is nil. Returning instance principal federation clients region: %s", region)
return string(region), nil
}
return string(*p.region), nil
}
// resourcePrincipalConfigurationProviderForInstanceWithClients returns a configuration for instance principals
// resourcePrincipalTargetServiceTokenClient and resourcePrincipalSessionTokenClient are clients that at last need to have
// their base path and host properly set for their respective services. Additionally the clients can be further customized
// to provide mocking or any other customization for the requests/responses
func resourcePrincipalConfigurationProviderForInstanceWithClients(instancePrincipalProvider common.ConfigurationProvider,
resourcePrincipalTargetServiceTokenClient, resourcePrincipalSessionTokenClient common.BaseClient, instanceID, path string) (*resourcePrincipalConfigurationProvider, error) {
var ok bool
var ip instancePrincipalConfigurationProvider
if ip, ok = instancePrincipalProvider.(instancePrincipalConfigurationProvider); !ok {
return nil, fmt.Errorf("instancePrincipalConfigurationProvider needs to be of type vald Instance Principal Configuration Provider")
}
keyProvider, err := newResourcePrincipalKeyProvider(ip.keyProvider, resourcePrincipalTargetServiceTokenClient, resourcePrincipalSessionTokenClient, instanceID, path)
if err != nil {
return nil, err
}
provider := &resourcePrincipalConfigurationProvider{
region: nil,
keyProvider: keyProvider,
}
return provider, nil
}
const identityResourcePrincipalSessionTokenPath = "/v1/resourcePrincipalSessionToken"
// resourcePrincipalConfigurationProviderForInstanceWithInterceptor creates a resource principal configuration provider with
// a interceptor used to customize the call going to the resource principal token request to the target service
// for a given instance ID
func resourcePrincipalConfigurationProviderForInstanceWithInterceptor(instancePrincipalProvider common.ConfigurationProvider, resourcePrincipalTokenEndpoint, instanceID string, interceptor common.RequestInterceptor) (provider *resourcePrincipalConfigurationProvider, err error) {
//Build the target service client
rpTargetServiceClient, err := common.NewClientWithConfig(instancePrincipalProvider)
if err != nil {
return
}
rpTokenURL, err := url.Parse(resourcePrincipalTokenEndpoint)
if err != nil {
return
}
rpTargetServiceClient.Host = rpTokenURL.Scheme + "://" + rpTokenURL.Host
rpTargetServiceClient.Interceptor = interceptor
var path string
if rpTokenURL.Path != "" {
path = rpTokenURL.Path
} else {
path = identityResourcePrincipalSessionTokenPath
}
//Build the identity client for token service
rpTokenSessionClient, err := common.NewClientWithConfig(instancePrincipalProvider)
if err != nil {
return
}
// Set RPST endpoint if passed in from env var, otherwise create it from region
resourcePrincipalSessionTokenEndpoint := requireEnv(ResourcePrincipalSessionTokenEndpoint)
if resourcePrincipalSessionTokenEndpoint != nil {
rpSessionTokenURL, err := url.Parse(*resourcePrincipalSessionTokenEndpoint)
if err != nil {
return nil, err
}
rpTokenSessionClient.Host = rpSessionTokenURL.Scheme + "://" + rpSessionTokenURL.Host
} else {
regionStr, err := instancePrincipalProvider.Region()
if err != nil {
return nil, fmt.Errorf("missing RPST env var and cannot determine region: %v", err)
}
region := common.StringToRegion(regionStr)
rpTokenSessionClient.Host = fmt.Sprintf("https://%s", region.Endpoint("auth"))
}
rpTokenSessionClient.BasePath = identityResourcePrincipalSessionTokenPath
return resourcePrincipalConfigurationProviderForInstanceWithClients(instancePrincipalProvider, rpTargetServiceClient, rpTokenSessionClient, instanceID, path)
}
// ResourcePrincipalConfigurationProviderWithInterceptor creates a resource principal configuration provider with endpoints
// a interceptor used to customize the call going to the resource principal token request to the target service
// see https://godoc.org/github.com/oracle/oci-go-sdk/common#RequestInterceptor
func ResourcePrincipalConfigurationProviderWithInterceptor(instancePrincipalProvider common.ConfigurationProvider,
resourcePrincipalTokenEndpoint, resourcePrincipalSessionTokenEndpoint string,
interceptor common.RequestInterceptor) (common.ConfigurationProvider, error) {
return resourcePrincipalConfigurationProviderForInstanceWithInterceptor(instancePrincipalProvider, resourcePrincipalTokenEndpoint, "", interceptor)
}
// resourcePrincipalConfigurationProviderV1 creates a resource principal configuration provider with
// endpoints for both resource principal token and resource principal token session
func resourcePrincipalConfigurationProviderV1(resourcePrincipalTokenEndpoint, resourceID string) (*resourcePrincipalConfigurationProvider, error) {
instancePrincipalProvider, err := InstancePrincipalConfigurationProvider()
if err != nil {
return nil, err
}
return resourcePrincipalConfigurationProviderForInstanceWithInterceptor(instancePrincipalProvider, resourcePrincipalTokenEndpoint, resourceID, nil)
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
@ -8,7 +8,7 @@ import (
"crypto/sha1"
"crypto/x509"
"fmt"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
"net/http/httputil"
"strings"
@ -68,3 +68,27 @@ func colonSeparatedString(fingerprint [sha1.Size]byte) string {
spaceSeparated := fmt.Sprintf("% x", fingerprint)
return strings.Replace(spaceSeparated, " ", ":", -1)
}
func sanitizeCertificateString(certString string) string {
certString = strings.Replace(certString, "-----BEGIN CERTIFICATE-----", "", -1)
certString = strings.Replace(certString, "-----END CERTIFICATE-----", "", -1)
certString = strings.Replace(certString, "-----BEGIN PUBLIC KEY-----", "", -1)
certString = strings.Replace(certString, "-----END PUBLIC KEY-----", "", -1)
certString = strings.Replace(certString, "\n", "", -1)
return certString
}
// GetGenericConfigurationProvider checks auth config paras in config file and return the final configuration provider
func GetGenericConfigurationProvider(configProvider common.ConfigurationProvider) (common.ConfigurationProvider, error) {
if authConfig, err := configProvider.AuthType(); err == nil && authConfig.IsFromConfigFile {
switch authConfig.AuthType {
case common.InstancePrincipalDelegationToken:
return InstancePrincipalDelegationTokenConfigurationProvider(authConfig.OboToken)
case common.InstancePrincipal:
return InstancePrincipalConfigurationProvider()
case common.UserPrincipal:
return configProvider, nil
}
}
return configProvider, nil
}

View File

@ -1,12 +1,15 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"math/rand"
"net/http"
"net/http/httputil"
@ -71,8 +74,9 @@ const (
defaultConfigFileName = "config"
defaultConfigDirName = ".oci"
configFilePathEnvVarName = "OCI_CONFIG_FILE"
secondaryConfigDirName = ".oraclebmc"
maxBodyLenForDebug = 1024 * 1000
secondaryConfigDirName = ".oraclebmc"
maxBodyLenForDebug = 1024 * 1000
)
// RequestInterceptor function used to customize the request before calling the underlying service
@ -84,6 +88,11 @@ type HTTPRequestDispatcher interface {
Do(req *http.Request) (*http.Response, error)
}
// CustomClientConfiguration contains configurations set at client level, currently it only includes RetryPolicy
type CustomClientConfiguration struct {
RetryPolicy *RetryPolicy
}
// BaseClient struct implements all basic operations to call oci web services.
type BaseClient struct {
//HTTPClient performs the http network operations
@ -103,10 +112,36 @@ type BaseClient struct {
//Base path for all operations of this client
BasePath string
Configuration CustomClientConfiguration
}
// SetCustomClientConfiguration sets client with retry and other custom configurations
func (client *BaseClient) SetCustomClientConfiguration(config CustomClientConfiguration) {
client.Configuration = config
}
// RetryPolicy returns the retryPolicy configured for client
func (client *BaseClient) RetryPolicy() *RetryPolicy {
return client.Configuration.RetryPolicy
}
// Endpoint returns the enpoint configured for client
func (client *BaseClient) Endpoint() string {
host := client.Host
if !strings.Contains(host, "http") &&
!strings.Contains(host, "https") {
host = fmt.Sprintf("%s://%s", defaultScheme, host)
}
return host
}
func defaultUserAgent() string {
userAgent := fmt.Sprintf(defaultUserAgentTemplate, defaultSDKMarker, Version(), runtime.GOOS, runtime.GOARCH, runtime.Version())
appendUA := os.Getenv("OCI_SDK_APPEND_USER_AGENT")
if appendUA != "" {
userAgent = fmt.Sprintf("%s %s", userAgent, appendUA)
}
return userAgent
}
@ -158,6 +193,11 @@ func NewClientWithConfig(configProvider ConfigurationProvider) (client BaseClien
client = defaultBaseClient(configProvider)
if authConfig, e := configProvider.AuthType(); e == nil && authConfig.OboToken != nil {
Debugf("authConfig's authType is %s, and token content is %s", authConfig.AuthType, *authConfig.OboToken)
signOboToken(&client, *authConfig.OboToken, configProvider)
}
return
}
@ -168,6 +208,13 @@ func NewClientWithOboToken(configProvider ConfigurationProvider, oboToken string
return
}
signOboToken(&client, oboToken, configProvider)
return
}
// Add obo token header to Interceptor and sign to client
func signOboToken(client *BaseClient, oboToken string, configProvider ConfigurationProvider) {
// Interceptor to add obo token header
client.Interceptor = func(request *http.Request) error {
request.Header.Add(requestHeaderOpcOboToken, oboToken)
@ -176,8 +223,6 @@ func NewClientWithOboToken(configProvider ConfigurationProvider, oboToken string
// Obo token will also be signed
defaultHeaders := append(DefaultGenericHeaders(), requestHeaderOpcOboToken)
client.Signer = RequestSigner(configProvider, defaultHeaders, DefaultBodyHeaders())
return
}
func getHomeFolder() string {
@ -285,14 +330,72 @@ func (client BaseClient) intercept(request *http.Request) (err error) {
return
}
func checkForSuccessfulResponse(res *http.Response) error {
// checkForSuccessfulResponse checks if the response is successful
// If Error Code is 4XX/5XX and debug level is set to info, will log the request and response
func checkForSuccessfulResponse(res *http.Response, requestBody *io.ReadCloser) error {
familyStatusCode := res.StatusCode / 100
if familyStatusCode == 4 || familyStatusCode == 5 {
IfInfo(func() {
// If debug level is set to verbose, the request and request body will be dumped and logged under debug level, this is to avoid duplicate logging
if defaultLogger.LogLevel() < verboseLogging {
logRequest(res.Request, Logf, noLogging)
if requestBody != nil && *requestBody != http.NoBody {
bodyContent, _ := ioutil.ReadAll(*requestBody)
Logf("Dump Request Body: \n%s", string(bodyContent))
}
}
logResponse(res, Logf, infoLogging)
})
return newServiceFailureFromResponse(res)
}
IfDebug(func() {
logResponse(res, Debugf, verboseLogging)
})
return nil
}
func logRequest(request *http.Request, fn func(format string, v ...interface{}), bodyLoggingLevel int) {
if request == nil {
return
}
dumpBody := true
if checkBodyLengthExceedLimit(request.ContentLength) {
fn("not dumping body too big\n")
dumpBody = false
}
dumpBody = dumpBody && defaultLogger.LogLevel() >= bodyLoggingLevel && bodyLoggingLevel != noLogging
if dump, e := httputil.DumpRequestOut(request, dumpBody); e == nil {
fn("Dump Request %s", string(dump))
} else {
fn("%v\n", e)
}
}
func logResponse(response *http.Response, fn func(format string, v ...interface{}), bodyLoggingLevel int) {
if response == nil {
return
}
dumpBody := true
if checkBodyLengthExceedLimit(response.ContentLength) {
fn("not dumping body too big\n")
dumpBody = false
}
dumpBody = dumpBody && defaultLogger.LogLevel() >= bodyLoggingLevel && bodyLoggingLevel != noLogging
if dump, e := httputil.DumpResponse(response, dumpBody); e == nil {
fn("Dump Response %s", string(dump))
} else {
fn("%v\n", e)
}
}
func checkBodyLengthExceedLimit(contentLength int64) bool {
if contentLength > maxBodyLenForDebug {
return true
}
return false
}
// OCIRequest is any request made to an OCI service.
type OCIRequest interface {
// HTTPRequest assembles an HTTP request.
@ -329,7 +432,7 @@ func (client BaseClient) Call(ctx context.Context, request *http.Request) (respo
// 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")
Debugln("Attempting to call downstream service")
request = request.WithContext(ctx)
err = client.prepareRequest(request)
@ -349,48 +452,28 @@ func (client BaseClient) CallWithDetails(ctx context.Context, request *http.Requ
return
}
//Copy request body and save for logging
dumpRequestBody := ioutil.NopCloser(bytes.NewBuffer(nil))
if request.Body != nil && !checkBodyLengthExceedLimit(request.ContentLength) {
if dumpRequestBody, request.Body, err = drainBody(request.Body); err != nil {
dumpRequestBody = ioutil.NopCloser(bytes.NewBuffer(nil))
}
}
IfDebug(func() {
dumpBody := true
if request.ContentLength > maxBodyLenForDebug {
Debugf("not dumping body too big\n")
dumpBody = false
}
dumpBody = dumpBody && defaultLogger.LogLevel() == verboseLogging
if dump, e := httputil.DumpRequestOut(request, dumpBody); e == nil {
Debugf("Dump Request %s", string(dump))
} else {
Debugf("%v\n", e)
}
logRequest(request, Debugf, verboseLogging)
})
//Execute the http request
response, err = client.HTTPClient.Do(request)
IfDebug(func() {
if err != nil {
Debugf("%v\n", err)
return
}
dumpBody := true
if response.ContentLength > maxBodyLenForDebug {
Debugf("not dumping body too big\n")
dumpBody = false
}
dumpBody = dumpBody && defaultLogger.LogLevel() == verboseLogging
if dump, e := httputil.DumpResponse(response, dumpBody); e == nil {
Debugf("Dump Response %s", string(dump))
} else {
Debugf("%v\n", e)
}
})
if err != nil {
IfInfo(func() {
Logf("%v\n", err)
})
return
}
err = checkForSuccessfulResponse(response)
err = checkForSuccessfulResponse(response, &dumpRequestBody)
return
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
@ -33,10 +33,15 @@ const (
RegionIAD Region = "us-ashburn-1"
//RegionSJC1 region SJC
RegionSJC1 Region = "us-sanjose-1"
//RegionFRA region FRA
RegionFRA Region = "eu-frankfurt-1"
//RegionUKCardiff1 region for Cardiff
RegionUKCardiff1 Region = "uk-cardiff-1"
//RegionLHR region LHR
RegionLHR Region = "uk-london-1"
//RegionAPTokyo1 region for Tokyo
RegionAPTokyo1 Region = "ap-tokyo-1"
//RegionAPOsaka1 region for Osaka
@ -55,14 +60,21 @@ const (
RegionAPMelbourne1 Region = "ap-melbourne-1"
//RegionAPSydney1 region for Sydney
RegionAPSydney1 Region = "ap-sydney-1"
//RegionMEJeddah1 region for Jeddah
RegionMEJeddah1 Region = "me-jeddah-1"
//RegionMEDubai1 region for Dubai
RegionMEDubai1 Region = "me-dubai-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"
//RegionSASantiago1 region for santiago
RegionSASantiago1 Region = "sa-santiago-1"
//RegionUSLangley1 region for Langley
RegionUSLangley1 Region = "us-langley-1"
@ -100,6 +112,7 @@ var shortNameRegion = map[string]Region{
"iad": RegionIAD,
"fra": RegionFRA,
"lhr": RegionLHR,
"cwl": RegionUKCardiff1,
"ams": RegionEUAmsterdam1,
"zrh": RegionEUZurich1,
"mel": RegionAPMelbourne1,
@ -110,12 +123,14 @@ var shortNameRegion = map[string]Region{
"nrt": RegionAPTokyo1,
"kix": RegionAPOsaka1,
"nja": RegionAPChiyoda1,
"jed": RegionMEJeddah1,
"dxb": RegionMEDubai1,
"syd": RegionAPSydney1,
"yul": RegionCAMontreal1,
"yyz": RegionCAToronto1,
"sjc": RegionSJC1,
"gru": RegionSASaopaulo1,
"jed": RegionMEJeddah1,
"scl": RegionSASantiago1,
"ltn": RegionUKGovLondon1,
"brs": RegionUKGovCardiff1,
}
@ -129,13 +144,17 @@ var realm = map[string]string{
}
var regionRealm = map[Region]string{
RegionPHX: "oc1",
RegionIAD: "oc1",
RegionFRA: "oc1",
RegionLHR: "oc1",
RegionCAToronto1: "oc1",
RegionCAMontreal1: "oc1",
RegionSJC1: "oc1",
RegionPHX: "oc1",
RegionIAD: "oc1",
RegionFRA: "oc1",
RegionLHR: "oc1",
RegionSJC1: "oc1",
RegionUKCardiff1: "oc1",
RegionCAToronto1: "oc1",
RegionCAMontreal1: "oc1",
RegionAPTokyo1: "oc1",
RegionAPOsaka1: "oc1",
RegionAPSeoul1: "oc1",
@ -144,13 +163,19 @@ var regionRealm = map[Region]string{
RegionAPMumbai1: "oc1",
RegionAPHyderabad1: "oc1",
RegionAPMelbourne1: "oc1",
RegionMEJeddah1: "oc1",
RegionMEJeddah1: "oc1",
RegionMEDubai1: "oc1",
RegionEUZurich1: "oc1",
RegionEUAmsterdam1: "oc1",
RegionSASaopaulo1: "oc1",
RegionUSLangley1: "oc2",
RegionUSLuke1: "oc2",
RegionSASaopaulo1: "oc1",
RegionSASantiago1: "oc1",
RegionUSLangley1: "oc2",
RegionUSLuke1: "oc2",
RegionUSGovAshburn1: "oc3",
RegionUSGovChicago1: "oc3",
RegionUSGovPhoenix1: "oc3",

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
@ -14,6 +14,28 @@ import (
"strings"
)
// AuthenticationType for auth
type AuthenticationType string
const (
// UserPrincipal is default auth type
UserPrincipal AuthenticationType = "user_principal"
// InstancePrincipal is used for instance principle auth type
InstancePrincipal AuthenticationType = "instance_principal"
// InstancePrincipalDelegationToken is used for instance principle delegation token auth type
InstancePrincipalDelegationToken AuthenticationType = "instance_principle_delegation_token"
// UnknownAuthenticationType is used for none meaningful auth type
UnknownAuthenticationType AuthenticationType = "unknown_auth_type"
)
// AuthConfig is used for getting auth related paras in config file
type AuthConfig struct {
AuthType AuthenticationType
// IsFromConfigFile is used to point out if the authConfig is from configuration file
IsFromConfigFile bool
OboToken *string
}
// ConfigurationProvider wraps information about the account owner
type ConfigurationProvider interface {
KeyProvider
@ -21,9 +43,12 @@ type ConfigurationProvider interface {
UserOCID() (string, error)
KeyFingerprint() (string, error)
Region() (string, error)
// AuthType() is used for specify the needed auth type, like UserPrincipal, InstancePrincipal, etc.
AuthType() (AuthConfig, error)
}
// IsConfigurationProviderValid Tests all parts of the configuration provider do not return an error
// IsConfigurationProviderValid Tests all parts of the configuration provider do not return an error, this method will
// not check AuthType(), since authType() is not required to be there.
func IsConfigurationProviderValid(conf ConfigurationProvider) (ok bool, err error) {
baseFn := []func() (string, error){conf.TenancyOCID, conf.UserOCID, conf.KeyFingerprint, conf.Region, conf.KeyID}
for _, fn := range baseFn {
@ -105,6 +130,10 @@ func (p rawConfigurationProvider) Region() (string, error) {
return canStringBeRegion(p.region)
}
func (p rawConfigurationProvider) AuthType() (AuthConfig, error) {
return AuthConfig{UnknownAuthenticationType, false, nil}, nil
}
// environmentConfigurationProvider reads configuration from environment variables
type environmentConfigurationProvider struct {
PrivateKeyPassword string
@ -199,6 +228,11 @@ func (p environmentConfigurationProvider) Region() (value string, err error) {
return canStringBeRegion(value)
}
func (p environmentConfigurationProvider) AuthType() (AuthConfig, error) {
return AuthConfig{UnknownAuthenticationType, false, nil},
fmt.Errorf("unsupported, keep the interface")
}
// fileConfigurationProvider. reads configuration information from a file
type fileConfigurationProvider struct {
//The path to the configuration file
@ -241,8 +275,9 @@ func ConfigurationProviderFromFileWithProfile(configFilePath, profile, privateKe
}
type configFileInfo struct {
UserOcid, Fingerprint, KeyFilePath, TenancyOcid, Region, Passphrase, SecurityTokenFilePath string
PresentConfiguration byte
UserOcid, Fingerprint, KeyFilePath, TenancyOcid, Region, Passphrase, SecurityTokenFilePath, DelegationTokenFilePath,
AuthenticationType string
PresentConfiguration rune
}
const (
@ -253,6 +288,8 @@ const (
hasKeyFile
hasPassphrase
hasSecurityTokenFile
hasDelegationTokenFile
hasAuthenticationType
none
)
@ -279,7 +316,7 @@ func parseConfigFile(data []byte, profile string) (info *configFileInfo, err err
}
func parseConfigAtLine(start int, content []string) (info *configFileInfo, err error) {
var configurationPresent byte
var configurationPresent rune
info = &configFileInfo{}
for i := start; i < len(content); i++ {
line := content[i]
@ -314,6 +351,12 @@ func parseConfigAtLine(start int, content []string) (info *configFileInfo, err e
case "security_token_file":
configurationPresent = configurationPresent | hasSecurityTokenFile
info.SecurityTokenFilePath = value
case "delegation_token_file":
configurationPresent = configurationPresent | hasDelegationTokenFile
info.DelegationTokenFilePath = value
case "authentication_type":
configurationPresent = configurationPresent | hasAuthenticationType
info.AuthenticationType = value
}
}
info.PresentConfiguration = configurationPresent
@ -366,7 +409,7 @@ func (p fileConfigurationProvider) readAndParseConfigFile() (info *configFileInf
return p.FileInfo, err
}
func presentOrError(value string, expectedConf, presentConf byte, confMissing string) (string, error) {
func presentOrError(value string, expectedConf, presentConf rune, confMissing string) (string, error) {
if presentConf&expectedConf == expectedConf {
return value, nil
}
@ -421,7 +464,11 @@ func (p fileConfigurationProvider) KeyID() (keyID string, err error) {
return fmt.Sprintf("%s/%s/%s", info.TenancyOcid, info.UserOcid, info.Fingerprint), nil
}
if filePath, err := presentOrError(info.SecurityTokenFilePath, hasSecurityTokenFile, info.PresentConfiguration, "securityTokenFilePath"); err == nil {
return getSecurityToken(filePath)
rawString, err := getTokenContent(filePath)
if err != nil {
return "", err
}
return "ST$" + rawString, nil
}
err = fmt.Errorf("can not read SecurityTokenFilePath from configuration file due to: %s", err.Error())
return
@ -476,14 +523,39 @@ func (p fileConfigurationProvider) Region() (value string, err error) {
return canStringBeRegion(value)
}
func getSecurityToken(filePath string) (string, error) {
func (p fileConfigurationProvider) AuthType() (AuthConfig, error) {
info, err := p.readAndParseConfigFile()
if err != nil {
err = fmt.Errorf("can not read tenancy configuration due to: %s", err.Error())
return AuthConfig{UnknownAuthenticationType, true, nil}, err
}
val, err := presentOrError(info.AuthenticationType, hasAuthenticationType, info.PresentConfiguration, "authentication_type")
if val == "instance_principal" {
if filePath, err := presentOrError(info.DelegationTokenFilePath, hasDelegationTokenFile, info.PresentConfiguration, "delegationTokenFilePath"); err == nil {
if delegationToken, err := getTokenContent(filePath); err == nil && delegationToken != "" {
Debugf("delegation token content is %s, and error is %s ", delegationToken, err)
return AuthConfig{InstancePrincipalDelegationToken, true, &delegationToken}, nil
}
return AuthConfig{UnknownAuthenticationType, true, nil}, err
}
// normal instance principle
return AuthConfig{InstancePrincipal, true, nil}, nil
}
// by default, if no "authentication_type" is provided, just treated as user principle type, and will not return error
return AuthConfig{UserPrincipal, true, nil}, nil
}
func getTokenContent(filePath string) (string, error) {
expandedPath := expandPath(filePath)
tokenFileContent, err := ioutil.ReadFile(expandedPath)
if err != nil {
err = fmt.Errorf("can not read PrivateKey from configuration file due to: %s", err.Error())
err = fmt.Errorf("can not read token content from configuration file due to: %s", err.Error())
return "", err
}
return fmt.Sprintf("ST$%s", tokenFileContent), nil
return fmt.Sprintf("%s", tokenFileContent), nil
}
// A configuration provider that look for information in multiple configuration providers
@ -569,6 +641,15 @@ func (c composingConfigurationProvider) PrivateRSAKey() (*rsa.PrivateKey, error)
return nil, fmt.Errorf("did not find a proper configuration for private key")
}
func (c composingConfigurationProvider) AuthType() (AuthConfig, error) {
// only check the first default fileConfigProvider
authConfig, err := c.Providers[0].AuthType()
if err == nil && authConfig.AuthType != UnknownAuthenticationType {
return authConfig, nil
}
return AuthConfig{UnknownAuthenticationType, false, nil}, fmt.Errorf("did not find a proper configuration for auth type")
}
func getRegionFromEnvVar() (string, error) {
regionEnvVar := "OCI_REGION"
if region, existed := os.LookupEnv(regionEnvVar); existed {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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 +9,7 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"net/textproto"
"reflect"
"strconv"
"strings"
@ -255,6 +256,16 @@ func parsePKCSPrivateKey(decryptedKey []byte) (*rsa.PrivateKey, error) {
return nil, fmt.Errorf("failed to parse private key")
}
// parseContentLength trims whitespace from cl and returns -1 if can't purse uint, or the value if it's no less than 0
func parseContentLength(cl string) int64 {
cl = textproto.TrimString(cl)
n, err := strconv.ParseUint(cl, 10, 63)
if err != nil {
return -1
}
return int64(n)
}
func generateRandUUID() (string, error) {
b := make([]byte, 16)
_, err := rand.Read(b)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
@ -11,6 +11,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
@ -249,7 +250,7 @@ func removeNilFieldsInJSONWithTaggedStruct(rawJSON []byte, value reflect.Value)
return json.Marshal(fixedMap)
}
func addToBody(request *http.Request, value reflect.Value, field reflect.StructField) (e error) {
func addToBody(request *http.Request, value reflect.Value, field reflect.StructField, binaryBodySpecified *bool) (e error) {
Debugln("Marshaling to body from field:", field.Name)
if request.Body != nil {
Logf("The body of the request is already set. Structure: %s will overwrite it\n", field.Name)
@ -258,6 +259,7 @@ func addToBody(request *http.Request, value reflect.Value, field reflect.StructF
encoding := tag.Get("encoding")
if encoding == "binary" {
*binaryBodySpecified = true
return addBinaryBody(request, value, field)
}
@ -279,12 +281,52 @@ func addToBody(request *http.Request, value reflect.Value, field reflect.StructF
request.Header.Set(requestHeaderContentLength, strconv.FormatInt(request.ContentLength, 10))
request.Header.Set(requestHeaderContentType, "application/json")
request.Body = ioutil.NopCloser(bodyBytes)
snapshot := *bodyBytes
request.GetBody = func() (io.ReadCloser, error) {
return ioutil.NopCloser(bodyBytes), nil
r := snapshot
return ioutil.NopCloser(&r), nil
}
return
}
func checkBinaryBodyLength(request *http.Request) (contentLen int64, err error) {
if reflect.TypeOf(request.Body) == reflect.TypeOf(ioutil.NopCloser(nil)) {
ioReader := reflect.ValueOf(request.Body).Field(0).Interface().(io.Reader)
switch t := ioReader.(type) {
case *bytes.Reader:
return int64(t.Len()), nil
case *bytes.Buffer:
return int64(t.Len()), nil
case *strings.Reader:
return int64(t.Len()), nil
default:
return getNormalBinaryBodyLength(request)
}
}
if reflect.TypeOf(request.Body) == reflect.TypeOf((*os.File)(nil)) {
fi, err := (request.Body.(*os.File)).Stat()
if err != nil {
return contentLen, err
}
return fi.Size(), nil
}
return getNormalBinaryBodyLength(request)
}
func getNormalBinaryBodyLength(request *http.Request) (contentLen int64, err error) {
dumpRequestBody := ioutil.NopCloser(bytes.NewBuffer(nil))
if dumpRequestBody, request.Body, err = drainBody(request.Body); err != nil {
dumpRequestBody = ioutil.NopCloser(bytes.NewBuffer(nil))
return contentLen, err
}
contentBody, err := ioutil.ReadAll(dumpRequestBody)
if err != nil {
return contentLen, err
}
return int64(len(contentBody)), nil
}
func addToQuery(request *http.Request, value reflect.Value, field reflect.StructField) (e error) {
Debugln("Marshaling to query from field: ", field.Name)
if request.URL == nil {
@ -401,7 +443,7 @@ func addToPath(request *http.Request, value reflect.Value, field reflect.StructF
return
}
func setWellKnownHeaders(request *http.Request, headerName, headerValue string) (e error) {
func setWellKnownHeaders(request *http.Request, headerName, headerValue string, contentLenSpecified *bool) (e error) {
switch strings.ToLower(headerName) {
case "content-length":
var len int
@ -410,11 +452,12 @@ func setWellKnownHeaders(request *http.Request, headerName, headerValue string)
return
}
request.ContentLength = int64(len)
*contentLenSpecified = true
}
return nil
}
func addToHeader(request *http.Request, value reflect.Value, field reflect.StructField) (e error) {
func addToHeader(request *http.Request, value reflect.Value, field reflect.StructField, contentLenSpecified *bool) (e error) {
Debugln("Marshaling to header from field: ", field.Name)
if request.Header == nil {
request.Header = http.Header{}
@ -445,7 +488,7 @@ func addToHeader(request *http.Request, value reflect.Value, field reflect.Struc
return
}
if e = setWellKnownHeaders(request, headerName, headerValue); e != nil {
if e = setWellKnownHeaders(request, headerName, headerValue, contentLenSpecified); e != nil {
return
}
@ -459,7 +502,7 @@ func addToHeader(request *http.Request, value reflect.Value, field reflect.Struc
// Check if the header is required to be unique
func isUniqueHeaderRequired(headerName string) bool {
return strings.EqualFold(headerName, requestHeaderContentType)
return strings.EqualFold(headerName, requestHeaderContentType) || strings.EqualFold(headerName, requestHeaderContentLength)
}
// Header collection is a map of string to string that gets rendered as individual headers with a given prefix
@ -526,6 +569,8 @@ func checkForValidRequestStruct(s interface{}) (*reflect.Value, error) {
// nested structs are followed recursively depth-first.
func structToRequestPart(request *http.Request, val reflect.Value) (err error) {
typ := val.Type()
contentLenSpecified := false
binaryBodySpecified := false
for i := 0; i < typ.NumField(); i++ {
if err != nil {
return
@ -541,7 +586,7 @@ func structToRequestPart(request *http.Request, val reflect.Value) (err error) {
tag := sf.Tag.Get("contributesTo")
switch tag {
case "header":
err = addToHeader(request, sv, sf)
err = addToHeader(request, sv, sf, &contentLenSpecified)
case "header-collection":
err = addToHeaderCollection(request, sv, sf)
case "path":
@ -549,7 +594,7 @@ func structToRequestPart(request *http.Request, val reflect.Value) (err error) {
case "query":
err = addToQuery(request, sv, sf)
case "body":
err = addToBody(request, sv, sf)
err = addToBody(request, sv, sf, &binaryBodySpecified)
case "":
Debugln(sf.Name, " does not contain contributes tag. Skipping.")
default:
@ -557,6 +602,20 @@ func structToRequestPart(request *http.Request, val reflect.Value) (err error) {
}
}
// if content-length is not specified but with binary body, calculate the content length according to request body
if !contentLenSpecified && binaryBodySpecified && request.Body != nil && request.Body != http.NoBody {
contentLen, err := checkBinaryBodyLength(request)
if err == nil {
request.Header.Set(requestHeaderContentLength, strconv.FormatInt(contentLen, 10))
request.ContentLength = contentLen
}
}
//If content length is zero, to avoid sending transfer-coding: chunked header, need to explicitly set the body to nil/Nobody.
if request.Header != nil && request.Body != nil && request.Body != http.NoBody &&
parseContentLength(request.Header.Get(requestHeaderContentLength)) == 0 {
request.Body = http.NoBody
}
//If headers are and the content type was not set, we default to application/json
if request.Header != nil && request.Header.Get(requestHeaderContentType) == "" {
request.Header.Set(requestHeaderContentType, "application/json")
@ -750,7 +809,7 @@ func analyzeValue(stringValue string, kind reflect.Kind, field reflect.StructFie
return
}
// Sets the field of a struct, with the appropiate value of the string
// Sets the field of a struct, with the appropriate value of the string
// Only sets basic types
func fromStringValue(newValue string, val *reflect.Value, field reflect.StructField) (err error) {
@ -767,11 +826,12 @@ func fromStringValue(newValue string, val *reflect.Value, field reflect.StructFi
}
value, valPtr, err := analyzeValue(newValue, kind, field)
valueType := val.Type()
if err != nil {
return
}
if !isPointer {
val.Set(value)
val.Set(value.Convert(valueType))
} else {
val.Set(valPtr)
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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
@ -80,7 +80,7 @@ func newSDKLogger() (defaultSDKLogger, error) {
configured, isLogEnabled := os.LookupEnv("OCI_GO_SDK_DEBUG")
// If env variable not present turn logging of
// If env variable not present turn logging off
if !isLogEnabled {
logger.currentLoggingLevel = noLogging
} else {
@ -132,7 +132,7 @@ func (l defaultSDKLogger) getLoggerForLevel(logLevel int) *log.Logger {
// Output mode is switched based on environment variable "OCI_GO_SDK_LOG_OUPUT_MODE"
// "file" outputs log to a specific file
// "combine" outputs log to both stderr and specific file
// other unsupported value ouputs log to stderr
// other unsupported value outputs log to stderr
// output file can be set via environment variable "OCI_GO_SDK_LOG_FILE"
// if this environment variable is not set, a default log file will be created under project root path
func logOutputModeConfig(logger defaultSDKLogger) {
@ -221,3 +221,10 @@ func IfDebug(fn func()) {
fn()
}
}
// IfInfo executes closure if info is enabled
func IfInfo(fn func()) {
if defaultLogger.LogLevel() >= infoLogging {
fn()
}
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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

View File

@ -11,8 +11,8 @@ import (
)
const (
major = "24"
minor = "3"
major = "36"
minor = "2"
patch = "0"
tag = ""
)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,11 +14,13 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AddImageShapeCompatibilityEntryDetails Image shape compatibility details.
type AddImageShapeCompatibilityEntryDetails struct {
MemoryConstraints *ImageMemoryConstraints `mandatory:"false" json:"memoryConstraints"`
OcpuConstraints *ImageOcpuConstraints `mandatory:"false" json:"ocpuConstraints"`
}

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// AddImageShapeCompatibilityEntryRequest wrapper for the AddImageShapeCompatibilityEntry operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AddImageShapeCompatibilityEntry.go.html to see an example of how to use AddImageShapeCompatibilityEntryRequest.
type AddImageShapeCompatibilityEntryRequest struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the image.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AddNetworkSecurityGroupSecurityRulesDetails The representation of AddNetworkSecurityGroupSecurityRulesDetails

View File

@ -1,18 +1,22 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// AddNetworkSecurityGroupSecurityRulesRequest wrapper for the AddNetworkSecurityGroupSecurityRules operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AddNetworkSecurityGroupSecurityRules.go.html to see an example of how to use AddNetworkSecurityGroupSecurityRulesRequest.
type AddNetworkSecurityGroupSecurityRulesRequest struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the network security group.
// The OCID (https://docs.cloud.oracle.com/iaas/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.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,21 +14,20 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// LaunchInstanceAgentConfigDetails Instance agent configuration options to choose for launching the instance
type LaunchInstanceAgentConfigDetails struct {
// AddPublicIpPoolCapacityDetails The information used to add capacity to an IP pool.
type AddPublicIpPoolCapacityDetails struct {
// Whether the agent running on the instance can gather performance metrics and monitor the instance.
// Default value is false.
IsMonitoringDisabled *bool `mandatory:"false" json:"isMonitoringDisabled"`
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the `ByoipRange` resource to which the CIDR block belongs.
ByoipRangeId *string `mandatory:"true" json:"byoipRangeId"`
// Whether the agent running on the instance can run all the available management plugins.
// Default value is false.
IsManagementDisabled *bool `mandatory:"false" json:"isManagementDisabled"`
// The CIDR block to add to the public IP pool. It could be all of the CIDR block identified in `byoipRangeId`, or a subrange.
// Example: `10.0.1.0/24`
CidrBlock *string `mandatory:"true" json:"cidrBlock"`
}
func (m LaunchInstanceAgentConfigDetails) String() string {
func (m AddPublicIpPoolCapacityDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,79 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
"net/http"
)
// AddPublicIpPoolCapacityRequest wrapper for the AddPublicIpPoolCapacity operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AddPublicIpPoolCapacity.go.html to see an example of how to use AddPublicIpPoolCapacityRequest.
type AddPublicIpPoolCapacityRequest struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the public IP pool.
PublicIpPoolId *string `mandatory:"true" contributesTo:"path" name:"publicIpPoolId"`
// Byoip Range prefix and a cidr from it
AddPublicIpPoolCapacityDetails `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 AddPublicIpPoolCapacityRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request AddPublicIpPoolCapacityRequest) 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 AddPublicIpPoolCapacityRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// AddPublicIpPoolCapacityResponse wrapper for the AddPublicIpPoolCapacity operation
type AddPublicIpPoolCapacityResponse struct {
// The underlying http response
RawResponse *http.Response
// The PublicIpPool instance
PublicIpPool `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 AddPublicIpPoolCapacityResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response AddPublicIpPoolCapacityResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,13 +14,14 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/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 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
@ -37,7 +38,7 @@ type AddSecurityRuleDetails struct {
// 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).
// IPv6 Addresses (https://docs.cloud.oracle.com/iaas/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`.
@ -56,15 +57,6 @@ type AddSecurityRuleDetails struct {
// 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
@ -79,7 +71,7 @@ type AddSecurityRuleDetails struct {
// 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).
// IPv6 Addresses (https://docs.cloud.oracle.com/iaas/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`.
@ -97,12 +89,8 @@ type AddSecurityRuleDetails struct {
// 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"`
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// AddVcnCidrDetails Details for adding a CIDR block to a VCN.
type AddVcnCidrDetails struct {
// The CIDR block to add.
CidrBlock *string `mandatory:"true" json:"cidrBlock"`
}
func (m AddVcnCidrDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,82 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
"net/http"
)
// AddVcnCidrRequest wrapper for the AddVcnCidr operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AddVcnCidr.go.html to see an example of how to use AddVcnCidrRequest.
type AddVcnCidrRequest struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the VCN.
VcnId *string `mandatory:"true" contributesTo:"path" name:"vcnId"`
// Details object for deleting a VCN CIDR.
AddVcnCidrDetails `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"`
// 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"`
// 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 AddVcnCidrRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request AddVcnCidrRequest) 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 AddVcnCidrRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// AddVcnCidrResponse wrapper for the AddVcnCidr operation
type AddVcnCidrResponse struct {
// The underlying http response
RawResponse *http.Response
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
// The OCID 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 AddVcnCidrResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response AddVcnCidrResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AddedNetworkSecurityGroupSecurityRules The representation of AddedNetworkSecurityGroupSecurityRules

View File

@ -0,0 +1,63 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
"net/http"
)
// AdvertiseByoipRangeRequest wrapper for the AdvertiseByoipRange operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AdvertiseByoipRange.go.html to see an example of how to use AdvertiseByoipRangeRequest.
type AdvertiseByoipRangeRequest struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the `ByoipRange` resource containing the BYOIP CIDR block.
ByoipRangeId *string `mandatory:"true" contributesTo:"path" name:"byoipRangeId"`
// 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 AdvertiseByoipRangeRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request AdvertiseByoipRangeRequest) 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 AdvertiseByoipRangeRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// AdvertiseByoipRangeResponse wrapper for the AdvertiseByoipRange operation
type AdvertiseByoipRangeResponse struct {
// The underlying http response
RawResponse *http.Response
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
}
func (response AdvertiseByoipRangeResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response AdvertiseByoipRangeResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -0,0 +1,71 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// AmdMilanBmLaunchInstancePlatformConfig The platform configuration used when launching a bare metal instance specific to the AMD Milan platform.
type AmdMilanBmLaunchInstancePlatformConfig struct {
// The number of NUMA nodes per socket.
NumaNodesPerSocket AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum `mandatory:"false" json:"numaNodesPerSocket,omitempty"`
}
func (m AmdMilanBmLaunchInstancePlatformConfig) String() string {
return common.PointerString(m)
}
// MarshalJSON marshals to json representation
func (m AmdMilanBmLaunchInstancePlatformConfig) MarshalJSON() (buff []byte, e error) {
type MarshalTypeAmdMilanBmLaunchInstancePlatformConfig AmdMilanBmLaunchInstancePlatformConfig
s := struct {
DiscriminatorParam string `json:"type"`
MarshalTypeAmdMilanBmLaunchInstancePlatformConfig
}{
"AMD_MILAN_BM",
(MarshalTypeAmdMilanBmLaunchInstancePlatformConfig)(m),
}
return json.Marshal(&s)
}
// AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum Enum with underlying type: string
type AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum string
// Set of constants representing the allowable values for AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum
const (
AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketNps0 AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum = "NPS0"
AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketNps1 AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum = "NPS1"
AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketNps2 AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum = "NPS2"
AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketNps4 AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum = "NPS4"
)
var mappingAmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocket = map[string]AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum{
"NPS0": AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketNps0,
"NPS1": AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketNps1,
"NPS2": AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketNps2,
"NPS4": AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketNps4,
}
// GetAmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnumValues Enumerates the set of values for AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum
func GetAmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnumValues() []AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum {
values := make([]AmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocketEnum, 0)
for _, v := range mappingAmdMilanBmLaunchInstancePlatformConfigNumaNodesPerSocket {
values = append(values, v)
}
return values
}

View File

@ -0,0 +1,71 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// AmdMilanBmPlatformConfig The platform configuration of a bare metal instance specific to the AMD Milan platform.
type AmdMilanBmPlatformConfig struct {
// The number of NUMA nodes per socket.
NumaNodesPerSocket AmdMilanBmPlatformConfigNumaNodesPerSocketEnum `mandatory:"false" json:"numaNodesPerSocket,omitempty"`
}
func (m AmdMilanBmPlatformConfig) String() string {
return common.PointerString(m)
}
// MarshalJSON marshals to json representation
func (m AmdMilanBmPlatformConfig) MarshalJSON() (buff []byte, e error) {
type MarshalTypeAmdMilanBmPlatformConfig AmdMilanBmPlatformConfig
s := struct {
DiscriminatorParam string `json:"type"`
MarshalTypeAmdMilanBmPlatformConfig
}{
"AMD_MILAN_BM",
(MarshalTypeAmdMilanBmPlatformConfig)(m),
}
return json.Marshal(&s)
}
// AmdMilanBmPlatformConfigNumaNodesPerSocketEnum Enum with underlying type: string
type AmdMilanBmPlatformConfigNumaNodesPerSocketEnum string
// Set of constants representing the allowable values for AmdMilanBmPlatformConfigNumaNodesPerSocketEnum
const (
AmdMilanBmPlatformConfigNumaNodesPerSocketNps0 AmdMilanBmPlatformConfigNumaNodesPerSocketEnum = "NPS0"
AmdMilanBmPlatformConfigNumaNodesPerSocketNps1 AmdMilanBmPlatformConfigNumaNodesPerSocketEnum = "NPS1"
AmdMilanBmPlatformConfigNumaNodesPerSocketNps2 AmdMilanBmPlatformConfigNumaNodesPerSocketEnum = "NPS2"
AmdMilanBmPlatformConfigNumaNodesPerSocketNps4 AmdMilanBmPlatformConfigNumaNodesPerSocketEnum = "NPS4"
)
var mappingAmdMilanBmPlatformConfigNumaNodesPerSocket = map[string]AmdMilanBmPlatformConfigNumaNodesPerSocketEnum{
"NPS0": AmdMilanBmPlatformConfigNumaNodesPerSocketNps0,
"NPS1": AmdMilanBmPlatformConfigNumaNodesPerSocketNps1,
"NPS2": AmdMilanBmPlatformConfigNumaNodesPerSocketNps2,
"NPS4": AmdMilanBmPlatformConfigNumaNodesPerSocketNps4,
}
// GetAmdMilanBmPlatformConfigNumaNodesPerSocketEnumValues Enumerates the set of values for AmdMilanBmPlatformConfigNumaNodesPerSocketEnum
func GetAmdMilanBmPlatformConfigNumaNodesPerSocketEnumValues() []AmdMilanBmPlatformConfigNumaNodesPerSocketEnum {
values := make([]AmdMilanBmPlatformConfigNumaNodesPerSocketEnum, 0)
for _, v := range mappingAmdMilanBmPlatformConfigNumaNodesPerSocket {
values = append(values, v)
}
return values
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AppCatalogListing Listing details.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AppCatalogListingResourceVersion Listing Resource Version

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AppCatalogListingResourceVersionAgreements Agreements for a listing resource version.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AppCatalogListingResourceVersionSummary Listing Resource Version summary

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AppCatalogListingSummary A summary of a listing.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AppCatalogSubscription a subscription for a listing resource version.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AppCatalogSubscriptionSummary a subscription summary for a listing resource version.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AttachBootVolumeDetails The representation of AttachBootVolumeDetails

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// AttachBootVolumeRequest wrapper for the AttachBootVolume operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AttachBootVolume.go.html to see an example of how to use AttachBootVolumeRequest.
type AttachBootVolumeRequest struct {
// Attach boot volume request

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AttachEmulatedVolumeDetails The representation of AttachEmulatedVolumeDetails

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AttachIScsiVolumeDetails The representation of AttachIScsiVolumeDetails

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// AttachInstancePoolInstanceDetails Contains an instance and availability domain information for attaching an instance to the pool.
type AttachInstancePoolInstanceDetails struct {
// the instance ocid to attach.
InstanceId *string `mandatory:"true" json:"instanceId"`
}
func (m AttachInstancePoolInstanceDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,86 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
"net/http"
)
// AttachInstancePoolInstanceRequest wrapper for the AttachInstancePoolInstance operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AttachInstancePoolInstance.go.html to see an example of how to use AttachInstancePoolInstanceRequest.
type AttachInstancePoolInstanceRequest 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"`
// Attach an instance to a pool
AttachInstancePoolInstanceDetails `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"`
// 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 AttachInstancePoolInstanceRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request AttachInstancePoolInstanceRequest) 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 AttachInstancePoolInstanceRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// AttachInstancePoolInstanceResponse wrapper for the AttachInstancePoolInstance operation
type AttachInstancePoolInstanceResponse struct {
// The underlying http response
RawResponse *http.Response
// The InstancePoolInstance instance
InstancePoolInstance `presentIn:"body"`
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
// For optimistic concurrency control. See `if-match`.
Etag *string `presentIn:"header" name:"etag"`
// 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"`
// Location of the resource.
Location *string `presentIn:"header" name:"location"`
}
func (response AttachInstancePoolInstanceResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response AttachInstancePoolInstanceResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AttachLoadBalancerDetails Represents a load balancer that is to be attached to an instance pool.
@ -29,7 +29,9 @@ type AttachLoadBalancerDetails struct {
// 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.
// 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"`
}

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// AttachLoadBalancerRequest wrapper for the AttachLoadBalancer operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AttachLoadBalancer.go.html to see an example of how to use AttachLoadBalancerRequest.
type AttachLoadBalancerRequest struct {
// The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the instance pool.
@ -26,7 +30,7 @@ type AttachLoadBalancerRequest struct {
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
// 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"`

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AttachParavirtualizedVolumeDetails The representation of AttachParavirtualizedVolumeDetails

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AttachServiceDeterminedVolumeDetails The representation of AttachServiceDeterminedVolumeDetails

View File

@ -1,25 +1,29 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// AttachServiceIdRequest wrapper for the AttachServiceId operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AttachServiceId.go.html to see an example of how to use AttachServiceIdRequest.
type AttachServiceIdRequest struct {
// The service gateway's OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm).
// The service gateway's OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm).
ServiceGatewayId *string `mandatory:"true" contributesTo:"path" name:"serviceGatewayId"`
// 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`
// parameter to the value of the etag from a previous GET or POST response for that resource. The resource
// 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"`

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,13 +14,11 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AttachVnicDetails The representation of AttachVnicDetails
type AttachVnicDetails struct {
// Details for creating a new VNIC.
CreateVnicDetails *CreateVnicDetails `mandatory:"true" json:"createVnicDetails"`
// The OCID of the instance.

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// AttachVnicRequest wrapper for the AttachVnic operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AttachVnic.go.html to see an example of how to use AttachVnicRequest.
type AttachVnicRequest struct {
// Attach VNIC details.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// AttachVolumeDetails The representation of AttachVolumeDetails

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// AttachVolumeRequest wrapper for the AttachVolume operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/AttachVolume.go.html to see an example of how to use AttachVolumeRequest.
type AttachVolumeRequest struct {
// Attach volume request

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BgpSessionInfo Information for establishing a BGP session for the IPSec tunnel.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BooleanImageCapabilitySchemaDescriptor Boolean type ImageCapabilitySchemaDescriptor

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BootVolume A detachable boot volume device that contains the image used to boot a Compute instance. For more information, see
@ -69,7 +69,8 @@ type BootVolume struct {
// The image OCID used to create the boot volume.
ImageId *string `mandatory:"false" json:"imageId"`
// Specifies whether the boot volume's data has finished copying from the source boot volume or boot volume backup.
// 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 number of volume performance units (VPUs) that will be applied to this boot volume per GB,
@ -83,8 +84,6 @@ type BootVolume struct {
// 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.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BootVolumeAttachment Represents an attachment between a boot volume and an instance.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BootVolumeBackup A point-in-time copy of a boot volume that can then be used to create

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BootVolumeKmsKey The Key Management master encryption key associated with this volume.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BootVolumeSourceDetails The representation of BootVolumeSourceDetails

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BootVolumeSourceFromBootVolumeBackupDetails Specifies the boot volume backup.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -15,7 +15,7 @@ package core
import (
"encoding/json"
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BootVolumeSourceFromBootVolumeDetails Specifies the source boot volume.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BulkAddVirtualCircuitPublicPrefixesDetails The representation of BulkAddVirtualCircuitPublicPrefixesDetails

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// BulkAddVirtualCircuitPublicPrefixesRequest wrapper for the BulkAddVirtualCircuitPublicPrefixes operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/BulkAddVirtualCircuitPublicPrefixes.go.html to see an example of how to use BulkAddVirtualCircuitPublicPrefixesRequest.
type BulkAddVirtualCircuitPublicPrefixesRequest struct {
// The OCID of the virtual circuit.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// BulkDeleteVirtualCircuitPublicPrefixesDetails The representation of BulkDeleteVirtualCircuitPublicPrefixesDetails

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// BulkDeleteVirtualCircuitPublicPrefixesRequest wrapper for the BulkDeleteVirtualCircuitPublicPrefixes operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/BulkDeleteVirtualCircuitPublicPrefixes.go.html to see an example of how to use BulkDeleteVirtualCircuitPublicPrefixesRequest.
type BulkDeleteVirtualCircuitPublicPrefixesRequest struct {
// The OCID of the virtual circuit.

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// ByoipAllocatedRangeCollection Results of a `ListByoipAllocatedRanges` operation.
type ByoipAllocatedRangeCollection struct {
// A list of subranges of a BYOIP CIDR block allocated to an IP pool.
Items []ByoipAllocatedRangeSummary `mandatory:"true" json:"items"`
}
func (m ByoipAllocatedRangeCollection) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,32 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// ByoipAllocatedRangeSummary A summary of CIDR block subranges that are currently allocated to an IP pool.
type ByoipAllocatedRangeSummary struct {
// The BYOIP CIDR block range or subrange allocated to an IP pool. This could be all or part of a BYOIP CIDR block.
CidrBlock *string `mandatory:"false" json:"cidrBlock"`
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the IP pool containing the CIDR block.
PublicIpPoolId *string `mandatory:"false" json:"publicIpPoolId"`
}
func (m ByoipAllocatedRangeSummary) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,141 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// ByoipRange Oracle offers the ability to Bring Your Own IP (BYOIP), importing public IP addresses that you currently own to Oracle Cloud Infrastructure. A `ByoipRange` resource is a record of the imported address block (a BYOIP CIDR block) and also some associated metadata.
// The process used to Bring Your Own IP (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/BYOIP.htm) is explained in the documentation.
type ByoipRange struct {
// The public IPv4 CIDR block being imported from on-premises to the Oracle cloud.
CidrBlock *string `mandatory:"true" json:"cidrBlock"`
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the BYOIP CIDR block.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the `ByoipRange` resource.
Id *string `mandatory:"true" json:"id"`
// The `ByoipRange` resource's current state.
LifecycleState ByoipRangeLifecycleStateEnum `mandatory:"true" json:"lifecycleState"`
// The date and time the `ByoipRange` resource was created, in the format defined by RFC3339 (https://tools.ietf.org/html/rfc3339).
// Example: `2016-08-25T21:10:29.600Z`
TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"`
// The validation token is an internally-generated ASCII string used in the validation process. See Importing a CIDR block (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/BYOIP.htm#import_cidr) for details.
ValidationToken *string `mandatory:"true" json:"validationToken"`
// 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.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
// Example: `{"Department": "Finance"}`
FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
// The `ByoipRange` resource's current status.
LifecycleDetails ByoipRangeLifecycleDetailsEnum `mandatory:"false" json:"lifecycleDetails,omitempty"`
// The date and time the `ByoipRange` resource was validated, in the format defined by RFC3339 (https://tools.ietf.org/html/rfc3339).
// Example: `2016-08-25T21:10:29.600Z`
TimeValidated *common.SDKTime `mandatory:"false" json:"timeValidated"`
// The date and time the `ByoipRange` resource was advertised to the internet by BGP, in the format defined by RFC3339 (https://tools.ietf.org/html/rfc3339).
// Example: `2016-08-25T21:10:29.600Z`
TimeAdvertised *common.SDKTime `mandatory:"false" json:"timeAdvertised"`
// The date and time the `ByoipRange` resource was withdrawn from advertisement by BGP to the internet, in the format defined by RFC3339 (https://tools.ietf.org/html/rfc3339).
// Example: `2016-08-25T21:10:29.600Z`
TimeWithdrawn *common.SDKTime `mandatory:"false" json:"timeWithdrawn"`
}
func (m ByoipRange) String() string {
return common.PointerString(m)
}
// ByoipRangeLifecycleDetailsEnum Enum with underlying type: string
type ByoipRangeLifecycleDetailsEnum string
// Set of constants representing the allowable values for ByoipRangeLifecycleDetailsEnum
const (
ByoipRangeLifecycleDetailsCreating ByoipRangeLifecycleDetailsEnum = "CREATING"
ByoipRangeLifecycleDetailsValidating ByoipRangeLifecycleDetailsEnum = "VALIDATING"
ByoipRangeLifecycleDetailsProvisioned ByoipRangeLifecycleDetailsEnum = "PROVISIONED"
ByoipRangeLifecycleDetailsActive ByoipRangeLifecycleDetailsEnum = "ACTIVE"
ByoipRangeLifecycleDetailsFailed ByoipRangeLifecycleDetailsEnum = "FAILED"
ByoipRangeLifecycleDetailsDeleting ByoipRangeLifecycleDetailsEnum = "DELETING"
ByoipRangeLifecycleDetailsDeleted ByoipRangeLifecycleDetailsEnum = "DELETED"
ByoipRangeLifecycleDetailsAdvertising ByoipRangeLifecycleDetailsEnum = "ADVERTISING"
ByoipRangeLifecycleDetailsWithdrawing ByoipRangeLifecycleDetailsEnum = "WITHDRAWING"
)
var mappingByoipRangeLifecycleDetails = map[string]ByoipRangeLifecycleDetailsEnum{
"CREATING": ByoipRangeLifecycleDetailsCreating,
"VALIDATING": ByoipRangeLifecycleDetailsValidating,
"PROVISIONED": ByoipRangeLifecycleDetailsProvisioned,
"ACTIVE": ByoipRangeLifecycleDetailsActive,
"FAILED": ByoipRangeLifecycleDetailsFailed,
"DELETING": ByoipRangeLifecycleDetailsDeleting,
"DELETED": ByoipRangeLifecycleDetailsDeleted,
"ADVERTISING": ByoipRangeLifecycleDetailsAdvertising,
"WITHDRAWING": ByoipRangeLifecycleDetailsWithdrawing,
}
// GetByoipRangeLifecycleDetailsEnumValues Enumerates the set of values for ByoipRangeLifecycleDetailsEnum
func GetByoipRangeLifecycleDetailsEnumValues() []ByoipRangeLifecycleDetailsEnum {
values := make([]ByoipRangeLifecycleDetailsEnum, 0)
for _, v := range mappingByoipRangeLifecycleDetails {
values = append(values, v)
}
return values
}
// ByoipRangeLifecycleStateEnum Enum with underlying type: string
type ByoipRangeLifecycleStateEnum string
// Set of constants representing the allowable values for ByoipRangeLifecycleStateEnum
const (
ByoipRangeLifecycleStateInactive ByoipRangeLifecycleStateEnum = "INACTIVE"
ByoipRangeLifecycleStateUpdating ByoipRangeLifecycleStateEnum = "UPDATING"
ByoipRangeLifecycleStateActive ByoipRangeLifecycleStateEnum = "ACTIVE"
ByoipRangeLifecycleStateDeleting ByoipRangeLifecycleStateEnum = "DELETING"
ByoipRangeLifecycleStateDeleted ByoipRangeLifecycleStateEnum = "DELETED"
)
var mappingByoipRangeLifecycleState = map[string]ByoipRangeLifecycleStateEnum{
"INACTIVE": ByoipRangeLifecycleStateInactive,
"UPDATING": ByoipRangeLifecycleStateUpdating,
"ACTIVE": ByoipRangeLifecycleStateActive,
"DELETING": ByoipRangeLifecycleStateDeleting,
"DELETED": ByoipRangeLifecycleStateDeleted,
}
// GetByoipRangeLifecycleStateEnumValues Enumerates the set of values for ByoipRangeLifecycleStateEnum
func GetByoipRangeLifecycleStateEnumValues() []ByoipRangeLifecycleStateEnum {
values := make([]ByoipRangeLifecycleStateEnum, 0)
for _, v := range mappingByoipRangeLifecycleState {
values = append(values, v)
}
return values
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// ByoipRangeCollection The results returned by a `ListByoipRange` operation.
type ByoipRangeCollection struct {
// A list of `ByoipRange` resource summaries.
Items []ByoipRangeSummary `mandatory:"true" json:"items"`
}
func (m ByoipRangeCollection) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,59 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// ByoipRangeSummary Information about a `ByoipRange` resource.
type ByoipRangeSummary struct {
// The public IPv4 address range you are importing to the Oracle cloud.
CidrBlock *string `mandatory:"false" json:"cidrBlock"`
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the `ByoipRange` resource.
CompartmentId *string `mandatory:"false" json:"compartmentId"`
// 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.cloud.oracle.com/Content/General/Concepts/resourcetags.htm).
// Example: `{"Department": "Finance"}`
FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the `ByoipRange` resource.
Id *string `mandatory:"false" json:"id"`
// The `ByoipRange` resource's current state.
LifecycleState ByoipRangeLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"`
// The Byoip Range's current lifeCycle substate.
LifecycleDetails ByoipRangeLifecycleDetailsEnum `mandatory:"false" json:"lifecycleDetails,omitempty"`
// The date and time the `ByoipRange` resource was created, in the format defined by RFC3339 (https://tools.ietf.org/html/rfc3339).
// Example: `2016-08-25T21:10:29.600Z`
TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"`
}
func (m ByoipRangeSummary) String() string {
return common.PointerString(m)
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// CaptureConsoleHistoryDetails The representation of CaptureConsoleHistoryDetails

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// CaptureConsoleHistoryRequest wrapper for the CaptureConsoleHistory operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/CaptureConsoleHistory.go.html to see an example of how to use CaptureConsoleHistoryRequest.
type CaptureConsoleHistoryRequest struct {
// Console history details

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// ChangeBootVolumeBackupCompartmentDetails Contains the details for the compartment to move the boot volume backup to.

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// ChangeBootVolumeBackupCompartmentRequest wrapper for the ChangeBootVolumeBackupCompartment operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/ChangeBootVolumeBackupCompartment.go.html to see an example of how to use ChangeBootVolumeBackupCompartmentRequest.
type ChangeBootVolumeBackupCompartmentRequest struct {
// The OCID of the boot volume backup.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// ChangeBootVolumeCompartmentDetails Contains the details for the compartment to move the boot volume to.

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// ChangeBootVolumeCompartmentRequest wrapper for the ChangeBootVolumeCompartment operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/ChangeBootVolumeCompartment.go.html to see an example of how to use ChangeBootVolumeCompartmentRequest.
type ChangeBootVolumeCompartmentRequest struct {
// The OCID of the boot volume.

View File

@ -0,0 +1,29 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
)
// ChangeByoipRangeCompartmentDetails The configuration details for the move operation.
type ChangeByoipRangeCompartmentDetails struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the destination compartment for the BYOIP CIDR block move.
CompartmentId *string `mandatory:"true" json:"compartmentId"`
}
func (m ChangeByoipRangeCompartmentDetails) String() string {
return common.PointerString(m)
}

View File

@ -0,0 +1,73 @@
// Copyright (c) 2016, 2018, 2021, 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/v36/common"
"net/http"
)
// ChangeByoipRangeCompartmentRequest wrapper for the ChangeByoipRangeCompartment operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/ChangeByoipRangeCompartment.go.html to see an example of how to use ChangeByoipRangeCompartmentRequest.
type ChangeByoipRangeCompartmentRequest struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the `ByoipRange` resource containing the BYOIP CIDR block.
ByoipRangeId *string `mandatory:"true" contributesTo:"path" name:"byoipRangeId"`
// Request to change the compartment of a BYOIP CIDR block.
ChangeByoipRangeCompartmentDetails `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 ChangeByoipRangeCompartmentRequest) String() string {
return common.PointerString(request)
}
// HTTPRequest implements the OCIRequest interface
func (request ChangeByoipRangeCompartmentRequest) 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 ChangeByoipRangeCompartmentRequest) RetryPolicy() *common.RetryPolicy {
return request.RequestMetadata.RetryPolicy
}
// ChangeByoipRangeCompartmentResponse wrapper for the ChangeByoipRangeCompartment operation
type ChangeByoipRangeCompartmentResponse struct {
// The underlying http response
RawResponse *http.Response
// Unique Oracle-assigned identifier for the request. If you need to contact
// Oracle about a particular request, please provide the request ID.
OpcRequestId *string `presentIn:"header" name:"opc-request-id"`
}
func (response ChangeByoipRangeCompartmentResponse) String() string {
return common.PointerString(response)
}
// HTTPResponse implements the OCIResponse interface
func (response ChangeByoipRangeCompartmentResponse) HTTPResponse() *http.Response {
return response.RawResponse
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// ChangeClusterNetworkCompartmentDetails The configuration details for the move operation.

View File

@ -1,15 +1,19 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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"
"github.com/oracle/oci-go-sdk/v36/common"
"net/http"
)
// ChangeClusterNetworkCompartmentRequest wrapper for the ChangeClusterNetworkCompartment operation
//
// See also
//
// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/core/ChangeClusterNetworkCompartment.go.html to see an example of how to use ChangeClusterNetworkCompartmentRequest.
type ChangeClusterNetworkCompartmentRequest struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the cluster network.
@ -19,7 +23,7 @@ type ChangeClusterNetworkCompartmentRequest struct {
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
// 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"`

View File

@ -1,4 +1,4 @@
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2016, 2018, 2021, 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.
@ -14,7 +14,7 @@
package core
import (
"github.com/oracle/oci-go-sdk/common"
"github.com/oracle/oci-go-sdk/v36/common"
)
// ChangeComputeImageCapabilitySchemaCompartmentDetails The configuration details for the move operation.

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