// 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 DeployArtifactsExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var deployArtifactsDetails = new Oci.DifService.Models.DeployArtifactsDetails
			{
				StackTemplates = new List<Oci.DifService.Models.StackTemplate>
				{
					Oci.DifService.Models.StackTemplate.Datapipeline
				},
				Services = new List<Oci.DifService.Models.Service>
				{
					Oci.DifService.Models.Service.Ggcs
				},
				SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
				Adb = new List<Oci.DifService.Models.AdbArtifactsDetail>
				{
					new Oci.DifService.Models.AdbArtifactsDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						ArtifactObjectStoragePath = "EXAMPLE-artifactObjectStoragePath-Value",
						DbCredentials = new List<Oci.DifService.Models.DbCredentialsDetail>
						{
							new Oci.DifService.Models.DbCredentialsDetail
							{
								UserName = "EXAMPLE-userName-Value",
								SecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value",
								UserType = "EXAMPLE-userType-Value"
							}
						}
					}
				},
				Ggcs = new List<Oci.DifService.Models.GgcsArtifactsDetail>
				{
					new Oci.DifService.Models.GgcsArtifactsDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						ArtifactObjectStoragePath = "EXAMPLE-artifactObjectStoragePath-Value",
						Users = new List<Oci.DifService.Models.GgcsUserDetail>
						{
							new Oci.DifService.Models.GgcsUserDetail
							{
								UserName = "EXAMPLE-userName-Value",
								SecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value",
								UserType = "EXAMPLE-userType-Value",
								Action = Oci.DifService.Models.WorkflowAction.Update
							}
						},
						Sources = new List<Oci.DifService.Models.GgcsSourceDetail>
						{
							new Oci.DifService.Models.GgcsSourceDetail
							{
								SourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceId-Value",
								Action = Oci.DifService.Models.WorkflowAction.Update,
								ShouldStartSourceOperations = false,
								TargetUri = "EXAMPLE-targetUri-Value",
								TargetConnectionName = "EXAMPLE-targetConnectionName-Value"
							}
						},
						Targets = new List<Oci.DifService.Models.GgcsTargetDetail>
						{
							new Oci.DifService.Models.GgcsTargetDetail
							{
								TargetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-targetId-Value",
								Action = Oci.DifService.Models.WorkflowAction.Update,
								ShouldStartTargetOperations = true,
								SourceUri = "EXAMPLE-sourceUri-Value",
								SourceConnectionName = "EXAMPLE-sourceConnectionName-Value"
							}
						}
					}
				},
				Dataflow = new List<Oci.DifService.Models.DataflowArtifactsDetail>
				{
					new Oci.DifService.Models.DataflowArtifactsDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						Execute = "EXAMPLE-execute-Value",
						ArchiveUri = "EXAMPLE-archiveUri-Value"
					}
				},
				Omk = new List<Oci.DifService.Models.OmkArtifactsDetail>
				{
					new Oci.DifService.Models.OmkArtifactsDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						Secrets = new List<Oci.DifService.Models.SecretDetail>
						{
							new Oci.DifService.Models.SecretDetail
							{
								SecretName = "EXAMPLE-secretName-Value",
								TemplateObjectStoragePath = "EXAMPLE-templateObjectStoragePath-Value",
								SecretData = new List<Oci.DifService.Models.SecretData>
								{
									new Oci.DifService.Models.SecretData
									{
										Key = "EXAMPLE-key-Value",
										SecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"
									}
								}
							}
						},
						ManifestObjectStoragePath = "EXAMPLE-manifestObjectStoragePath-Value",
						ComponentValueOverrides = new List<Oci.DifService.Models.ComponentValueOverride>
						{
							new Oci.DifService.Models.ComponentValueOverride
							{
								ComponentName = "EXAMPLE-componentName-Value",
								ValueOverrides = new Dictionary<string, string>()
								{
									{
										"EXAMPLE_KEY_vZ1NS", 
										"EXAMPLE_VALUE_TPenpkxbzoSHwR73zgl5"
									}
								}
							}
						}
					}
				},
				Oke = new List<Oci.DifService.Models.OkeArtifactsDetail>
				{
					new Oci.DifService.Models.OkeArtifactsDetail
					{
						InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
						Secrets = new List<Oci.DifService.Models.SecretDetail>
						{
							new Oci.DifService.Models.SecretDetail
							{
								SecretName = "EXAMPLE-secretName-Value",
								TemplateObjectStoragePath = "EXAMPLE-templateObjectStoragePath-Value",
								SecretData = new List<Oci.DifService.Models.SecretData>
								{
									new Oci.DifService.Models.SecretData
									{
										Key = "EXAMPLE-key-Value",
										SecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"
									}
								}
							}
						},
						ManifestObjectStoragePath = "EXAMPLE-manifestObjectStoragePath-Value",
						ComponentValueOverrides = new List<Oci.DifService.Models.ComponentValueOverride>
						{
							new Oci.DifService.Models.ComponentValueOverride
							{
								ComponentName = "EXAMPLE-componentName-Value",
								ValueOverrides = new Dictionary<string, string>()
								{
									{
										"EXAMPLE_KEY_ols63", 
										"EXAMPLE_VALUE_rf3cwuS2sAcjb8PttiJa"
									}
								}
							}
						}
					}
				}
			};
			var deployArtifactsRequest = new Oci.DifService.Requests.DeployArtifactsRequest
			{
				StackId = "ocid1.test.oc1..<unique_ID>EXAMPLE-stackId-Value",
				DeployArtifactsDetails = deployArtifactsDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "KJO5GRA3TGTFUKJFVA7X<unique_ID>",
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value"
			};

            // 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.DeployArtifacts(deployArtifactsRequest);
					// Retrieve value from the response.
					var versionValue = response.httpResponseMessage.Version;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"DeployArtifacts Failed with {e.Message}");
                throw e;
            }
        }

    }
}