// 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).
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.DifService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Dif
{
public class UpdateStackExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var updateStackDetails = new Oci.DifService.Models.UpdateStackDetails
{
NotificationEmail = "EXAMPLE-notificationEmail-Value",
StackTemplates = new List<Oci.DifService.Models.StackTemplate>
{
Oci.DifService.Models.StackTemplate.Aiservices
},
Services = new List<Oci.DifService.Models.Service>
{
Oci.DifService.Models.Service.Aidataplatform
},
Adb = new List<Oci.DifService.Models.AdbUpdateDetail>
{
new Oci.DifService.Models.AdbUpdateDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
Ecpu = 971,
DataStorageSizeInTBs = 94,
IsMtlsConnectionRequired = false
}
},
Ggcs = new List<Oci.DifService.Models.GgcsUpdateDetail>
{
new Oci.DifService.Models.GgcsUpdateDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
Ocpu = 662,
PublicSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-publicSubnetId-Value",
Connections = new List<Oci.DifService.Models.GgcsConnectionDetails>
{
new Oci.DifService.Models.GgcsConnectionDetails
{
ConnectionName = "EXAMPLE-connectionName-Value",
DifDependencies = new List<Oci.DifService.Models.DifDependencyDetails>
{
new Oci.DifService.Models.DifDependencyDetails
{
ServiceType = "EXAMPLE-serviceType-Value",
ServiceInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-serviceInstanceId-Value"
}
},
GgAdminSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-ggAdminSecretId-Value",
ConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-connectionId-Value"
}
}
}
},
Dataflow = new List<Oci.DifService.Models.DataflowUpdateDetail>
{
new Oci.DifService.Models.DataflowUpdateDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
SparkVersion = "EXAMPLE-sparkVersion-Value",
DriverShape = "EXAMPLE-driverShape-Value",
ExecutorShape = "EXAMPLE-executorShape-Value",
DriverShapeConfig = new Oci.DifService.Models.ShapeConfig
{
MemoryInGBs = 903,
Ocpus = 400
},
ExecutorShapeConfig = new Oci.DifService.Models.ShapeConfig
{
MemoryInGBs = 995,
Ocpus = 504
},
NumExecutors = 146,
PrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateEndpointId-Value",
Connections = new Oci.DifService.Models.UpdateDataflowConnections
{
ConnectionDetails = new Oci.DifService.Models.DataflowConnectionDetails
{
DifDependencies = new List<Oci.DifService.Models.DifDependencyDetails>
{
new Oci.DifService.Models.DifDependencyDetails
{
ServiceType = "EXAMPLE-serviceType-Value",
ServiceInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-serviceInstanceId-Value"
}
},
DomainNames = new List<string>
{
"EXAMPLE--Value"
}
}
},
LogBucketInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logBucketInstanceId-Value",
WarehouseBucketInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-warehouseBucketInstanceId-Value"
}
},
Objectstorage = new List<Oci.DifService.Models.ObjectStorageUpdateDetail>
{
new Oci.DifService.Models.ObjectStorageUpdateDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
ObjectVersioning = Oci.DifService.Models.ObjectVersioning.Disabled,
AutoTiering = Oci.DifService.Models.AutoTiering.Disabled
}
},
Genai = new List<Oci.DifService.Models.GenAiUpdateDetail>
{
new Oci.DifService.Models.GenAiUpdateDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
UnitCount = 205,
Endpoints = new List<Oci.DifService.Models.EndpointDetails>
{
new Oci.DifService.Models.EndpointDetails
{
EndpointName = "EXAMPLE-endpointName-Value",
IsContentModerationEnabled = false
}
}
}
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_6FcOq",
"EXAMPLE_VALUE_iBNHnkjYEabRjjZStmvc"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_HIHLX",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_GhcBj",
"EXAMPLE--Value"
}
}
}
}
};
var updateStackRequest = new Oci.DifService.Requests.UpdateStackRequest
{
StackId = "ocid1.test.oc1..<unique_ID>EXAMPLE-stackId-Value",
UpdateStackDetails = updateStackDetails,
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRequestId = "BEZINX4RAMABXAVMSVP7<unique_ID>"
};
// 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.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new StackClient(provider, new ClientConfiguration()))
{
var response = await client.UpdateStack(updateStackRequest);
// Retrieve value from the response.
var versionValue = response.httpResponseMessage.Version;
}
}
catch (Exception e)
{
Console.WriteLine($"UpdateStack Failed with {e.Message}");
throw e;
}
}
}
}