Skip to content

Commit

Permalink
Releasing version 65.40.0
Browse files Browse the repository at this point in the history
Releasing version 65.40.0
  • Loading branch information
oci-dex-release-bot authored May 30, 2023
2 parents 41d7eb1 + 041a166 commit 07fae15
Show file tree
Hide file tree
Showing 51 changed files with 2,611 additions and 87 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)

## 65.40.0 - 2023-05-30
### Added
- Support for policy-based snapshots in the File Storage service
- Support for creating and updating a VM cluster network with disaster recovery network support in the Database service
- Support for setting a management dashboard or saved search to be shared across OCI Observability and Management services in the Management Dashboard service

### Breaking Changes
- The property `Port` was deprecated and made optional in the `ScanDetails` model in the Database service


## 65.39.0 - 2023-05-23
### Added
- Support for CRI-O parsing in the Logging service
Expand Down
39 changes: 33 additions & 6 deletions common/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"path/filepath"
"regexp"
"strings"
"sync"
)

// AuthenticationType for auth
Expand Down Expand Up @@ -47,6 +48,23 @@ type ConfigurationProvider interface {
AuthType() (AuthConfig, error)
}

var fileMutex = sync.Mutex{}
var fileCache = make(map[string][]byte)

func readFile(filename string) ([]byte, error) {
fileMutex.Lock()
defer fileMutex.Unlock()
val, ok := fileCache[filename]
if ok {
return val, nil
}
val, err := ioutil.ReadFile(filename)
if err == nil {
fileCache[filename] = val
}
return val, err
}

// 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) {
Expand Down Expand Up @@ -161,7 +179,7 @@ func (p environmentConfigurationProvider) PrivateRSAKey() (key *rsa.PrivateKey,
}

expandedPath := expandPath(value)
pemFileContent, err := ioutil.ReadFile(expandedPath)
pemFileContent, err := readFile(expandedPath)
if err != nil {
Debugln("Can not read PrivateKey location from environment variable: " + environmentVariable)
return
Expand Down Expand Up @@ -252,6 +270,9 @@ type fileConfigurationProvider struct {

//ConfigFileInfo
FileInfo *configFileInfo

//Mutex to protect the config file
configMux sync.Mutex
}

type fileConfigurationProviderError struct {
Expand All @@ -272,7 +293,8 @@ func ConfigurationProviderFromFile(configFilePath, privateKeyPassword string) (C
return fileConfigurationProvider{
ConfigPath: configFilePath,
PrivateKeyPassword: privateKeyPassword,
Profile: "DEFAULT"}, nil
Profile: "DEFAULT",
configMux: sync.Mutex{}}, nil
}

// ConfigurationProviderFromFileWithProfile creates a configuration provider from a configuration file
Expand All @@ -285,7 +307,8 @@ func ConfigurationProviderFromFileWithProfile(configFilePath, profile, privateKe
return fileConfigurationProvider{
ConfigPath: configFilePath,
PrivateKeyPassword: privateKeyPassword,
Profile: profile}, nil
Profile: profile,
configMux: sync.Mutex{}}, nil
}

type configFileInfo struct {
Expand Down Expand Up @@ -392,7 +415,7 @@ func expandPath(filename string) (expandedPath string) {

func openConfigFile(configFilePath string) (data []byte, err error) {
expandedPath := expandPath(configFilePath)
data, err = ioutil.ReadFile(expandedPath)
data, err = readFile(expandedPath)
if err != nil {
err = fmt.Errorf("can not read config file: %s due to: %s", configFilePath, err.Error())
}
Expand All @@ -405,6 +428,8 @@ func (p fileConfigurationProvider) String() string {
}

func (p fileConfigurationProvider) readAndParseConfigFile() (info *configFileInfo, err error) {
p.configMux.Lock()
defer p.configMux.Unlock()
if p.FileInfo != nil {
return p.FileInfo, nil
}
Expand Down Expand Up @@ -522,7 +547,7 @@ func (p fileConfigurationProvider) PrivateRSAKey() (key *rsa.PrivateKey, err err
}

expandedPath := expandPath(filePath)
pemFileContent, err := ioutil.ReadFile(expandedPath)
pemFileContent, err := readFile(expandedPath)
if err != nil {
err = fileConfigurationProviderError{err: fmt.Errorf("can not read PrivateKey from configuration file due to: %s", err.Error())}
return
Expand Down Expand Up @@ -585,7 +610,7 @@ func (p fileConfigurationProvider) AuthType() (AuthConfig, error) {

func getTokenContent(filePath string) (string, error) {
expandedPath := expandPath(filePath)
tokenFileContent, err := ioutil.ReadFile(expandedPath)
tokenFileContent, err := readFile(expandedPath)
if err != nil {
err = fileConfigurationProviderError{err: fmt.Errorf("can not read token content from configuration file due to: %s", err.Error())}
return "", err
Expand Down Expand Up @@ -620,6 +645,7 @@ func (c composingConfigurationProvider) TenancyOCID() (string, error) {
if err == nil {
return val, nil
}
Debugf("did not find a proper configuration for tenancy, err: %v", err)
}
return "", fmt.Errorf("did not find a proper configuration for tenancy")
}
Expand All @@ -630,6 +656,7 @@ func (c composingConfigurationProvider) UserOCID() (string, error) {
if err == nil {
return val, nil
}
Debugf("did not find a proper configuration for keyFingerprint, err: %v", err)
}
return "", fmt.Errorf("did not find a proper configuration for user")
}
Expand Down
50 changes: 50 additions & 0 deletions common/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,56 @@ security_token_file=%s
assert.NoError(t, e1)
}

func TestFileConfigurationProvider_ConcurrentRead(t *testing.T) {
dataTpl := `[DEFAULT]
user=someuser
fingerprint=somefingerprint
key_file=%s
tenancy=sometenancy
compartment = somecompartment
region=someregion
`

tmpKeyLocation := filepath.Join(getHomeFolder(), "testKeyForConcurrentRead")
e := ioutil.WriteFile(tmpKeyLocation, []byte(testEncryptedPrivateKeyConf), 777)
if e != nil {
assert.FailNow(t, e.Error())
}

newLocation := strings.Replace(tmpKeyLocation, getHomeFolder(), "~/", 1)
data := fmt.Sprintf(dataTpl, newLocation)
tmpConfFile := writeTempFile(data)

defer removeFileFn(tmpConfFile)
defer removeFileFn(tmpKeyLocation)

maxGoroutines := 10
guard := make(chan struct{}, maxGoroutines)

for i := 0; i < 30; i++ {
guard <- struct{}{} // would block if guard channel is already filled
go func(n int) {
provider, err := ConfigurationProviderFromFile(tmpConfFile, testKeyPassphrase)
assert.NoError(t, err)
ok, err := IsConfigurationProviderValid(provider)
assert.NoError(t, err)
assert.True(t, ok)

fns := []func() (string, error){provider.TenancyOCID, provider.UserOCID, provider.KeyFingerprint}
for _, fn := range fns {
val, e := fn()
assert.NoError(t, e)
assert.NotEmpty(t, val)
}

key, err := provider.PrivateRSAKey()
assert.NoError(t, err)
assert.NotNil(t, key)
<-guard
}(i)
}
}

func TestComposingConfigurationProvider_MultipleFiles(t *testing.T) {
dataTpl0 := ``
dataTpl := `[DEFAULT]
Expand Down
2 changes: 1 addition & 1 deletion common/version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions database/dr_scan_details.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) 2016, 2018, 2023, 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.

// Database Service API
//
// The API for the Database Service. Use this API to manage resources such as databases and DB Systems. For more information, see Overview of the Database Service (https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/databaseoverview.htm).
//

package database

import (
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"strings"
)

// DrScanDetails The Single Client Access Name (SCAN) details for Disaster recovery network.
type DrScanDetails struct {

// The Disaster recovery SCAN hostname.
Hostname *string `mandatory:"true" json:"hostname"`

// The Disaster recovery SCAN TCPIP port. Default is 1521.
ScanListenerPortTcp *int `mandatory:"true" json:"scanListenerPortTcp"`

// The list of Disaster recovery SCAN IP addresses. Three addresses should be provided.
Ips []string `mandatory:"true" json:"ips"`
}

func (m DrScanDetails) String() string {
return common.PointerString(m)
}

// ValidateEnumValue returns an error when providing an unsupported enum value
// This function is being called during constructing API request process
// Not recommended for calling this function directly
func (m DrScanDetails) ValidateEnumValue() (bool, error) {
errMessage := []string{}

if len(errMessage) > 0 {
return true, fmt.Errorf(strings.Join(errMessage, "\n"))
}
return false, nil
}
3 changes: 3 additions & 0 deletions database/generate_recommended_network_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ type GenerateRecommendedNetworkDetails struct {
// The SCAN TCPIP SSL port. Default is 2484.
ScanListenerPortTcpSsl *int `mandatory:"false" json:"scanListenerPortTcpSsl"`

// The DR SCAN TCPIP port. Default is 1521.
DrScanListenerPortTcp *int `mandatory:"false" json:"drScanListenerPortTcp"`

// The list of DNS server IP addresses. Maximum of 3 allowed.
Dns []string `mandatory:"false" json:"dns"`

Expand Down
16 changes: 10 additions & 6 deletions database/info_for_network_gen_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,21 @@ type InfoForNetworkGenDetailsNetworkTypeEnum string

// Set of constants representing the allowable values for InfoForNetworkGenDetailsNetworkTypeEnum
const (
InfoForNetworkGenDetailsNetworkTypeClient InfoForNetworkGenDetailsNetworkTypeEnum = "CLIENT"
InfoForNetworkGenDetailsNetworkTypeBackup InfoForNetworkGenDetailsNetworkTypeEnum = "BACKUP"
InfoForNetworkGenDetailsNetworkTypeClient InfoForNetworkGenDetailsNetworkTypeEnum = "CLIENT"
InfoForNetworkGenDetailsNetworkTypeBackup InfoForNetworkGenDetailsNetworkTypeEnum = "BACKUP"
InfoForNetworkGenDetailsNetworkTypeDisasterRecovery InfoForNetworkGenDetailsNetworkTypeEnum = "DISASTER_RECOVERY"
)

var mappingInfoForNetworkGenDetailsNetworkTypeEnum = map[string]InfoForNetworkGenDetailsNetworkTypeEnum{
"CLIENT": InfoForNetworkGenDetailsNetworkTypeClient,
"BACKUP": InfoForNetworkGenDetailsNetworkTypeBackup,
"CLIENT": InfoForNetworkGenDetailsNetworkTypeClient,
"BACKUP": InfoForNetworkGenDetailsNetworkTypeBackup,
"DISASTER_RECOVERY": InfoForNetworkGenDetailsNetworkTypeDisasterRecovery,
}

var mappingInfoForNetworkGenDetailsNetworkTypeEnumLowerCase = map[string]InfoForNetworkGenDetailsNetworkTypeEnum{
"client": InfoForNetworkGenDetailsNetworkTypeClient,
"backup": InfoForNetworkGenDetailsNetworkTypeBackup,
"client": InfoForNetworkGenDetailsNetworkTypeClient,
"backup": InfoForNetworkGenDetailsNetworkTypeBackup,
"disaster_recovery": InfoForNetworkGenDetailsNetworkTypeDisasterRecovery,
}

// GetInfoForNetworkGenDetailsNetworkTypeEnumValues Enumerates the set of values for InfoForNetworkGenDetailsNetworkTypeEnum
Expand All @@ -92,6 +95,7 @@ func GetInfoForNetworkGenDetailsNetworkTypeEnumStringValues() []string {
return []string{
"CLIENT",
"BACKUP",
"DISASTER_RECOVERY",
}
}

Expand Down
50 changes: 49 additions & 1 deletion database/network_bonding_mode_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ import (
"strings"
)

// NetworkBondingModeDetails Details of bonding mode for Client and Backup networks of an Exadata infrastructure.
// NetworkBondingModeDetails Details of bonding mode for Client and Backup and DR networks of an Exadata infrastructure.
type NetworkBondingModeDetails struct {

// The network bonding mode for the Exadata infrastructure.
ClientNetworkBondingMode NetworkBondingModeDetailsClientNetworkBondingModeEnum `mandatory:"false" json:"clientNetworkBondingMode,omitempty"`

// The network bonding mode for the Exadata infrastructure.
BackupNetworkBondingMode NetworkBondingModeDetailsBackupNetworkBondingModeEnum `mandatory:"false" json:"backupNetworkBondingMode,omitempty"`

// The network bonding mode for the Exadata infrastructure.
DrNetworkBondingMode NetworkBondingModeDetailsDrNetworkBondingModeEnum `mandatory:"false" json:"drNetworkBondingMode,omitempty"`
}

func (m NetworkBondingModeDetails) String() string {
Expand All @@ -41,6 +44,9 @@ func (m NetworkBondingModeDetails) ValidateEnumValue() (bool, error) {
if _, ok := GetMappingNetworkBondingModeDetailsBackupNetworkBondingModeEnum(string(m.BackupNetworkBondingMode)); !ok && m.BackupNetworkBondingMode != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for BackupNetworkBondingMode: %s. Supported values are: %s.", m.BackupNetworkBondingMode, strings.Join(GetNetworkBondingModeDetailsBackupNetworkBondingModeEnumStringValues(), ",")))
}
if _, ok := GetMappingNetworkBondingModeDetailsDrNetworkBondingModeEnum(string(m.DrNetworkBondingMode)); !ok && m.DrNetworkBondingMode != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for DrNetworkBondingMode: %s. Supported values are: %s.", m.DrNetworkBondingMode, strings.Join(GetNetworkBondingModeDetailsDrNetworkBondingModeEnumStringValues(), ",")))
}
if len(errMessage) > 0 {
return true, fmt.Errorf(strings.Join(errMessage, "\n"))
}
Expand Down Expand Up @@ -130,3 +136,45 @@ func GetMappingNetworkBondingModeDetailsBackupNetworkBondingModeEnum(val string)
enum, ok := mappingNetworkBondingModeDetailsBackupNetworkBondingModeEnumLowerCase[strings.ToLower(val)]
return enum, ok
}

// NetworkBondingModeDetailsDrNetworkBondingModeEnum Enum with underlying type: string
type NetworkBondingModeDetailsDrNetworkBondingModeEnum string

// Set of constants representing the allowable values for NetworkBondingModeDetailsDrNetworkBondingModeEnum
const (
NetworkBondingModeDetailsDrNetworkBondingModeActiveBackup NetworkBondingModeDetailsDrNetworkBondingModeEnum = "ACTIVE_BACKUP"
NetworkBondingModeDetailsDrNetworkBondingModeLacp NetworkBondingModeDetailsDrNetworkBondingModeEnum = "LACP"
)

var mappingNetworkBondingModeDetailsDrNetworkBondingModeEnum = map[string]NetworkBondingModeDetailsDrNetworkBondingModeEnum{
"ACTIVE_BACKUP": NetworkBondingModeDetailsDrNetworkBondingModeActiveBackup,
"LACP": NetworkBondingModeDetailsDrNetworkBondingModeLacp,
}

var mappingNetworkBondingModeDetailsDrNetworkBondingModeEnumLowerCase = map[string]NetworkBondingModeDetailsDrNetworkBondingModeEnum{
"active_backup": NetworkBondingModeDetailsDrNetworkBondingModeActiveBackup,
"lacp": NetworkBondingModeDetailsDrNetworkBondingModeLacp,
}

// GetNetworkBondingModeDetailsDrNetworkBondingModeEnumValues Enumerates the set of values for NetworkBondingModeDetailsDrNetworkBondingModeEnum
func GetNetworkBondingModeDetailsDrNetworkBondingModeEnumValues() []NetworkBondingModeDetailsDrNetworkBondingModeEnum {
values := make([]NetworkBondingModeDetailsDrNetworkBondingModeEnum, 0)
for _, v := range mappingNetworkBondingModeDetailsDrNetworkBondingModeEnum {
values = append(values, v)
}
return values
}

// GetNetworkBondingModeDetailsDrNetworkBondingModeEnumStringValues Enumerates the set of values in String for NetworkBondingModeDetailsDrNetworkBondingModeEnum
func GetNetworkBondingModeDetailsDrNetworkBondingModeEnumStringValues() []string {
return []string{
"ACTIVE_BACKUP",
"LACP",
}
}

// GetMappingNetworkBondingModeDetailsDrNetworkBondingModeEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingNetworkBondingModeDetailsDrNetworkBondingModeEnum(val string) (NetworkBondingModeDetailsDrNetworkBondingModeEnum, bool) {
enum, ok := mappingNetworkBondingModeDetailsDrNetworkBondingModeEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
7 changes: 4 additions & 3 deletions database/scan_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ type ScanDetails struct {
// The SCAN hostname.
Hostname *string `mandatory:"true" json:"hostname"`

// The SCAN TCPIP port. Default is 1521.
Port *int `mandatory:"true" json:"port"`

// The list of SCAN IP addresses. Three addresses should be provided.
Ips []string `mandatory:"true" json:"ips"`

// **Deprecated.** This field is deprecated. You may use 'scanListenerPortTcp' to specify the port.
// The SCAN TCPIP port. Default is 1521.
Port *int `mandatory:"false" json:"port"`

// The SCAN TCPIP port. Default is 1521.
ScanListenerPortTcp *int `mandatory:"false" json:"scanListenerPortTcp"`

Expand Down
3 changes: 3 additions & 0 deletions database/update_vm_cluster_network_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ type UpdateVmClusterNetworkDetails struct {
// Details of the client and backup networks.
VmNetworks []VmNetworkDetails `mandatory:"false" json:"vmNetworks"`

// The SCAN details for DR network
DrScans []DrScanDetails `mandatory:"false" json:"drScans"`

// 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"}`
Expand Down
Loading

0 comments on commit 07fae15

Please sign in to comment.