// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/dif"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleUpdateStack() {
	// Create a default authentication provider that uses the DEFAULT
	// profile in the configuration file.
	// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
	client, err := dif.NewStackClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := dif.UpdateStackRequest{IfMatch: common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("T9JGJM2KV7S3PL76WZ39<unique_ID>"),
		StackId:      common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-stackId-Value"),
		UpdateStackDetails: dif.UpdateStackDetails{Dataflow: []dif.DataflowUpdateDetail{dif.DataflowUpdateDetail{ExecutorShapeConfig: &dif.ShapeConfig{MemoryInGBs: common.Int(31),
			Ocpus: common.Int(204)},
			LogBucketInstanceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-logBucketInstanceId-Value"),
			NumExecutors:        common.Int(374),
			SparkVersion:        common.String("EXAMPLE-sparkVersion-Value"),
			DriverShapeConfig: &dif.ShapeConfig{MemoryInGBs: common.Int(680),
				Ocpus: common.Int(117)},
			InstanceId:                common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value"),
			PrivateEndpointId:         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-privateEndpointId-Value"),
			WarehouseBucketInstanceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-warehouseBucketInstanceId-Value"),
			Connections: &dif.UpdateDataflowConnections{ConnectionDetails: &dif.DataflowConnectionDetails{DomainNames: []string{"EXAMPLE--Value"},
				DifDependencies: []dif.DifDependencyDetails{dif.DifDependencyDetails{ServiceInstanceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-serviceInstanceId-Value"),
					ServiceType: common.String("EXAMPLE-serviceType-Value")}}}},
			DriverShape:   common.String("EXAMPLE-driverShape-Value"),
			ExecutorShape: common.String("EXAMPLE-executorShape-Value")}},
			Ggcs: []dif.GgcsUpdateDetail{dif.GgcsUpdateDetail{Connections: []dif.GgcsConnectionDetails{dif.GgcsConnectionDetails{ConnectionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-connectionId-Value"),
				ConnectionName: common.String("EXAMPLE-connectionName-Value"),
				DifDependencies: []dif.DifDependencyDetails{dif.DifDependencyDetails{ServiceInstanceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-serviceInstanceId-Value"),
					ServiceType: common.String("EXAMPLE-serviceType-Value")}},
				GgAdminSecretId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-ggAdminSecretId-Value")}},
				InstanceId:     common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value"),
				Ocpu:           common.Int(349),
				PublicSubnetId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-publicSubnetId-Value")}},
			NotificationEmail: common.String("EXAMPLE-notificationEmail-Value"),
			Objectstorage: []dif.ObjectStorageUpdateDetail{dif.ObjectStorageUpdateDetail{AutoTiering: dif.AutoTieringInfrequentaccess,
				InstanceId:       common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value"),
				ObjectVersioning: dif.ObjectVersioningEnabled}},
			Services:       []dif.ServiceEnum{dif.ServiceDataflow},
			StackTemplates: []dif.StackTemplateEnum{dif.StackTemplateDatatransformation},
			Adb: []dif.AdbUpdateDetail{dif.AdbUpdateDetail{DataStorageSizeInTBs: common.Int(197),
				Ecpu:                     common.Int(989),
				InstanceId:               common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value"),
				IsMtlsConnectionRequired: common.Bool(true)}},
			DefinedTags:  map[string]map[string]interface{}{"EXAMPLE_KEY_U31eH": map[string]interface{}{"EXAMPLE_KEY_C3FrJ": "EXAMPLE--Value"}},
			FreeformTags: map[string]string{"EXAMPLE_KEY_sMM3c": "EXAMPLE_VALUE_xgqAHZIU76AW7EqnxL4e"},
			Genai: []dif.GenAiUpdateDetail{dif.GenAiUpdateDetail{Endpoints: []dif.EndpointDetails{dif.EndpointDetails{EndpointName: common.String("EXAMPLE-endpointName-Value"),
				IsContentModerationEnabled: common.Bool(false)}},
				InstanceId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value"),
				UnitCount:  common.Int(434)}}}}

	// Send the request using the service client
	resp, err := client.UpdateStack(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}