diff --git a/CHANGELOG.md b/CHANGELOG.md index 92eca6ef84..4483bae3f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) +## 65.61.1 - 2024-03-12 +### Added +- Support for new development license type on dedicated infrastructure in the Database service +- Support for placement parameters on Autonomous Container Database create operation in the Database service +- Support for autoscaling on model deployment in the Data Science service + + ## 65.61.0 - 2024-03-05 n### Added - Support for Linux capabilities configuration for the containers in the Container Instances service diff --git a/common/client.go b/common/client.go index 37e8f307e3..2ee83ae518 100644 --- a/common/client.go +++ b/common/client.go @@ -713,6 +713,9 @@ func (client BaseClient) httpDo(request *http.Request) (response *http.Response, // CloseBodyIfValid closes the body of an http response if the response and the body are valid func CloseBodyIfValid(httpResponse *http.Response) { if httpResponse != nil && httpResponse.Body != nil { + if httpResponse.Header != nil && strings.ToLower(httpResponse.Header.Get("content-type")) == "text/event-stream" { + return + } httpResponse.Body.Close() } } diff --git a/common/http.go b/common/http.go index aea6ab3060..1f57b3a6fb 100644 --- a/common/http.go +++ b/common/http.go @@ -1068,9 +1068,9 @@ func responseToStruct(response *http.Response, val *reflect.Value, unmarshaler P // Notice the current implementation only supports native types:int, strings, floats, bool as the field types func UnmarshalResponse(httpResponse *http.Response, responseStruct interface{}) (err error) { - // Check for text/event-stream content type, which cannot be Unmarshalled by the SDK + // Check for text/event-stream content type, and return without unmarshalling if httpResponse != nil && httpResponse.Header != nil && strings.ToLower(httpResponse.Header.Get("content-type")) == "text/event-stream" { - return fmt.Errorf("streaming mode is currently not supported. Please use non-streaming mode for this API instead") + return } var val *reflect.Value diff --git a/common/sseReader.go b/common/sseReader.go new file mode 100644 index 0000000000..45e224b426 --- /dev/null +++ b/common/sseReader.go @@ -0,0 +1,92 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. + +package common + +import ( + "bufio" + "bytes" + "context" + "io" + "net/http" +) + +type SseReader struct { + HttpBody io.ReadCloser + eventScanner bufio.Scanner + OnClose func(r *SseReader) +} + +// InvalidSSEResponseError returned in the case that a nil response body was given +// to NewSSEReader() +type InvalidSSEResponseError struct { +} + +const InvalidResponseErrorMessage = "invalid response struct given to NewSSEReader" + +func (e InvalidSSEResponseError) Error() string { + return InvalidResponseErrorMessage +} + +// NewSSEReader returns an SSE Reader given an sse response +func NewSSEReader(response *http.Response) (*SseReader, error) { + + if response == nil || response.Body == nil { + return nil, InvalidSSEResponseError{} + } + + reader := &SseReader{ + HttpBody: response.Body, + eventScanner: *bufio.NewScanner(response.Body), + OnClose: func(r *SseReader) { r.HttpBody.Close() }, // Default on close function, ensures body is closed after use + } + return reader, nil +} + +// Take the response in bytes and trim it if necessary +func processEvent(e []byte) []byte { + e = bytes.TrimPrefix(e, []byte("data: ")) // Text/event-stream always prefixed with 'data: ' + return e +} + +// ReadNextEvent reads the next event in the stream, return it unmarshalled +func (r *SseReader) ReadNextEvent() (event []byte, err error) { + if r.eventScanner.Scan() { + eventBytes := r.eventScanner.Bytes() + return processEvent(eventBytes), nil + } else { + + // Close out the stream since we are finished reading from it + if r.OnClose != nil { + r.OnClose(r) + } + + err := r.eventScanner.Err() + if err == context.Canceled || err == nil { + err = io.EOF + } + return nil, err + } + +} + +// ReadAllEvents reads all events from the response stream, and processes each with given event handler +func (r *SseReader) ReadAllEvents(eventHandler func(e []byte)) error { + for { + + event, err := r.ReadNextEvent() + + if err != nil { + + if err == io.EOF { + err = nil + } + return err + } + + // Ignore empty events + if len(event) > 0 { + eventHandler(event) + } + } +} diff --git a/common/version.go b/common/version.go index b68ba4b0b5..e3447ddef4 100644 --- a/common/version.go +++ b/common/version.go @@ -13,7 +13,7 @@ import ( const ( major = "65" minor = "61" - patch = "0" + patch = "1" tag = "" ) diff --git a/database/autonomous_container_database.go b/database/autonomous_container_database.go index 1c936d88fd..e01ec22473 100644 --- a/database/autonomous_container_database.go +++ b/database/autonomous_container_database.go @@ -154,6 +154,18 @@ type AutonomousContainerDatabase struct { // The timestamp of last successful backup. Here NULL value represents either there are no successful backups or backups are not configured for this Autonomous Container Database. TimeOfLastBackup *common.SDKTime `mandatory:"false" json:"timeOfLastBackup"` + + // The value above which an Autonomous Database will be split across multiple nodes. This value defaults to 16 when the "CPU per VM" value on the Autonomous VM Cluster is greater than 16. Otherwise, it defaults to the "CPU per VM" value. + DbSplitThreshold *int `mandatory:"false" json:"dbSplitThreshold"` + + // The percentage of CPUs to reserve for a single node Autonomous Database, in increments of 25. + VmFailoverReservation *int `mandatory:"false" json:"vmFailoverReservation"` + + // This option determines whether to open an Autonomous Database across the maximum number of nodes or the least number of nodes. The default will be for the minimum number of VMs. + DistributionAffinity AutonomousContainerDatabaseDistributionAffinityEnum `mandatory:"false" json:"distributionAffinity,omitempty"` + + // Enabling SHARED server architecture enables a database server to allow many client processes to share very few server processes, thereby increasing the number of supported users. + NetServicesArchitecture AutonomousContainerDatabaseNetServicesArchitectureEnum `mandatory:"false" json:"netServicesArchitecture,omitempty"` } func (m AutonomousContainerDatabase) String() string { @@ -187,6 +199,12 @@ func (m AutonomousContainerDatabase) ValidateEnumValue() (bool, error) { if _, ok := GetMappingAutonomousContainerDatabaseComputeModelEnum(string(m.ComputeModel)); !ok && m.ComputeModel != "" { errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for ComputeModel: %s. Supported values are: %s.", m.ComputeModel, strings.Join(GetAutonomousContainerDatabaseComputeModelEnumStringValues(), ","))) } + if _, ok := GetMappingAutonomousContainerDatabaseDistributionAffinityEnum(string(m.DistributionAffinity)); !ok && m.DistributionAffinity != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for DistributionAffinity: %s. Supported values are: %s.", m.DistributionAffinity, strings.Join(GetAutonomousContainerDatabaseDistributionAffinityEnumStringValues(), ","))) + } + if _, ok := GetMappingAutonomousContainerDatabaseNetServicesArchitectureEnum(string(m.NetServicesArchitecture)); !ok && m.NetServicesArchitecture != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for NetServicesArchitecture: %s. Supported values are: %s.", m.NetServicesArchitecture, strings.Join(GetAutonomousContainerDatabaseNetServicesArchitectureEnumStringValues(), ","))) + } if len(errMessage) > 0 { return true, fmt.Errorf(strings.Join(errMessage, "\n")) } @@ -550,3 +568,87 @@ func GetMappingAutonomousContainerDatabaseComputeModelEnum(val string) (Autonomo enum, ok := mappingAutonomousContainerDatabaseComputeModelEnumLowerCase[strings.ToLower(val)] return enum, ok } + +// AutonomousContainerDatabaseDistributionAffinityEnum Enum with underlying type: string +type AutonomousContainerDatabaseDistributionAffinityEnum string + +// Set of constants representing the allowable values for AutonomousContainerDatabaseDistributionAffinityEnum +const ( + AutonomousContainerDatabaseDistributionAffinityMinimumDistribution AutonomousContainerDatabaseDistributionAffinityEnum = "MINIMUM_DISTRIBUTION" + AutonomousContainerDatabaseDistributionAffinityMaximumDistribution AutonomousContainerDatabaseDistributionAffinityEnum = "MAXIMUM_DISTRIBUTION" +) + +var mappingAutonomousContainerDatabaseDistributionAffinityEnum = map[string]AutonomousContainerDatabaseDistributionAffinityEnum{ + "MINIMUM_DISTRIBUTION": AutonomousContainerDatabaseDistributionAffinityMinimumDistribution, + "MAXIMUM_DISTRIBUTION": AutonomousContainerDatabaseDistributionAffinityMaximumDistribution, +} + +var mappingAutonomousContainerDatabaseDistributionAffinityEnumLowerCase = map[string]AutonomousContainerDatabaseDistributionAffinityEnum{ + "minimum_distribution": AutonomousContainerDatabaseDistributionAffinityMinimumDistribution, + "maximum_distribution": AutonomousContainerDatabaseDistributionAffinityMaximumDistribution, +} + +// GetAutonomousContainerDatabaseDistributionAffinityEnumValues Enumerates the set of values for AutonomousContainerDatabaseDistributionAffinityEnum +func GetAutonomousContainerDatabaseDistributionAffinityEnumValues() []AutonomousContainerDatabaseDistributionAffinityEnum { + values := make([]AutonomousContainerDatabaseDistributionAffinityEnum, 0) + for _, v := range mappingAutonomousContainerDatabaseDistributionAffinityEnum { + values = append(values, v) + } + return values +} + +// GetAutonomousContainerDatabaseDistributionAffinityEnumStringValues Enumerates the set of values in String for AutonomousContainerDatabaseDistributionAffinityEnum +func GetAutonomousContainerDatabaseDistributionAffinityEnumStringValues() []string { + return []string{ + "MINIMUM_DISTRIBUTION", + "MAXIMUM_DISTRIBUTION", + } +} + +// GetMappingAutonomousContainerDatabaseDistributionAffinityEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingAutonomousContainerDatabaseDistributionAffinityEnum(val string) (AutonomousContainerDatabaseDistributionAffinityEnum, bool) { + enum, ok := mappingAutonomousContainerDatabaseDistributionAffinityEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// AutonomousContainerDatabaseNetServicesArchitectureEnum Enum with underlying type: string +type AutonomousContainerDatabaseNetServicesArchitectureEnum string + +// Set of constants representing the allowable values for AutonomousContainerDatabaseNetServicesArchitectureEnum +const ( + AutonomousContainerDatabaseNetServicesArchitectureDedicated AutonomousContainerDatabaseNetServicesArchitectureEnum = "DEDICATED" + AutonomousContainerDatabaseNetServicesArchitectureShared AutonomousContainerDatabaseNetServicesArchitectureEnum = "SHARED" +) + +var mappingAutonomousContainerDatabaseNetServicesArchitectureEnum = map[string]AutonomousContainerDatabaseNetServicesArchitectureEnum{ + "DEDICATED": AutonomousContainerDatabaseNetServicesArchitectureDedicated, + "SHARED": AutonomousContainerDatabaseNetServicesArchitectureShared, +} + +var mappingAutonomousContainerDatabaseNetServicesArchitectureEnumLowerCase = map[string]AutonomousContainerDatabaseNetServicesArchitectureEnum{ + "dedicated": AutonomousContainerDatabaseNetServicesArchitectureDedicated, + "shared": AutonomousContainerDatabaseNetServicesArchitectureShared, +} + +// GetAutonomousContainerDatabaseNetServicesArchitectureEnumValues Enumerates the set of values for AutonomousContainerDatabaseNetServicesArchitectureEnum +func GetAutonomousContainerDatabaseNetServicesArchitectureEnumValues() []AutonomousContainerDatabaseNetServicesArchitectureEnum { + values := make([]AutonomousContainerDatabaseNetServicesArchitectureEnum, 0) + for _, v := range mappingAutonomousContainerDatabaseNetServicesArchitectureEnum { + values = append(values, v) + } + return values +} + +// GetAutonomousContainerDatabaseNetServicesArchitectureEnumStringValues Enumerates the set of values in String for AutonomousContainerDatabaseNetServicesArchitectureEnum +func GetAutonomousContainerDatabaseNetServicesArchitectureEnumStringValues() []string { + return []string{ + "DEDICATED", + "SHARED", + } +} + +// GetMappingAutonomousContainerDatabaseNetServicesArchitectureEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingAutonomousContainerDatabaseNetServicesArchitectureEnum(val string) (AutonomousContainerDatabaseNetServicesArchitectureEnum, bool) { + enum, ok := mappingAutonomousContainerDatabaseNetServicesArchitectureEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/database/autonomous_container_database_summary.go b/database/autonomous_container_database_summary.go index 4f95aa75a1..085023c4b8 100644 --- a/database/autonomous_container_database_summary.go +++ b/database/autonomous_container_database_summary.go @@ -154,6 +154,18 @@ type AutonomousContainerDatabaseSummary struct { // The timestamp of last successful backup. Here NULL value represents either there are no successful backups or backups are not configured for this Autonomous Container Database. TimeOfLastBackup *common.SDKTime `mandatory:"false" json:"timeOfLastBackup"` + + // The value above which an Autonomous Database will be split across multiple nodes. This value defaults to 16 when the "CPU per VM" value on the Autonomous VM Cluster is greater than 16. Otherwise, it defaults to the "CPU per VM" value. + DbSplitThreshold *int `mandatory:"false" json:"dbSplitThreshold"` + + // The percentage of CPUs to reserve for a single node Autonomous Database, in increments of 25. + VmFailoverReservation *int `mandatory:"false" json:"vmFailoverReservation"` + + // This option determines whether to open an Autonomous Database across the maximum number of nodes or the least number of nodes. The default will be for the minimum number of VMs. + DistributionAffinity AutonomousContainerDatabaseSummaryDistributionAffinityEnum `mandatory:"false" json:"distributionAffinity,omitempty"` + + // Enabling SHARED server architecture enables a database server to allow many client processes to share very few server processes, thereby increasing the number of supported users. + NetServicesArchitecture AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum `mandatory:"false" json:"netServicesArchitecture,omitempty"` } func (m AutonomousContainerDatabaseSummary) String() string { @@ -187,6 +199,12 @@ func (m AutonomousContainerDatabaseSummary) ValidateEnumValue() (bool, error) { if _, ok := GetMappingAutonomousContainerDatabaseSummaryComputeModelEnum(string(m.ComputeModel)); !ok && m.ComputeModel != "" { errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for ComputeModel: %s. Supported values are: %s.", m.ComputeModel, strings.Join(GetAutonomousContainerDatabaseSummaryComputeModelEnumStringValues(), ","))) } + if _, ok := GetMappingAutonomousContainerDatabaseSummaryDistributionAffinityEnum(string(m.DistributionAffinity)); !ok && m.DistributionAffinity != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for DistributionAffinity: %s. Supported values are: %s.", m.DistributionAffinity, strings.Join(GetAutonomousContainerDatabaseSummaryDistributionAffinityEnumStringValues(), ","))) + } + if _, ok := GetMappingAutonomousContainerDatabaseSummaryNetServicesArchitectureEnum(string(m.NetServicesArchitecture)); !ok && m.NetServicesArchitecture != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for NetServicesArchitecture: %s. Supported values are: %s.", m.NetServicesArchitecture, strings.Join(GetAutonomousContainerDatabaseSummaryNetServicesArchitectureEnumStringValues(), ","))) + } if len(errMessage) > 0 { return true, fmt.Errorf(strings.Join(errMessage, "\n")) } @@ -550,3 +568,87 @@ func GetMappingAutonomousContainerDatabaseSummaryComputeModelEnum(val string) (A enum, ok := mappingAutonomousContainerDatabaseSummaryComputeModelEnumLowerCase[strings.ToLower(val)] return enum, ok } + +// AutonomousContainerDatabaseSummaryDistributionAffinityEnum Enum with underlying type: string +type AutonomousContainerDatabaseSummaryDistributionAffinityEnum string + +// Set of constants representing the allowable values for AutonomousContainerDatabaseSummaryDistributionAffinityEnum +const ( + AutonomousContainerDatabaseSummaryDistributionAffinityMinimumDistribution AutonomousContainerDatabaseSummaryDistributionAffinityEnum = "MINIMUM_DISTRIBUTION" + AutonomousContainerDatabaseSummaryDistributionAffinityMaximumDistribution AutonomousContainerDatabaseSummaryDistributionAffinityEnum = "MAXIMUM_DISTRIBUTION" +) + +var mappingAutonomousContainerDatabaseSummaryDistributionAffinityEnum = map[string]AutonomousContainerDatabaseSummaryDistributionAffinityEnum{ + "MINIMUM_DISTRIBUTION": AutonomousContainerDatabaseSummaryDistributionAffinityMinimumDistribution, + "MAXIMUM_DISTRIBUTION": AutonomousContainerDatabaseSummaryDistributionAffinityMaximumDistribution, +} + +var mappingAutonomousContainerDatabaseSummaryDistributionAffinityEnumLowerCase = map[string]AutonomousContainerDatabaseSummaryDistributionAffinityEnum{ + "minimum_distribution": AutonomousContainerDatabaseSummaryDistributionAffinityMinimumDistribution, + "maximum_distribution": AutonomousContainerDatabaseSummaryDistributionAffinityMaximumDistribution, +} + +// GetAutonomousContainerDatabaseSummaryDistributionAffinityEnumValues Enumerates the set of values for AutonomousContainerDatabaseSummaryDistributionAffinityEnum +func GetAutonomousContainerDatabaseSummaryDistributionAffinityEnumValues() []AutonomousContainerDatabaseSummaryDistributionAffinityEnum { + values := make([]AutonomousContainerDatabaseSummaryDistributionAffinityEnum, 0) + for _, v := range mappingAutonomousContainerDatabaseSummaryDistributionAffinityEnum { + values = append(values, v) + } + return values +} + +// GetAutonomousContainerDatabaseSummaryDistributionAffinityEnumStringValues Enumerates the set of values in String for AutonomousContainerDatabaseSummaryDistributionAffinityEnum +func GetAutonomousContainerDatabaseSummaryDistributionAffinityEnumStringValues() []string { + return []string{ + "MINIMUM_DISTRIBUTION", + "MAXIMUM_DISTRIBUTION", + } +} + +// GetMappingAutonomousContainerDatabaseSummaryDistributionAffinityEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingAutonomousContainerDatabaseSummaryDistributionAffinityEnum(val string) (AutonomousContainerDatabaseSummaryDistributionAffinityEnum, bool) { + enum, ok := mappingAutonomousContainerDatabaseSummaryDistributionAffinityEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum Enum with underlying type: string +type AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum string + +// Set of constants representing the allowable values for AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum +const ( + AutonomousContainerDatabaseSummaryNetServicesArchitectureDedicated AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum = "DEDICATED" + AutonomousContainerDatabaseSummaryNetServicesArchitectureShared AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum = "SHARED" +) + +var mappingAutonomousContainerDatabaseSummaryNetServicesArchitectureEnum = map[string]AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum{ + "DEDICATED": AutonomousContainerDatabaseSummaryNetServicesArchitectureDedicated, + "SHARED": AutonomousContainerDatabaseSummaryNetServicesArchitectureShared, +} + +var mappingAutonomousContainerDatabaseSummaryNetServicesArchitectureEnumLowerCase = map[string]AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum{ + "dedicated": AutonomousContainerDatabaseSummaryNetServicesArchitectureDedicated, + "shared": AutonomousContainerDatabaseSummaryNetServicesArchitectureShared, +} + +// GetAutonomousContainerDatabaseSummaryNetServicesArchitectureEnumValues Enumerates the set of values for AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum +func GetAutonomousContainerDatabaseSummaryNetServicesArchitectureEnumValues() []AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum { + values := make([]AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum, 0) + for _, v := range mappingAutonomousContainerDatabaseSummaryNetServicesArchitectureEnum { + values = append(values, v) + } + return values +} + +// GetAutonomousContainerDatabaseSummaryNetServicesArchitectureEnumStringValues Enumerates the set of values in String for AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum +func GetAutonomousContainerDatabaseSummaryNetServicesArchitectureEnumStringValues() []string { + return []string{ + "DEDICATED", + "SHARED", + } +} + +// GetMappingAutonomousContainerDatabaseSummaryNetServicesArchitectureEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingAutonomousContainerDatabaseSummaryNetServicesArchitectureEnum(val string) (AutonomousContainerDatabaseSummaryNetServicesArchitectureEnum, bool) { + enum, ok := mappingAutonomousContainerDatabaseSummaryNetServicesArchitectureEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/database/autonomous_database.go b/database/autonomous_database.go index 8a11e98eef..25aaf70015 100644 --- a/database/autonomous_database.go +++ b/database/autonomous_database.go @@ -211,6 +211,9 @@ type AutonomousDatabase struct { // This cannot be updated in parallel with any of the following: licenseModel, dbEdition, cpuCoreCount, computeCount, computeModel, adminPassword, whitelistedIps, isMTLSConnectionRequired, privateEndpointLabel, nsgIds, dbVersion, isRefreshable, dbName, scheduledOperations, dbToolsDetails, isLocalDataGuardEnabled, or isFreeTier. DbWorkload AutonomousDatabaseDbWorkloadEnum `mandatory:"false" json:"dbWorkload,omitempty"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // Indicates if the database-level access control is enabled. // If disabled, database access is defined by the network security rules. // If enabled, database access is restricted to the IP addresses defined by the rules specified with the `whitelistedIps` property. While specifying `whitelistedIps` rules is optional, @@ -414,6 +417,9 @@ type AutonomousDatabase struct { TimeDisasterRecoveryRoleChanged *common.SDKTime `mandatory:"false" json:"timeDisasterRecoveryRoleChanged"` RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfiguration `mandatory:"false" json:"remoteDisasterRecoveryConfiguration"` + + // Enabling SHARED server architecture enables a database server to allow many client processes to share very few server processes, thereby increasing the number of supported users. + NetServicesArchitecture AutonomousDatabaseNetServicesArchitectureEnum `mandatory:"false" json:"netServicesArchitecture,omitempty"` } func (m AutonomousDatabase) String() string { @@ -480,6 +486,9 @@ func (m AutonomousDatabase) ValidateEnumValue() (bool, error) { if _, ok := GetMappingAutonomousDatabaseDisasterRecoveryRegionTypeEnum(string(m.DisasterRecoveryRegionType)); !ok && m.DisasterRecoveryRegionType != "" { errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for DisasterRecoveryRegionType: %s. Supported values are: %s.", m.DisasterRecoveryRegionType, strings.Join(GetAutonomousDatabaseDisasterRecoveryRegionTypeEnumStringValues(), ","))) } + if _, ok := GetMappingAutonomousDatabaseNetServicesArchitectureEnum(string(m.NetServicesArchitecture)); !ok && m.NetServicesArchitecture != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for NetServicesArchitecture: %s. Supported values are: %s.", m.NetServicesArchitecture, strings.Join(GetAutonomousDatabaseNetServicesArchitectureEnumStringValues(), ","))) + } if len(errMessage) > 0 { return true, fmt.Errorf(strings.Join(errMessage, "\n")) } @@ -1339,3 +1348,45 @@ func GetMappingAutonomousDatabaseDisasterRecoveryRegionTypeEnum(val string) (Aut enum, ok := mappingAutonomousDatabaseDisasterRecoveryRegionTypeEnumLowerCase[strings.ToLower(val)] return enum, ok } + +// AutonomousDatabaseNetServicesArchitectureEnum Enum with underlying type: string +type AutonomousDatabaseNetServicesArchitectureEnum string + +// Set of constants representing the allowable values for AutonomousDatabaseNetServicesArchitectureEnum +const ( + AutonomousDatabaseNetServicesArchitectureDedicated AutonomousDatabaseNetServicesArchitectureEnum = "DEDICATED" + AutonomousDatabaseNetServicesArchitectureShared AutonomousDatabaseNetServicesArchitectureEnum = "SHARED" +) + +var mappingAutonomousDatabaseNetServicesArchitectureEnum = map[string]AutonomousDatabaseNetServicesArchitectureEnum{ + "DEDICATED": AutonomousDatabaseNetServicesArchitectureDedicated, + "SHARED": AutonomousDatabaseNetServicesArchitectureShared, +} + +var mappingAutonomousDatabaseNetServicesArchitectureEnumLowerCase = map[string]AutonomousDatabaseNetServicesArchitectureEnum{ + "dedicated": AutonomousDatabaseNetServicesArchitectureDedicated, + "shared": AutonomousDatabaseNetServicesArchitectureShared, +} + +// GetAutonomousDatabaseNetServicesArchitectureEnumValues Enumerates the set of values for AutonomousDatabaseNetServicesArchitectureEnum +func GetAutonomousDatabaseNetServicesArchitectureEnumValues() []AutonomousDatabaseNetServicesArchitectureEnum { + values := make([]AutonomousDatabaseNetServicesArchitectureEnum, 0) + for _, v := range mappingAutonomousDatabaseNetServicesArchitectureEnum { + values = append(values, v) + } + return values +} + +// GetAutonomousDatabaseNetServicesArchitectureEnumStringValues Enumerates the set of values in String for AutonomousDatabaseNetServicesArchitectureEnum +func GetAutonomousDatabaseNetServicesArchitectureEnumStringValues() []string { + return []string{ + "DEDICATED", + "SHARED", + } +} + +// GetMappingAutonomousDatabaseNetServicesArchitectureEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingAutonomousDatabaseNetServicesArchitectureEnum(val string) (AutonomousDatabaseNetServicesArchitectureEnum, bool) { + enum, ok := mappingAutonomousDatabaseNetServicesArchitectureEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/database/autonomous_database_summary.go b/database/autonomous_database_summary.go index 2f981cfadb..e64e6c9308 100644 --- a/database/autonomous_database_summary.go +++ b/database/autonomous_database_summary.go @@ -212,6 +212,9 @@ type AutonomousDatabaseSummary struct { // This cannot be updated in parallel with any of the following: licenseModel, dbEdition, cpuCoreCount, computeCount, computeModel, adminPassword, whitelistedIps, isMTLSConnectionRequired, privateEndpointLabel, nsgIds, dbVersion, isRefreshable, dbName, scheduledOperations, dbToolsDetails, isLocalDataGuardEnabled, or isFreeTier. DbWorkload AutonomousDatabaseSummaryDbWorkloadEnum `mandatory:"false" json:"dbWorkload,omitempty"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // Indicates if the database-level access control is enabled. // If disabled, database access is defined by the network security rules. // If enabled, database access is restricted to the IP addresses defined by the rules specified with the `whitelistedIps` property. While specifying `whitelistedIps` rules is optional, @@ -415,6 +418,9 @@ type AutonomousDatabaseSummary struct { TimeDisasterRecoveryRoleChanged *common.SDKTime `mandatory:"false" json:"timeDisasterRecoveryRoleChanged"` RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfiguration `mandatory:"false" json:"remoteDisasterRecoveryConfiguration"` + + // Enabling SHARED server architecture enables a database server to allow many client processes to share very few server processes, thereby increasing the number of supported users. + NetServicesArchitecture AutonomousDatabaseSummaryNetServicesArchitectureEnum `mandatory:"false" json:"netServicesArchitecture,omitempty"` } func (m AutonomousDatabaseSummary) String() string { @@ -481,6 +487,9 @@ func (m AutonomousDatabaseSummary) ValidateEnumValue() (bool, error) { if _, ok := GetMappingAutonomousDatabaseSummaryDisasterRecoveryRegionTypeEnum(string(m.DisasterRecoveryRegionType)); !ok && m.DisasterRecoveryRegionType != "" { errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for DisasterRecoveryRegionType: %s. Supported values are: %s.", m.DisasterRecoveryRegionType, strings.Join(GetAutonomousDatabaseSummaryDisasterRecoveryRegionTypeEnumStringValues(), ","))) } + if _, ok := GetMappingAutonomousDatabaseSummaryNetServicesArchitectureEnum(string(m.NetServicesArchitecture)); !ok && m.NetServicesArchitecture != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for NetServicesArchitecture: %s. Supported values are: %s.", m.NetServicesArchitecture, strings.Join(GetAutonomousDatabaseSummaryNetServicesArchitectureEnumStringValues(), ","))) + } if len(errMessage) > 0 { return true, fmt.Errorf(strings.Join(errMessage, "\n")) } @@ -1340,3 +1349,45 @@ func GetMappingAutonomousDatabaseSummaryDisasterRecoveryRegionTypeEnum(val strin enum, ok := mappingAutonomousDatabaseSummaryDisasterRecoveryRegionTypeEnumLowerCase[strings.ToLower(val)] return enum, ok } + +// AutonomousDatabaseSummaryNetServicesArchitectureEnum Enum with underlying type: string +type AutonomousDatabaseSummaryNetServicesArchitectureEnum string + +// Set of constants representing the allowable values for AutonomousDatabaseSummaryNetServicesArchitectureEnum +const ( + AutonomousDatabaseSummaryNetServicesArchitectureDedicated AutonomousDatabaseSummaryNetServicesArchitectureEnum = "DEDICATED" + AutonomousDatabaseSummaryNetServicesArchitectureShared AutonomousDatabaseSummaryNetServicesArchitectureEnum = "SHARED" +) + +var mappingAutonomousDatabaseSummaryNetServicesArchitectureEnum = map[string]AutonomousDatabaseSummaryNetServicesArchitectureEnum{ + "DEDICATED": AutonomousDatabaseSummaryNetServicesArchitectureDedicated, + "SHARED": AutonomousDatabaseSummaryNetServicesArchitectureShared, +} + +var mappingAutonomousDatabaseSummaryNetServicesArchitectureEnumLowerCase = map[string]AutonomousDatabaseSummaryNetServicesArchitectureEnum{ + "dedicated": AutonomousDatabaseSummaryNetServicesArchitectureDedicated, + "shared": AutonomousDatabaseSummaryNetServicesArchitectureShared, +} + +// GetAutonomousDatabaseSummaryNetServicesArchitectureEnumValues Enumerates the set of values for AutonomousDatabaseSummaryNetServicesArchitectureEnum +func GetAutonomousDatabaseSummaryNetServicesArchitectureEnumValues() []AutonomousDatabaseSummaryNetServicesArchitectureEnum { + values := make([]AutonomousDatabaseSummaryNetServicesArchitectureEnum, 0) + for _, v := range mappingAutonomousDatabaseSummaryNetServicesArchitectureEnum { + values = append(values, v) + } + return values +} + +// GetAutonomousDatabaseSummaryNetServicesArchitectureEnumStringValues Enumerates the set of values in String for AutonomousDatabaseSummaryNetServicesArchitectureEnum +func GetAutonomousDatabaseSummaryNetServicesArchitectureEnumStringValues() []string { + return []string{ + "DEDICATED", + "SHARED", + } +} + +// GetMappingAutonomousDatabaseSummaryNetServicesArchitectureEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingAutonomousDatabaseSummaryNetServicesArchitectureEnum(val string) (AutonomousDatabaseSummaryNetServicesArchitectureEnum, bool) { + enum, ok := mappingAutonomousDatabaseSummaryNetServicesArchitectureEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/database/create_autonomous_container_database_details.go b/database/create_autonomous_container_database_details.go index 7781c79c18..ed6dc222f8 100644 --- a/database/create_autonomous_container_database_details.go +++ b/database/create_autonomous_container_database_details.go @@ -114,6 +114,18 @@ type CreateAutonomousContainerDatabaseDetails struct { // The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the key store of Oracle Vault. KeyStoreId *string `mandatory:"false" json:"keyStoreId"` + + // The value above which an Autonomous Database will be split across multiple nodes. This value defaults to 16 when the "CPU per VM" value on the Autonomous VM Cluster is greater than 16. Otherwise, it defaults to the "CPU per VM" value. + DbSplitThreshold *int `mandatory:"false" json:"dbSplitThreshold"` + + // The percentage of CPUs to reserve for a single node Autonomous Database, in increments of 25. + VmFailoverReservation *int `mandatory:"false" json:"vmFailoverReservation"` + + // This option determines whether to open an Autonomous Database across the maximum number of nodes or the least number of nodes. The default will be for the minimum number of VMs. + DistributionAffinity CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum `mandatory:"false" json:"distributionAffinity,omitempty"` + + // Enabling SHARED server architecture enables a database server to allow many client processes to share very few server processes, thereby increasing the number of supported users. + NetServicesArchitecture CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum `mandatory:"false" json:"netServicesArchitecture,omitempty"` } func (m CreateAutonomousContainerDatabaseDetails) String() string { @@ -138,6 +150,12 @@ func (m CreateAutonomousContainerDatabaseDetails) ValidateEnumValue() (bool, err if _, ok := GetMappingCreateAutonomousContainerDatabaseDetailsVersionPreferenceEnum(string(m.VersionPreference)); !ok && m.VersionPreference != "" { errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for VersionPreference: %s. Supported values are: %s.", m.VersionPreference, strings.Join(GetCreateAutonomousContainerDatabaseDetailsVersionPreferenceEnumStringValues(), ","))) } + if _, ok := GetMappingCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum(string(m.DistributionAffinity)); !ok && m.DistributionAffinity != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for DistributionAffinity: %s. Supported values are: %s.", m.DistributionAffinity, strings.Join(GetCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnumStringValues(), ","))) + } + if _, ok := GetMappingCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum(string(m.NetServicesArchitecture)); !ok && m.NetServicesArchitecture != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for NetServicesArchitecture: %s. Supported values are: %s.", m.NetServicesArchitecture, strings.Join(GetCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnumStringValues(), ","))) + } if len(errMessage) > 0 { return true, fmt.Errorf(strings.Join(errMessage, "\n")) } @@ -311,3 +329,87 @@ func GetMappingCreateAutonomousContainerDatabaseDetailsVersionPreferenceEnum(val enum, ok := mappingCreateAutonomousContainerDatabaseDetailsVersionPreferenceEnumLowerCase[strings.ToLower(val)] return enum, ok } + +// CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum Enum with underlying type: string +type CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum string + +// Set of constants representing the allowable values for CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum +const ( + CreateAutonomousContainerDatabaseDetailsDistributionAffinityMinimumDistribution CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum = "MINIMUM_DISTRIBUTION" + CreateAutonomousContainerDatabaseDetailsDistributionAffinityMaximumDistribution CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum = "MAXIMUM_DISTRIBUTION" +) + +var mappingCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum = map[string]CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum{ + "MINIMUM_DISTRIBUTION": CreateAutonomousContainerDatabaseDetailsDistributionAffinityMinimumDistribution, + "MAXIMUM_DISTRIBUTION": CreateAutonomousContainerDatabaseDetailsDistributionAffinityMaximumDistribution, +} + +var mappingCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnumLowerCase = map[string]CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum{ + "minimum_distribution": CreateAutonomousContainerDatabaseDetailsDistributionAffinityMinimumDistribution, + "maximum_distribution": CreateAutonomousContainerDatabaseDetailsDistributionAffinityMaximumDistribution, +} + +// GetCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnumValues Enumerates the set of values for CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum +func GetCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnumValues() []CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum { + values := make([]CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum, 0) + for _, v := range mappingCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum { + values = append(values, v) + } + return values +} + +// GetCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnumStringValues Enumerates the set of values in String for CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum +func GetCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnumStringValues() []string { + return []string{ + "MINIMUM_DISTRIBUTION", + "MAXIMUM_DISTRIBUTION", + } +} + +// GetMappingCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum(val string) (CreateAutonomousContainerDatabaseDetailsDistributionAffinityEnum, bool) { + enum, ok := mappingCreateAutonomousContainerDatabaseDetailsDistributionAffinityEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum Enum with underlying type: string +type CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum string + +// Set of constants representing the allowable values for CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum +const ( + CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureDedicated CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum = "DEDICATED" + CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureShared CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum = "SHARED" +) + +var mappingCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum = map[string]CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum{ + "DEDICATED": CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureDedicated, + "SHARED": CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureShared, +} + +var mappingCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnumLowerCase = map[string]CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum{ + "dedicated": CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureDedicated, + "shared": CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureShared, +} + +// GetCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnumValues Enumerates the set of values for CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum +func GetCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnumValues() []CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum { + values := make([]CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum, 0) + for _, v := range mappingCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum { + values = append(values, v) + } + return values +} + +// GetCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnumStringValues Enumerates the set of values in String for CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum +func GetCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnumStringValues() []string { + return []string{ + "DEDICATED", + "SHARED", + } +} + +// GetMappingCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum(val string) (CreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnum, bool) { + enum, ok := mappingCreateAutonomousContainerDatabaseDetailsNetServicesArchitectureEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/database/create_autonomous_database_base.go b/database/create_autonomous_database_base.go index 8ba02eccd6..a35a30b9ef 100644 --- a/database/create_autonomous_database_base.go +++ b/database/create_autonomous_database_base.go @@ -112,6 +112,9 @@ type CreateAutonomousDatabaseBase interface { // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. GetIsAutoScalingEnabled() *bool + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + GetIsDevTier() *bool + // True if the database is on dedicated Exadata infrastructure (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html). GetIsDedicated() *bool @@ -267,6 +270,7 @@ type createautonomousdatabasebase struct { LicenseModel CreateAutonomousDatabaseBaseLicenseModelEnum `mandatory:"false" json:"licenseModel,omitempty"` IsPreviewVersionWithServiceTermsAccepted *bool `mandatory:"false" json:"isPreviewVersionWithServiceTermsAccepted"` IsAutoScalingEnabled *bool `mandatory:"false" json:"isAutoScalingEnabled"` + IsDevTier *bool `mandatory:"false" json:"isDevTier"` IsDedicated *bool `mandatory:"false" json:"isDedicated"` AutonomousContainerDatabaseId *string `mandatory:"false" json:"autonomousContainerDatabaseId"` InMemoryPercentage *int `mandatory:"false" json:"inMemoryPercentage"` @@ -329,6 +333,7 @@ func (m *createautonomousdatabasebase) UnmarshalJSON(data []byte) error { m.LicenseModel = s.Model.LicenseModel m.IsPreviewVersionWithServiceTermsAccepted = s.Model.IsPreviewVersionWithServiceTermsAccepted m.IsAutoScalingEnabled = s.Model.IsAutoScalingEnabled + m.IsDevTier = s.Model.IsDevTier m.IsDedicated = s.Model.IsDedicated m.AutonomousContainerDatabaseId = s.Model.AutonomousContainerDatabaseId m.InMemoryPercentage = s.Model.InMemoryPercentage @@ -499,6 +504,11 @@ func (m createautonomousdatabasebase) GetIsAutoScalingEnabled() *bool { return m.IsAutoScalingEnabled } +// GetIsDevTier returns IsDevTier +func (m createautonomousdatabasebase) GetIsDevTier() *bool { + return m.IsDevTier +} + // GetIsDedicated returns IsDedicated func (m createautonomousdatabasebase) GetIsDedicated() *bool { return m.IsDedicated diff --git a/database/create_autonomous_database_clone_details.go b/database/create_autonomous_database_clone_details.go index 5b640062b1..89ddc705b4 100644 --- a/database/create_autonomous_database_clone_details.go +++ b/database/create_autonomous_database_clone_details.go @@ -92,6 +92,9 @@ type CreateAutonomousDatabaseCloneDetails struct { // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. IsAutoScalingEnabled *bool `mandatory:"false" json:"isAutoScalingEnabled"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // True if the database is on dedicated Exadata infrastructure (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html). IsDedicated *bool `mandatory:"false" json:"isDedicated"` @@ -347,6 +350,11 @@ func (m CreateAutonomousDatabaseCloneDetails) GetIsAutoScalingEnabled() *bool { return m.IsAutoScalingEnabled } +// GetIsDevTier returns IsDevTier +func (m CreateAutonomousDatabaseCloneDetails) GetIsDevTier() *bool { + return m.IsDevTier +} + // GetIsDedicated returns IsDedicated func (m CreateAutonomousDatabaseCloneDetails) GetIsDedicated() *bool { return m.IsDedicated diff --git a/database/create_autonomous_database_details.go b/database/create_autonomous_database_details.go index b9d3c3302e..731ab879aa 100644 --- a/database/create_autonomous_database_details.go +++ b/database/create_autonomous_database_details.go @@ -89,6 +89,9 @@ type CreateAutonomousDatabaseDetails struct { // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. IsAutoScalingEnabled *bool `mandatory:"false" json:"isAutoScalingEnabled"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // True if the database is on dedicated Exadata infrastructure (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html). IsDedicated *bool `mandatory:"false" json:"isDedicated"` @@ -341,6 +344,11 @@ func (m CreateAutonomousDatabaseDetails) GetIsAutoScalingEnabled() *bool { return m.IsAutoScalingEnabled } +// GetIsDevTier returns IsDevTier +func (m CreateAutonomousDatabaseDetails) GetIsDevTier() *bool { + return m.IsDevTier +} + // GetIsDedicated returns IsDedicated func (m CreateAutonomousDatabaseDetails) GetIsDedicated() *bool { return m.IsDedicated diff --git a/database/create_autonomous_database_from_backup_details.go b/database/create_autonomous_database_from_backup_details.go index a191a8ae0c..9012bd3be7 100644 --- a/database/create_autonomous_database_from_backup_details.go +++ b/database/create_autonomous_database_from_backup_details.go @@ -92,6 +92,9 @@ type CreateAutonomousDatabaseFromBackupDetails struct { // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. IsAutoScalingEnabled *bool `mandatory:"false" json:"isAutoScalingEnabled"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // True if the database is on dedicated Exadata infrastructure (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html). IsDedicated *bool `mandatory:"false" json:"isDedicated"` @@ -347,6 +350,11 @@ func (m CreateAutonomousDatabaseFromBackupDetails) GetIsAutoScalingEnabled() *bo return m.IsAutoScalingEnabled } +// GetIsDevTier returns IsDevTier +func (m CreateAutonomousDatabaseFromBackupDetails) GetIsDevTier() *bool { + return m.IsDevTier +} + // GetIsDedicated returns IsDedicated func (m CreateAutonomousDatabaseFromBackupDetails) GetIsDedicated() *bool { return m.IsDedicated diff --git a/database/create_autonomous_database_from_backup_timestamp_details.go b/database/create_autonomous_database_from_backup_timestamp_details.go index 6b458780b1..b6cde18f28 100644 --- a/database/create_autonomous_database_from_backup_timestamp_details.go +++ b/database/create_autonomous_database_from_backup_timestamp_details.go @@ -92,6 +92,9 @@ type CreateAutonomousDatabaseFromBackupTimestampDetails struct { // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. IsAutoScalingEnabled *bool `mandatory:"false" json:"isAutoScalingEnabled"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // True if the database is on dedicated Exadata infrastructure (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html). IsDedicated *bool `mandatory:"false" json:"isDedicated"` @@ -353,6 +356,11 @@ func (m CreateAutonomousDatabaseFromBackupTimestampDetails) GetIsAutoScalingEnab return m.IsAutoScalingEnabled } +// GetIsDevTier returns IsDevTier +func (m CreateAutonomousDatabaseFromBackupTimestampDetails) GetIsDevTier() *bool { + return m.IsDevTier +} + // GetIsDedicated returns IsDedicated func (m CreateAutonomousDatabaseFromBackupTimestampDetails) GetIsDedicated() *bool { return m.IsDedicated diff --git a/database/create_cross_region_autonomous_database_data_guard_details.go b/database/create_cross_region_autonomous_database_data_guard_details.go index 3d68e4347b..5d05f65ff5 100644 --- a/database/create_cross_region_autonomous_database_data_guard_details.go +++ b/database/create_cross_region_autonomous_database_data_guard_details.go @@ -139,6 +139,9 @@ type CreateCrossRegionAutonomousDatabaseDataGuardDetails struct { // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. IsAutoScalingEnabled *bool `mandatory:"false" json:"isAutoScalingEnabled"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // True if the database is on dedicated Exadata infrastructure (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html). IsDedicated *bool `mandatory:"false" json:"isDedicated"` @@ -391,6 +394,11 @@ func (m CreateCrossRegionAutonomousDatabaseDataGuardDetails) GetIsAutoScalingEna return m.IsAutoScalingEnabled } +// GetIsDevTier returns IsDevTier +func (m CreateCrossRegionAutonomousDatabaseDataGuardDetails) GetIsDevTier() *bool { + return m.IsDevTier +} + // GetIsDedicated returns IsDedicated func (m CreateCrossRegionAutonomousDatabaseDataGuardDetails) GetIsDedicated() *bool { return m.IsDedicated diff --git a/database/create_cross_region_disaster_recovery_details.go b/database/create_cross_region_disaster_recovery_details.go index 89b76debc6..036cd1e673 100644 --- a/database/create_cross_region_disaster_recovery_details.go +++ b/database/create_cross_region_disaster_recovery_details.go @@ -138,6 +138,9 @@ type CreateCrossRegionDisasterRecoveryDetails struct { // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. IsAutoScalingEnabled *bool `mandatory:"false" json:"isAutoScalingEnabled"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // True if the database is on dedicated Exadata infrastructure (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html). IsDedicated *bool `mandatory:"false" json:"isDedicated"` @@ -398,6 +401,11 @@ func (m CreateCrossRegionDisasterRecoveryDetails) GetIsAutoScalingEnabled() *boo return m.IsAutoScalingEnabled } +// GetIsDevTier returns IsDevTier +func (m CreateCrossRegionDisasterRecoveryDetails) GetIsDevTier() *bool { + return m.IsDevTier +} + // GetIsDedicated returns IsDedicated func (m CreateCrossRegionDisasterRecoveryDetails) GetIsDedicated() *bool { return m.IsDedicated diff --git a/database/create_refreshable_autonomous_database_clone_details.go b/database/create_refreshable_autonomous_database_clone_details.go index 15ce928a6f..00ced583cb 100644 --- a/database/create_refreshable_autonomous_database_clone_details.go +++ b/database/create_refreshable_autonomous_database_clone_details.go @@ -92,6 +92,9 @@ type CreateRefreshableAutonomousDatabaseCloneDetails struct { // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. The default value is `TRUE`. IsAutoScalingEnabled *bool `mandatory:"false" json:"isAutoScalingEnabled"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // True if the database is on dedicated Exadata infrastructure (https://docs.oracle.com/en/cloud/paas/autonomous-database/index.html). IsDedicated *bool `mandatory:"false" json:"isDedicated"` @@ -347,6 +350,11 @@ func (m CreateRefreshableAutonomousDatabaseCloneDetails) GetIsAutoScalingEnabled return m.IsAutoScalingEnabled } +// GetIsDevTier returns IsDevTier +func (m CreateRefreshableAutonomousDatabaseCloneDetails) GetIsDevTier() *bool { + return m.IsDevTier +} + // GetIsDedicated returns IsDedicated func (m CreateRefreshableAutonomousDatabaseCloneDetails) GetIsDedicated() *bool { return m.IsDedicated diff --git a/database/update_autonomous_database_details.go b/database/update_autonomous_database_details.go index 684ed646d9..5892540aab 100644 --- a/database/update_autonomous_database_details.go +++ b/database/update_autonomous_database_details.go @@ -45,6 +45,9 @@ type UpdateAutonomousDatabaseDetails struct { LongTermBackupSchedule *LongTermBackUpScheduleDetails `mandatory:"false" json:"longTermBackupSchedule"` + // This project introduces Autonomous Database for Developers (ADB-Dev), a free tier on dedicated infrastructure, and Cloud@Customer for database development purposes. ADB-Dev enables ExaDB customers to experiment with ADB for free and incentivizes enterprises to use ADB for new development projects.Note that ADB-Dev have 4 CPU and 20GB of memory. For ADB-Dev , memory and CPU cannot be scaled + IsDevTier *bool `mandatory:"false" json:"isDevTier"` + // The compute amount (CPUs) available to the database. Minimum and maximum values depend on the compute model and whether the database is an Autonomous Database Serverless instance or an Autonomous Database on Dedicated Exadata Infrastructure. // For an Autonomous Database Serverless instance, the 'ECPU' compute model requires a minimum value of one, for databases in the elastic resource pool and minimum value of two, otherwise. Required when using the `computeModel` parameter. When using `cpuCoreCount` parameter, it is an error to specify computeCount to a non-null value. Providing `computeModel` and `computeCount` is the preferred method for both OCPU and ECPU. // This cannot be updated in parallel with any of the following: licenseModel, databaseEdition, whitelistedIps, isMTLSConnectionRequired, openMode, permissionLevel, privateEndpointLabel, nsgIds, dbVersion, isRefreshable, dbName, scheduledOperations, dbToolsDetails, or isFreeTier. diff --git a/datascience/auto_scaling_policy.go b/datascience/auto_scaling_policy.go new file mode 100644 index 0000000000..8cfa955318 --- /dev/null +++ b/datascience/auto_scaling_policy.go @@ -0,0 +1,94 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// AutoScalingPolicy The scaling policy to enable autoscaling on the model deployment. +type AutoScalingPolicy struct { + + // The list of autoscaling policy details. + AutoScalingPolicies []AutoScalingPolicyDetails `mandatory:"true" json:"autoScalingPolicies"` + + // For threshold-based autoscaling policies, this value is the minimum period of time to wait between scaling actions. + // The cooldown period gives the system time to stabilize before rescaling. The minimum value is 600 seconds, which + // is also the default. The cooldown period starts when the model deployment becomes ACTIVE after the scaling operation. + CoolDownInSeconds *int `mandatory:"false" json:"coolDownInSeconds"` + + // Whether the autoscaling policy is enabled. + IsEnabled *bool `mandatory:"false" json:"isEnabled"` +} + +func (m AutoScalingPolicy) 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 AutoScalingPolicy) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m AutoScalingPolicy) MarshalJSON() (buff []byte, e error) { + type MarshalTypeAutoScalingPolicy AutoScalingPolicy + s := struct { + DiscriminatorParam string `json:"policyType"` + MarshalTypeAutoScalingPolicy + }{ + "AUTOSCALING", + (MarshalTypeAutoScalingPolicy)(m), + } + + return json.Marshal(&s) +} + +// UnmarshalJSON unmarshals from json +func (m *AutoScalingPolicy) UnmarshalJSON(data []byte) (e error) { + model := struct { + CoolDownInSeconds *int `json:"coolDownInSeconds"` + IsEnabled *bool `json:"isEnabled"` + AutoScalingPolicies []autoscalingpolicydetails `json:"autoScalingPolicies"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.CoolDownInSeconds = model.CoolDownInSeconds + + m.IsEnabled = model.IsEnabled + + m.AutoScalingPolicies = make([]AutoScalingPolicyDetails, len(model.AutoScalingPolicies)) + for i, n := range model.AutoScalingPolicies { + nn, e = n.UnmarshalPolymorphicJSON(n.JsonData) + if e != nil { + return e + } + if nn != nil { + m.AutoScalingPolicies[i] = nn.(AutoScalingPolicyDetails) + } else { + m.AutoScalingPolicies[i] = nil + } + } + return +} diff --git a/datascience/auto_scaling_policy_details.go b/datascience/auto_scaling_policy_details.go new file mode 100644 index 0000000000..f169b7a582 --- /dev/null +++ b/datascience/auto_scaling_policy_details.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// AutoScalingPolicyDetails Details for an autoscaling policy to enable on the model deployment. +// Each autoscaling configuration can have one autoscaling policy. +// In a threshold-based autoscaling policy, an autoscaling action is triggered when a performance metric meets +// or exceeds a threshold. +type AutoScalingPolicyDetails interface { +} + +type autoscalingpolicydetails struct { + JsonData []byte + AutoScalingPolicyType string `json:"autoScalingPolicyType"` +} + +// UnmarshalJSON unmarshals json +func (m *autoscalingpolicydetails) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerautoscalingpolicydetails autoscalingpolicydetails + s := struct { + Model Unmarshalerautoscalingpolicydetails + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.AutoScalingPolicyType = s.Model.AutoScalingPolicyType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *autoscalingpolicydetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.AutoScalingPolicyType { + case "THRESHOLD": + mm := ThresholdBasedAutoScalingPolicyDetails{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for AutoScalingPolicyDetails: %s.", m.AutoScalingPolicyType) + return *m, nil + } +} + +func (m autoscalingpolicydetails) 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 autoscalingpolicydetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum Enum with underlying type: string +type AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum string + +// Set of constants representing the allowable values for AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum +const ( + AutoScalingPolicyDetailsAutoScalingPolicyTypeThreshold AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum = "THRESHOLD" +) + +var mappingAutoScalingPolicyDetailsAutoScalingPolicyTypeEnum = map[string]AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum{ + "THRESHOLD": AutoScalingPolicyDetailsAutoScalingPolicyTypeThreshold, +} + +var mappingAutoScalingPolicyDetailsAutoScalingPolicyTypeEnumLowerCase = map[string]AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum{ + "threshold": AutoScalingPolicyDetailsAutoScalingPolicyTypeThreshold, +} + +// GetAutoScalingPolicyDetailsAutoScalingPolicyTypeEnumValues Enumerates the set of values for AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum +func GetAutoScalingPolicyDetailsAutoScalingPolicyTypeEnumValues() []AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum { + values := make([]AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum, 0) + for _, v := range mappingAutoScalingPolicyDetailsAutoScalingPolicyTypeEnum { + values = append(values, v) + } + return values +} + +// GetAutoScalingPolicyDetailsAutoScalingPolicyTypeEnumStringValues Enumerates the set of values in String for AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum +func GetAutoScalingPolicyDetailsAutoScalingPolicyTypeEnumStringValues() []string { + return []string{ + "THRESHOLD", + } +} + +// GetMappingAutoScalingPolicyDetailsAutoScalingPolicyTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingAutoScalingPolicyDetailsAutoScalingPolicyTypeEnum(val string) (AutoScalingPolicyDetailsAutoScalingPolicyTypeEnum, bool) { + enum, ok := mappingAutoScalingPolicyDetailsAutoScalingPolicyTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/datascience/custom_expression_query_scaling_configuration.go b/datascience/custom_expression_query_scaling_configuration.go new file mode 100644 index 0000000000..c4775d1706 --- /dev/null +++ b/datascience/custom_expression_query_scaling_configuration.go @@ -0,0 +1,86 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CustomExpressionQueryScalingConfiguration The scaling configuration for the custom metric expression rule. +type CustomExpressionQueryScalingConfiguration struct { + + // The Monitoring Query Language (MQL) expression to evaluate for the alarm. The Alarms feature of + // the Monitoring service interprets results for each returned time series as Boolean values, + // where zero represents false and a non-zero value represents true. A true value means that the trigger + // rule condition has been met. The query must specify a metric, statistic, interval, and trigger + // rule (threshold or absence). Supported values for interval: `1m`-`60m` (also `1h`). You can optionally + // specify dimensions and grouping functions. Supported grouping functions: `grouping()`, `groupBy()`. + // Example of threshold alarm: + // ----- + // CPUUtilization[1m]{resourceId = "MODEL_DEPLOYMENT_OCID"}.grouping().mean() < 25 + // CPUUtilization[1m]{resourceId = "MODEL_DEPLOYMENT_OCID"}.grouping().mean() > 75 + // ----- + Query *string `mandatory:"true" json:"query"` + + // The period of time that the condition defined in the alarm must persist before the alarm state + // changes from "OK" to "FIRING" or vice versa. For example, a value of 5 minutes means that the + // alarm must persist in breaching the condition for five minutes before the alarm updates its + // state to "FIRING"; likewise, the alarm must persist in not breaching the condition for five + // minutes before the alarm updates its state to "OK." + // The duration is specified as a string in ISO 8601 format (`PT10M` for ten minutes or `PT1H` + // for one hour). Minimum: PT3M. Maximum: PT1H. Default: PT3M. + PendingDuration *string `mandatory:"false" json:"pendingDuration"` + + // The value is used for adjusting the count of instances by. + InstanceCountAdjustment *int `mandatory:"false" json:"instanceCountAdjustment"` +} + +// GetPendingDuration returns PendingDuration +func (m CustomExpressionQueryScalingConfiguration) GetPendingDuration() *string { + return m.PendingDuration +} + +// GetInstanceCountAdjustment returns InstanceCountAdjustment +func (m CustomExpressionQueryScalingConfiguration) GetInstanceCountAdjustment() *int { + return m.InstanceCountAdjustment +} + +func (m CustomExpressionQueryScalingConfiguration) 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 CustomExpressionQueryScalingConfiguration) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m CustomExpressionQueryScalingConfiguration) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCustomExpressionQueryScalingConfiguration CustomExpressionQueryScalingConfiguration + s := struct { + DiscriminatorParam string `json:"scalingConfigurationType"` + MarshalTypeCustomExpressionQueryScalingConfiguration + }{ + "QUERY", + (MarshalTypeCustomExpressionQueryScalingConfiguration)(m), + } + + return json.Marshal(&s) +} diff --git a/datascience/custom_metric_expression_rule.go b/datascience/custom_metric_expression_rule.go new file mode 100644 index 0000000000..d935b05de5 --- /dev/null +++ b/datascience/custom_metric_expression_rule.go @@ -0,0 +1,54 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CustomMetricExpressionRule A custom Monitoring Query Language (MQL) expression for triggering an autoscaling action on the model deployment. +type CustomMetricExpressionRule struct { + ScaleInConfiguration *CustomExpressionQueryScalingConfiguration `mandatory:"true" json:"scaleInConfiguration"` + + ScaleOutConfiguration *CustomExpressionQueryScalingConfiguration `mandatory:"true" json:"scaleOutConfiguration"` +} + +func (m CustomMetricExpressionRule) 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 CustomMetricExpressionRule) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m CustomMetricExpressionRule) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCustomMetricExpressionRule CustomMetricExpressionRule + s := struct { + DiscriminatorParam string `json:"metricExpressionRuleType"` + MarshalTypeCustomMetricExpressionRule + }{ + "CUSTOM_EXPRESSION", + (MarshalTypeCustomMetricExpressionRule)(m), + } + + return json.Marshal(&s) +} diff --git a/datascience/instance_pool_model_deployment_system_data.go b/datascience/instance_pool_model_deployment_system_data.go new file mode 100644 index 0000000000..6fc940e680 --- /dev/null +++ b/datascience/instance_pool_model_deployment_system_data.go @@ -0,0 +1,54 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// InstancePoolModelDeploymentSystemData Instance pool based model deployment system data. +type InstancePoolModelDeploymentSystemData struct { + + // This value is the current count of the model deployment instances. + CurrentInstanceCount *int `mandatory:"false" json:"currentInstanceCount"` +} + +func (m InstancePoolModelDeploymentSystemData) 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 InstancePoolModelDeploymentSystemData) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m InstancePoolModelDeploymentSystemData) MarshalJSON() (buff []byte, e error) { + type MarshalTypeInstancePoolModelDeploymentSystemData InstancePoolModelDeploymentSystemData + s := struct { + DiscriminatorParam string `json:"systemInfraType"` + MarshalTypeInstancePoolModelDeploymentSystemData + }{ + "INSTANCE_POOL", + (MarshalTypeInstancePoolModelDeploymentSystemData)(m), + } + + return json.Marshal(&s) +} diff --git a/datascience/metric_expression_rule.go b/datascience/metric_expression_rule.go new file mode 100644 index 0000000000..a3edd78aab --- /dev/null +++ b/datascience/metric_expression_rule.go @@ -0,0 +1,123 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// MetricExpressionRule The metric expression rule base. +type MetricExpressionRule interface { +} + +type metricexpressionrule struct { + JsonData []byte + MetricExpressionRuleType string `json:"metricExpressionRuleType"` +} + +// UnmarshalJSON unmarshals json +func (m *metricexpressionrule) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalermetricexpressionrule metricexpressionrule + s := struct { + Model Unmarshalermetricexpressionrule + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.MetricExpressionRuleType = s.Model.MetricExpressionRuleType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *metricexpressionrule) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.MetricExpressionRuleType { + case "PREDEFINED_EXPRESSION": + mm := PredefinedMetricExpressionRule{} + err = json.Unmarshal(data, &mm) + return mm, err + case "CUSTOM_EXPRESSION": + mm := CustomMetricExpressionRule{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for MetricExpressionRule: %s.", m.MetricExpressionRuleType) + return *m, nil + } +} + +func (m metricexpressionrule) 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 metricexpressionrule) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MetricExpressionRuleMetricExpressionRuleTypeEnum Enum with underlying type: string +type MetricExpressionRuleMetricExpressionRuleTypeEnum string + +// Set of constants representing the allowable values for MetricExpressionRuleMetricExpressionRuleTypeEnum +const ( + MetricExpressionRuleMetricExpressionRuleTypePredefinedExpression MetricExpressionRuleMetricExpressionRuleTypeEnum = "PREDEFINED_EXPRESSION" + MetricExpressionRuleMetricExpressionRuleTypeCustomExpression MetricExpressionRuleMetricExpressionRuleTypeEnum = "CUSTOM_EXPRESSION" +) + +var mappingMetricExpressionRuleMetricExpressionRuleTypeEnum = map[string]MetricExpressionRuleMetricExpressionRuleTypeEnum{ + "PREDEFINED_EXPRESSION": MetricExpressionRuleMetricExpressionRuleTypePredefinedExpression, + "CUSTOM_EXPRESSION": MetricExpressionRuleMetricExpressionRuleTypeCustomExpression, +} + +var mappingMetricExpressionRuleMetricExpressionRuleTypeEnumLowerCase = map[string]MetricExpressionRuleMetricExpressionRuleTypeEnum{ + "predefined_expression": MetricExpressionRuleMetricExpressionRuleTypePredefinedExpression, + "custom_expression": MetricExpressionRuleMetricExpressionRuleTypeCustomExpression, +} + +// GetMetricExpressionRuleMetricExpressionRuleTypeEnumValues Enumerates the set of values for MetricExpressionRuleMetricExpressionRuleTypeEnum +func GetMetricExpressionRuleMetricExpressionRuleTypeEnumValues() []MetricExpressionRuleMetricExpressionRuleTypeEnum { + values := make([]MetricExpressionRuleMetricExpressionRuleTypeEnum, 0) + for _, v := range mappingMetricExpressionRuleMetricExpressionRuleTypeEnum { + values = append(values, v) + } + return values +} + +// GetMetricExpressionRuleMetricExpressionRuleTypeEnumStringValues Enumerates the set of values in String for MetricExpressionRuleMetricExpressionRuleTypeEnum +func GetMetricExpressionRuleMetricExpressionRuleTypeEnumStringValues() []string { + return []string{ + "PREDEFINED_EXPRESSION", + "CUSTOM_EXPRESSION", + } +} + +// GetMappingMetricExpressionRuleMetricExpressionRuleTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingMetricExpressionRuleMetricExpressionRuleTypeEnum(val string) (MetricExpressionRuleMetricExpressionRuleTypeEnum, bool) { + enum, ok := mappingMetricExpressionRuleMetricExpressionRuleTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/datascience/model_configuration_details.go b/datascience/model_configuration_details.go index 59c5d3e779..f582ecea11 100644 --- a/datascience/model_configuration_details.go +++ b/datascience/model_configuration_details.go @@ -28,6 +28,9 @@ type ModelConfigurationDetails struct { // The minimum network bandwidth for the model deployment. BandwidthMbps *int `mandatory:"false" json:"bandwidthMbps"` + + // The maximum network bandwidth for the model deployment. + MaximumBandwidthMbps *int `mandatory:"false" json:"maximumBandwidthMbps"` } func (m ModelConfigurationDetails) String() string { @@ -51,6 +54,7 @@ func (m *ModelConfigurationDetails) UnmarshalJSON(data []byte) (e error) { model := struct { ScalingPolicy scalingpolicy `json:"scalingPolicy"` BandwidthMbps *int `json:"bandwidthMbps"` + MaximumBandwidthMbps *int `json:"maximumBandwidthMbps"` ModelId *string `json:"modelId"` InstanceConfiguration *InstanceConfiguration `json:"instanceConfiguration"` }{} @@ -72,6 +76,8 @@ func (m *ModelConfigurationDetails) UnmarshalJSON(data []byte) (e error) { m.BandwidthMbps = model.BandwidthMbps + m.MaximumBandwidthMbps = model.MaximumBandwidthMbps + m.ModelId = model.ModelId m.InstanceConfiguration = model.InstanceConfiguration diff --git a/datascience/model_deployment.go b/datascience/model_deployment.go index 64697e8fe7..1b3bb3b043 100644 --- a/datascience/model_deployment.go +++ b/datascience/model_deployment.go @@ -52,6 +52,8 @@ type ModelDeployment struct { CategoryLogDetails *CategoryLogDetails `mandatory:"false" json:"categoryLogDetails"` + ModelDeploymentSystemData ModelDeploymentSystemData `mandatory:"false" json:"modelDeploymentSystemData"` + // Details about the state of the model deployment. LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` @@ -89,6 +91,7 @@ func (m *ModelDeployment) UnmarshalJSON(data []byte) (e error) { Description *string `json:"description"` ModelDeploymentConfigurationDetails modeldeploymentconfigurationdetails `json:"modelDeploymentConfigurationDetails"` CategoryLogDetails *CategoryLogDetails `json:"categoryLogDetails"` + ModelDeploymentSystemData modeldeploymentsystemdata `json:"modelDeploymentSystemData"` LifecycleDetails *string `json:"lifecycleDetails"` FreeformTags map[string]string `json:"freeformTags"` DefinedTags map[string]map[string]interface{} `json:"definedTags"` @@ -121,6 +124,16 @@ func (m *ModelDeployment) UnmarshalJSON(data []byte) (e error) { m.CategoryLogDetails = model.CategoryLogDetails + nn, e = model.ModelDeploymentSystemData.UnmarshalPolymorphicJSON(model.ModelDeploymentSystemData.JsonData) + if e != nil { + return + } + if nn != nil { + m.ModelDeploymentSystemData = nn.(ModelDeploymentSystemData) + } else { + m.ModelDeploymentSystemData = nil + } + m.LifecycleDetails = model.LifecycleDetails m.FreeformTags = model.FreeformTags diff --git a/datascience/model_deployment_instance_shape_config_details.go b/datascience/model_deployment_instance_shape_config_details.go index 30e5d9ac18..0f8c8aa1e4 100644 --- a/datascience/model_deployment_instance_shape_config_details.go +++ b/datascience/model_deployment_instance_shape_config_details.go @@ -23,6 +23,13 @@ type ModelDeploymentInstanceShapeConfigDetails struct { // A model-deployment instance of type VM.Standard.E3.Flex or VM.Standard.E4.Flex allows the memory to be specified with in the range of 6 to 1024 GB. VM.Standard3.Flex memory range is between 6 to 512 GB and VM.Optimized3.Flex memory range is between 6 to 256 GB. MemoryInGBs *float32 `mandatory:"false" json:"memoryInGBs"` + + // The baseline OCPU utilization for a subcore burstable VM instance. If this attribute is left blank, it will default to `BASELINE_1_1`. + // The following values are supported: + // BASELINE_1_8 - baseline usage is 1/8 of an OCPU. + // BASELINE_1_2 - baseline usage is 1/2 of an OCPU. + // BASELINE_1_1 - baseline usage is an entire OCPU. This represents a non-burstable instance. + CpuBaseline ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum `mandatory:"false" json:"cpuBaseline,omitempty"` } func (m ModelDeploymentInstanceShapeConfigDetails) String() string { @@ -35,8 +42,57 @@ func (m ModelDeploymentInstanceShapeConfigDetails) String() string { func (m ModelDeploymentInstanceShapeConfigDetails) ValidateEnumValue() (bool, error) { errMessage := []string{} + if _, ok := GetMappingModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum(string(m.CpuBaseline)); !ok && m.CpuBaseline != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for CpuBaseline: %s. Supported values are: %s.", m.CpuBaseline, strings.Join(GetModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnumStringValues(), ","))) + } if len(errMessage) > 0 { return true, fmt.Errorf(strings.Join(errMessage, "\n")) } return false, nil } + +// ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum Enum with underlying type: string +type ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum string + +// Set of constants representing the allowable values for ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum +const ( + ModelDeploymentInstanceShapeConfigDetailsCpuBaseline8 ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum = "BASELINE_1_8" + ModelDeploymentInstanceShapeConfigDetailsCpuBaseline2 ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum = "BASELINE_1_2" + ModelDeploymentInstanceShapeConfigDetailsCpuBaseline1 ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum = "BASELINE_1_1" +) + +var mappingModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum = map[string]ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum{ + "BASELINE_1_8": ModelDeploymentInstanceShapeConfigDetailsCpuBaseline8, + "BASELINE_1_2": ModelDeploymentInstanceShapeConfigDetailsCpuBaseline2, + "BASELINE_1_1": ModelDeploymentInstanceShapeConfigDetailsCpuBaseline1, +} + +var mappingModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnumLowerCase = map[string]ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum{ + "baseline_1_8": ModelDeploymentInstanceShapeConfigDetailsCpuBaseline8, + "baseline_1_2": ModelDeploymentInstanceShapeConfigDetailsCpuBaseline2, + "baseline_1_1": ModelDeploymentInstanceShapeConfigDetailsCpuBaseline1, +} + +// GetModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnumValues Enumerates the set of values for ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum +func GetModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnumValues() []ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum { + values := make([]ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum, 0) + for _, v := range mappingModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum { + values = append(values, v) + } + return values +} + +// GetModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnumStringValues Enumerates the set of values in String for ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum +func GetModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnumStringValues() []string { + return []string{ + "BASELINE_1_8", + "BASELINE_1_2", + "BASELINE_1_1", + } +} + +// GetMappingModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum(val string) (ModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnum, bool) { + enum, ok := mappingModelDeploymentInstanceShapeConfigDetailsCpuBaselineEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/datascience/model_deployment_system_data.go b/datascience/model_deployment_system_data.go new file mode 100644 index 0000000000..a7aedbd53e --- /dev/null +++ b/datascience/model_deployment_system_data.go @@ -0,0 +1,115 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ModelDeploymentSystemData Model deployment system data. +type ModelDeploymentSystemData interface { +} + +type modeldeploymentsystemdata struct { + JsonData []byte + SystemInfraType string `json:"systemInfraType"` +} + +// UnmarshalJSON unmarshals json +func (m *modeldeploymentsystemdata) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalermodeldeploymentsystemdata modeldeploymentsystemdata + s := struct { + Model Unmarshalermodeldeploymentsystemdata + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.SystemInfraType = s.Model.SystemInfraType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *modeldeploymentsystemdata) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.SystemInfraType { + case "INSTANCE_POOL": + mm := InstancePoolModelDeploymentSystemData{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for ModelDeploymentSystemData: %s.", m.SystemInfraType) + return *m, nil + } +} + +func (m modeldeploymentsystemdata) 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 modeldeploymentsystemdata) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ModelDeploymentSystemDataSystemInfraTypeEnum Enum with underlying type: string +type ModelDeploymentSystemDataSystemInfraTypeEnum string + +// Set of constants representing the allowable values for ModelDeploymentSystemDataSystemInfraTypeEnum +const ( + ModelDeploymentSystemDataSystemInfraTypeInstancePool ModelDeploymentSystemDataSystemInfraTypeEnum = "INSTANCE_POOL" +) + +var mappingModelDeploymentSystemDataSystemInfraTypeEnum = map[string]ModelDeploymentSystemDataSystemInfraTypeEnum{ + "INSTANCE_POOL": ModelDeploymentSystemDataSystemInfraTypeInstancePool, +} + +var mappingModelDeploymentSystemDataSystemInfraTypeEnumLowerCase = map[string]ModelDeploymentSystemDataSystemInfraTypeEnum{ + "instance_pool": ModelDeploymentSystemDataSystemInfraTypeInstancePool, +} + +// GetModelDeploymentSystemDataSystemInfraTypeEnumValues Enumerates the set of values for ModelDeploymentSystemDataSystemInfraTypeEnum +func GetModelDeploymentSystemDataSystemInfraTypeEnumValues() []ModelDeploymentSystemDataSystemInfraTypeEnum { + values := make([]ModelDeploymentSystemDataSystemInfraTypeEnum, 0) + for _, v := range mappingModelDeploymentSystemDataSystemInfraTypeEnum { + values = append(values, v) + } + return values +} + +// GetModelDeploymentSystemDataSystemInfraTypeEnumStringValues Enumerates the set of values in String for ModelDeploymentSystemDataSystemInfraTypeEnum +func GetModelDeploymentSystemDataSystemInfraTypeEnumStringValues() []string { + return []string{ + "INSTANCE_POOL", + } +} + +// GetMappingModelDeploymentSystemDataSystemInfraTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingModelDeploymentSystemDataSystemInfraTypeEnum(val string) (ModelDeploymentSystemDataSystemInfraTypeEnum, bool) { + enum, ok := mappingModelDeploymentSystemDataSystemInfraTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/datascience/predefined_expression_threshold_scaling_configuration.go b/datascience/predefined_expression_threshold_scaling_configuration.go new file mode 100644 index 0000000000..13a660e811 --- /dev/null +++ b/datascience/predefined_expression_threshold_scaling_configuration.go @@ -0,0 +1,76 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// PredefinedExpressionThresholdScalingConfiguration The scaling configuration for the predefined metric expression rule. +type PredefinedExpressionThresholdScalingConfiguration struct { + + // A metric value at which the scaling operation will be triggered. + Threshold *int `mandatory:"true" json:"threshold"` + + // The period of time that the condition defined in the alarm must persist before the alarm state + // changes from "OK" to "FIRING" or vice versa. For example, a value of 5 minutes means that the + // alarm must persist in breaching the condition for five minutes before the alarm updates its + // state to "FIRING"; likewise, the alarm must persist in not breaching the condition for five + // minutes before the alarm updates its state to "OK." + // The duration is specified as a string in ISO 8601 format (`PT10M` for ten minutes or `PT1H` + // for one hour). Minimum: PT3M. Maximum: PT1H. Default: PT3M. + PendingDuration *string `mandatory:"false" json:"pendingDuration"` + + // The value is used for adjusting the count of instances by. + InstanceCountAdjustment *int `mandatory:"false" json:"instanceCountAdjustment"` +} + +// GetPendingDuration returns PendingDuration +func (m PredefinedExpressionThresholdScalingConfiguration) GetPendingDuration() *string { + return m.PendingDuration +} + +// GetInstanceCountAdjustment returns InstanceCountAdjustment +func (m PredefinedExpressionThresholdScalingConfiguration) GetInstanceCountAdjustment() *int { + return m.InstanceCountAdjustment +} + +func (m PredefinedExpressionThresholdScalingConfiguration) 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 PredefinedExpressionThresholdScalingConfiguration) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m PredefinedExpressionThresholdScalingConfiguration) MarshalJSON() (buff []byte, e error) { + type MarshalTypePredefinedExpressionThresholdScalingConfiguration PredefinedExpressionThresholdScalingConfiguration + s := struct { + DiscriminatorParam string `json:"scalingConfigurationType"` + MarshalTypePredefinedExpressionThresholdScalingConfiguration + }{ + "THRESHOLD", + (MarshalTypePredefinedExpressionThresholdScalingConfiguration)(m), + } + + return json.Marshal(&s) +} diff --git a/datascience/predefined_metric_expression_rule.go b/datascience/predefined_metric_expression_rule.go new file mode 100644 index 0000000000..f2dfda3ba7 --- /dev/null +++ b/datascience/predefined_metric_expression_rule.go @@ -0,0 +1,102 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// PredefinedMetricExpressionRule An expression built using CPU or Memory metrics for triggering an autoscaling action on the model deployment. +type PredefinedMetricExpressionRule struct { + ScaleInConfiguration *PredefinedExpressionThresholdScalingConfiguration `mandatory:"true" json:"scaleInConfiguration"` + + ScaleOutConfiguration *PredefinedExpressionThresholdScalingConfiguration `mandatory:"true" json:"scaleOutConfiguration"` + + // Metric type + MetricType PredefinedMetricExpressionRuleMetricTypeEnum `mandatory:"true" json:"metricType"` +} + +func (m PredefinedMetricExpressionRule) 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 PredefinedMetricExpressionRule) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingPredefinedMetricExpressionRuleMetricTypeEnum(string(m.MetricType)); !ok && m.MetricType != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for MetricType: %s. Supported values are: %s.", m.MetricType, strings.Join(GetPredefinedMetricExpressionRuleMetricTypeEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m PredefinedMetricExpressionRule) MarshalJSON() (buff []byte, e error) { + type MarshalTypePredefinedMetricExpressionRule PredefinedMetricExpressionRule + s := struct { + DiscriminatorParam string `json:"metricExpressionRuleType"` + MarshalTypePredefinedMetricExpressionRule + }{ + "PREDEFINED_EXPRESSION", + (MarshalTypePredefinedMetricExpressionRule)(m), + } + + return json.Marshal(&s) +} + +// PredefinedMetricExpressionRuleMetricTypeEnum Enum with underlying type: string +type PredefinedMetricExpressionRuleMetricTypeEnum string + +// Set of constants representing the allowable values for PredefinedMetricExpressionRuleMetricTypeEnum +const ( + PredefinedMetricExpressionRuleMetricTypeCpuUtilization PredefinedMetricExpressionRuleMetricTypeEnum = "CPU_UTILIZATION" + PredefinedMetricExpressionRuleMetricTypeMemoryUtilization PredefinedMetricExpressionRuleMetricTypeEnum = "MEMORY_UTILIZATION" +) + +var mappingPredefinedMetricExpressionRuleMetricTypeEnum = map[string]PredefinedMetricExpressionRuleMetricTypeEnum{ + "CPU_UTILIZATION": PredefinedMetricExpressionRuleMetricTypeCpuUtilization, + "MEMORY_UTILIZATION": PredefinedMetricExpressionRuleMetricTypeMemoryUtilization, +} + +var mappingPredefinedMetricExpressionRuleMetricTypeEnumLowerCase = map[string]PredefinedMetricExpressionRuleMetricTypeEnum{ + "cpu_utilization": PredefinedMetricExpressionRuleMetricTypeCpuUtilization, + "memory_utilization": PredefinedMetricExpressionRuleMetricTypeMemoryUtilization, +} + +// GetPredefinedMetricExpressionRuleMetricTypeEnumValues Enumerates the set of values for PredefinedMetricExpressionRuleMetricTypeEnum +func GetPredefinedMetricExpressionRuleMetricTypeEnumValues() []PredefinedMetricExpressionRuleMetricTypeEnum { + values := make([]PredefinedMetricExpressionRuleMetricTypeEnum, 0) + for _, v := range mappingPredefinedMetricExpressionRuleMetricTypeEnum { + values = append(values, v) + } + return values +} + +// GetPredefinedMetricExpressionRuleMetricTypeEnumStringValues Enumerates the set of values in String for PredefinedMetricExpressionRuleMetricTypeEnum +func GetPredefinedMetricExpressionRuleMetricTypeEnumStringValues() []string { + return []string{ + "CPU_UTILIZATION", + "MEMORY_UTILIZATION", + } +} + +// GetMappingPredefinedMetricExpressionRuleMetricTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingPredefinedMetricExpressionRuleMetricTypeEnum(val string) (PredefinedMetricExpressionRuleMetricTypeEnum, bool) { + enum, ok := mappingPredefinedMetricExpressionRuleMetricTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/datascience/scaling_configuration.go b/datascience/scaling_configuration.go new file mode 100644 index 0000000000..c7d3e7b92e --- /dev/null +++ b/datascience/scaling_configuration.go @@ -0,0 +1,149 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ScalingConfiguration Scaling configuration for the metric expression rule. +type ScalingConfiguration interface { + + // The period of time that the condition defined in the alarm must persist before the alarm state + // changes from "OK" to "FIRING" or vice versa. For example, a value of 5 minutes means that the + // alarm must persist in breaching the condition for five minutes before the alarm updates its + // state to "FIRING"; likewise, the alarm must persist in not breaching the condition for five + // minutes before the alarm updates its state to "OK." + // The duration is specified as a string in ISO 8601 format (`PT10M` for ten minutes or `PT1H` + // for one hour). Minimum: PT3M. Maximum: PT1H. Default: PT3M. + GetPendingDuration() *string + + // The value is used for adjusting the count of instances by. + GetInstanceCountAdjustment() *int +} + +type scalingconfiguration struct { + JsonData []byte + PendingDuration *string `mandatory:"false" json:"pendingDuration"` + InstanceCountAdjustment *int `mandatory:"false" json:"instanceCountAdjustment"` + ScalingConfigurationType string `json:"scalingConfigurationType"` +} + +// UnmarshalJSON unmarshals json +func (m *scalingconfiguration) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerscalingconfiguration scalingconfiguration + s := struct { + Model Unmarshalerscalingconfiguration + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.PendingDuration = s.Model.PendingDuration + m.InstanceCountAdjustment = s.Model.InstanceCountAdjustment + m.ScalingConfigurationType = s.Model.ScalingConfigurationType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *scalingconfiguration) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.ScalingConfigurationType { + case "QUERY": + mm := CustomExpressionQueryScalingConfiguration{} + err = json.Unmarshal(data, &mm) + return mm, err + case "THRESHOLD": + mm := PredefinedExpressionThresholdScalingConfiguration{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for ScalingConfiguration: %s.", m.ScalingConfigurationType) + return *m, nil + } +} + +// GetPendingDuration returns PendingDuration +func (m scalingconfiguration) GetPendingDuration() *string { + return m.PendingDuration +} + +// GetInstanceCountAdjustment returns InstanceCountAdjustment +func (m scalingconfiguration) GetInstanceCountAdjustment() *int { + return m.InstanceCountAdjustment +} + +func (m scalingconfiguration) 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 scalingconfiguration) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ScalingConfigurationScalingConfigurationTypeEnum Enum with underlying type: string +type ScalingConfigurationScalingConfigurationTypeEnum string + +// Set of constants representing the allowable values for ScalingConfigurationScalingConfigurationTypeEnum +const ( + ScalingConfigurationScalingConfigurationTypeThreshold ScalingConfigurationScalingConfigurationTypeEnum = "THRESHOLD" + ScalingConfigurationScalingConfigurationTypeQuery ScalingConfigurationScalingConfigurationTypeEnum = "QUERY" +) + +var mappingScalingConfigurationScalingConfigurationTypeEnum = map[string]ScalingConfigurationScalingConfigurationTypeEnum{ + "THRESHOLD": ScalingConfigurationScalingConfigurationTypeThreshold, + "QUERY": ScalingConfigurationScalingConfigurationTypeQuery, +} + +var mappingScalingConfigurationScalingConfigurationTypeEnumLowerCase = map[string]ScalingConfigurationScalingConfigurationTypeEnum{ + "threshold": ScalingConfigurationScalingConfigurationTypeThreshold, + "query": ScalingConfigurationScalingConfigurationTypeQuery, +} + +// GetScalingConfigurationScalingConfigurationTypeEnumValues Enumerates the set of values for ScalingConfigurationScalingConfigurationTypeEnum +func GetScalingConfigurationScalingConfigurationTypeEnumValues() []ScalingConfigurationScalingConfigurationTypeEnum { + values := make([]ScalingConfigurationScalingConfigurationTypeEnum, 0) + for _, v := range mappingScalingConfigurationScalingConfigurationTypeEnum { + values = append(values, v) + } + return values +} + +// GetScalingConfigurationScalingConfigurationTypeEnumStringValues Enumerates the set of values in String for ScalingConfigurationScalingConfigurationTypeEnum +func GetScalingConfigurationScalingConfigurationTypeEnumStringValues() []string { + return []string{ + "THRESHOLD", + "QUERY", + } +} + +// GetMappingScalingConfigurationScalingConfigurationTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingScalingConfigurationScalingConfigurationTypeEnum(val string) (ScalingConfigurationScalingConfigurationTypeEnum, bool) { + enum, ok := mappingScalingConfigurationScalingConfigurationTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/datascience/scaling_policy.go b/datascience/scaling_policy.go index 56dc7ef5e1..107e49ff81 100644 --- a/datascience/scaling_policy.go +++ b/datascience/scaling_policy.go @@ -50,6 +50,10 @@ func (m *scalingpolicy) UnmarshalPolymorphicJSON(data []byte) (interface{}, erro var err error switch m.PolicyType { + case "AUTOSCALING": + mm := AutoScalingPolicy{} + err = json.Unmarshal(data, &mm) + return mm, err case "FIXED_SIZE": mm := FixedSizeScalingPolicy{} err = json.Unmarshal(data, &mm) @@ -81,15 +85,18 @@ type ScalingPolicyPolicyTypeEnum string // Set of constants representing the allowable values for ScalingPolicyPolicyTypeEnum const ( - ScalingPolicyPolicyTypeFixedSize ScalingPolicyPolicyTypeEnum = "FIXED_SIZE" + ScalingPolicyPolicyTypeFixedSize ScalingPolicyPolicyTypeEnum = "FIXED_SIZE" + ScalingPolicyPolicyTypeAutoscaling ScalingPolicyPolicyTypeEnum = "AUTOSCALING" ) var mappingScalingPolicyPolicyTypeEnum = map[string]ScalingPolicyPolicyTypeEnum{ - "FIXED_SIZE": ScalingPolicyPolicyTypeFixedSize, + "FIXED_SIZE": ScalingPolicyPolicyTypeFixedSize, + "AUTOSCALING": ScalingPolicyPolicyTypeAutoscaling, } var mappingScalingPolicyPolicyTypeEnumLowerCase = map[string]ScalingPolicyPolicyTypeEnum{ - "fixed_size": ScalingPolicyPolicyTypeFixedSize, + "fixed_size": ScalingPolicyPolicyTypeFixedSize, + "autoscaling": ScalingPolicyPolicyTypeAutoscaling, } // GetScalingPolicyPolicyTypeEnumValues Enumerates the set of values for ScalingPolicyPolicyTypeEnum @@ -105,6 +112,7 @@ func GetScalingPolicyPolicyTypeEnumValues() []ScalingPolicyPolicyTypeEnum { func GetScalingPolicyPolicyTypeEnumStringValues() []string { return []string{ "FIXED_SIZE", + "AUTOSCALING", } } diff --git a/datascience/threshold_based_auto_scaling_policy_details.go b/datascience/threshold_based_auto_scaling_policy_details.go new file mode 100644 index 0000000000..4b0d84d395 --- /dev/null +++ b/datascience/threshold_based_auto_scaling_policy_details.go @@ -0,0 +1,105 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Data Science API +// +// Use the Data Science API to organize your data science work, access data and computing resources, and build, train, deploy and manage models and model deployments. For more information, see Data Science (https://docs.oracle.com/iaas/data-science/using/data-science.htm). +// + +package datascience + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ThresholdBasedAutoScalingPolicyDetails Details for a threshold-based autoscaling policy to enable on the model deployment. +// In a threshold-based autoscaling policy, an autoscaling action is triggered when a performance metric meets +// or exceeds a threshold. +type ThresholdBasedAutoScalingPolicyDetails struct { + + // The list of autoscaling policy rules. + Rules []MetricExpressionRule `mandatory:"true" json:"rules"` + + // For a threshold-based autoscaling policy, this value is the maximum number of instances the model deployment is allowed + // to increase to (scale out). + MaximumInstanceCount *int `mandatory:"true" json:"maximumInstanceCount"` + + // For a threshold-based autoscaling policy, this value is the minimum number of instances the model deployment is allowed + // to decrease to (scale in). + MinimumInstanceCount *int `mandatory:"true" json:"minimumInstanceCount"` + + // For a threshold-based autoscaling policy, this value is the initial number of instances to launch in the model deployment + // immediately after autoscaling is enabled. Note that anytime this value is updated, the number of instances will be reset + // to this value. After autoscaling retrieves performance metrics, the number of instances is automatically adjusted from + // this initial number to a number that is based on the limits that you set. + InitialInstanceCount *int `mandatory:"true" json:"initialInstanceCount"` +} + +func (m ThresholdBasedAutoScalingPolicyDetails) 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 ThresholdBasedAutoScalingPolicyDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m ThresholdBasedAutoScalingPolicyDetails) MarshalJSON() (buff []byte, e error) { + type MarshalTypeThresholdBasedAutoScalingPolicyDetails ThresholdBasedAutoScalingPolicyDetails + s := struct { + DiscriminatorParam string `json:"autoScalingPolicyType"` + MarshalTypeThresholdBasedAutoScalingPolicyDetails + }{ + "THRESHOLD", + (MarshalTypeThresholdBasedAutoScalingPolicyDetails)(m), + } + + return json.Marshal(&s) +} + +// UnmarshalJSON unmarshals from json +func (m *ThresholdBasedAutoScalingPolicyDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + Rules []metricexpressionrule `json:"rules"` + MaximumInstanceCount *int `json:"maximumInstanceCount"` + MinimumInstanceCount *int `json:"minimumInstanceCount"` + InitialInstanceCount *int `json:"initialInstanceCount"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.Rules = make([]MetricExpressionRule, len(model.Rules)) + for i, n := range model.Rules { + nn, e = n.UnmarshalPolymorphicJSON(n.JsonData) + if e != nil { + return e + } + if nn != nil { + m.Rules[i] = nn.(MetricExpressionRule) + } else { + m.Rules[i] = nil + } + } + m.MaximumInstanceCount = model.MaximumInstanceCount + + m.MinimumInstanceCount = model.MinimumInstanceCount + + m.InitialInstanceCount = model.InitialInstanceCount + + return +} diff --git a/datascience/update_model_configuration_details.go b/datascience/update_model_configuration_details.go index fe5def93b4..4c06ae4668 100644 --- a/datascience/update_model_configuration_details.go +++ b/datascience/update_model_configuration_details.go @@ -28,6 +28,9 @@ type UpdateModelConfigurationDetails struct { // The minimum network bandwidth for the model deployment. BandwidthMbps *int `mandatory:"false" json:"bandwidthMbps"` + + // The maximum network bandwidth for the model deployment. + MaximumBandwidthMbps *int `mandatory:"false" json:"maximumBandwidthMbps"` } func (m UpdateModelConfigurationDetails) String() string { @@ -52,6 +55,7 @@ func (m *UpdateModelConfigurationDetails) UnmarshalJSON(data []byte) (e error) { InstanceConfiguration *InstanceConfiguration `json:"instanceConfiguration"` ScalingPolicy scalingpolicy `json:"scalingPolicy"` BandwidthMbps *int `json:"bandwidthMbps"` + MaximumBandwidthMbps *int `json:"maximumBandwidthMbps"` ModelId *string `json:"modelId"` }{} @@ -74,6 +78,8 @@ func (m *UpdateModelConfigurationDetails) UnmarshalJSON(data []byte) (e error) { m.BandwidthMbps = model.BandwidthMbps + m.MaximumBandwidthMbps = model.MaximumBandwidthMbps + m.ModelId = model.ModelId return diff --git a/example/example_genai_generate_text.go b/example/example_genai_generate_text.go new file mode 100644 index 0000000000..629cc649d3 --- /dev/null +++ b/example/example_genai_generate_text.go @@ -0,0 +1,73 @@ +// Copyright (c) 2016, 2018, 2024, 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. + +// Example code for using the Gen AI Generate Text API + +package example + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/oracle/oci-go-sdk/v65/common" + "github.com/oracle/oci-go-sdk/v65/example/helpers" + "github.com/oracle/oci-go-sdk/v65/generativeaiinference" +) + +func ExampleGenerateText() { + region := "us-chicago-1" + compartment_id := "" // compartmentId that has policies grant permissions for using Generative AI Service + c, clerr := generativeaiinference.NewGenerativeAiInferenceClientWithConfigurationProvider(common.DefaultConfigProvider()) + helpers.FatalIfError(clerr) + c.SetRegion(region) + ctx := context.Background() + + modelId := "cohere.command" + prompt := "Tell me a fact about the Earth" + max_tokens := 75 + temperature := 0.75 + frequency_penalty := 1.0 + top_p := 0.7 + isStream := false + details := generativeaiinference.GenerateTextDetails{ + CompartmentId: &compartment_id, + ServingMode: generativeaiinference.OnDemandServingMode{ + ModelId: &modelId, + }, + InferenceRequest: generativeaiinference.CohereLlmInferenceRequest{ + Prompt: &prompt, + IsStream: &isStream, + MaxTokens: &max_tokens, + Temperature: &temperature, + TopP: &top_p, + FrequencyPenalty: &frequency_penalty, + }, + } + + req := generativeaiinference.GenerateTextRequest{ + GenerateTextDetails: details, + } + + // application/json response type + resp, err := c.GenerateText(ctx, req) + helpers.FatalIfError(err) + fmt.Println(resp) // Response body contains generated text response to the prompt + + // text/event-stream response type + isStream = true + resp, err = c.GenerateText(ctx, req) + helpers.FatalIfError(err) + + sseReader, err := common.NewSSEReader(resp.HTTPResponse()) + helpers.FatalIfError(err) + + // Print each event's text field + err = sseReader.ReadAllEvents(func(event []byte) { + var parsed generativeaiinference.GeneratedText + json.Unmarshal([]byte(event), &parsed) + fmt.Print(*parsed.Text) + }) + helpers.FatalIfError(err) + +}