// 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.FleetappsmanagementService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Fleetappsmanagement
{
public class UpdateTaskRecordExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var updateTaskRecordDetails = new Oci.FleetappsmanagementService.Models.UpdateTaskRecordDetails
{
DisplayName = "EXAMPLE-displayName-Value",
Description = "EXAMPLE-description-Value",
Details = new Oci.FleetappsmanagementService.Models.Details
{
ExecutionDetails = new Oci.FleetappsmanagementService.Models.ScriptBasedExecutionDetails
{
Variables = new Oci.FleetappsmanagementService.Models.TaskVariable
{
InputVariables = new List<Oci.FleetappsmanagementService.Models.InputArgument>
{
new Oci.FleetappsmanagementService.Models.FileInputArgument
{
Name = "EXAMPLE-name-Value",
Description = "EXAMPLE-description-Value"
}
},
OutputVariables = new List<string>
{
"EXAMPLE--Value"
}
},
Content = new Oci.FleetappsmanagementService.Models.ObjectStorageBucketContentDetails
{
NamespaceName = "EXAMPLE-namespaceName-Value",
BucketName = "EXAMPLE-bucketName-Value",
ObjectName = "EXAMPLE-objectName-Value",
Checksum = "EXAMPLE-checksum-Value"
},
Command = "EXAMPLE-command-Value",
Credentials = new List<Oci.FleetappsmanagementService.Models.ConfigAssociationDetails>
{
new Oci.FleetappsmanagementService.Models.ConfigAssociationDetails
{
Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
DisplayName = "EXAMPLE-displayName-Value"
}
},
IsLocked = false,
IsExecutableContent = true
},
Platform = "EXAMPLE-platform-Value",
OsType = Oci.FleetappsmanagementService.Models.OsType.Windows,
Scope = Oci.FleetappsmanagementService.Models.TaskScope.Shared,
Properties = new Oci.FleetappsmanagementService.Models.Properties
{
NumRetries = 495,
TimeoutInSeconds = 277
},
IsDiscoveryOutputTask = true,
IsApplySubjectTask = true,
Operation = "EXAMPLE-operation-Value"
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_01kk7",
"EXAMPLE_VALUE_8C45Z1Nt1nmkynroZdKg"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_2lfRy",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_mGsQC",
"EXAMPLE--Value"
}
}
}
}
};
var updateTaskRecordRequest = new Oci.FleetappsmanagementService.Requests.UpdateTaskRecordRequest
{
TaskRecordId = "ocid1.test.oc1..<unique_ID>EXAMPLE-taskRecordId-Value",
UpdateTaskRecordDetails = updateTaskRecordDetails,
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRequestId = "WZH4HAXYBX8EWLX4MUL9<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 FleetAppsManagementRunbooksClient(provider, new ClientConfiguration()))
{
var response = await client.UpdateTaskRecord(updateTaskRecordRequest);
// Retrieve value from the response.
var versionValue = response.httpResponseMessage.Version;
}
}
catch (Exception e)
{
Console.WriteLine($"UpdateTaskRecord Failed with {e.Message}");
throw e;
}
}
}
}