// 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.OsmanagementhubService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Osmanagementhub
{
public class UpdateDynamicSetExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var updateDynamicSetDetails = new Oci.OsmanagementhubService.Models.UpdateDynamicSetDetails
{
DisplayName = "EXAMPLE-displayName-Value",
Description = "EXAMPLE-description-Value",
TargetCompartments = new List<Oci.OsmanagementhubService.Models.TargetCompartmentDetails>
{
new Oci.OsmanagementhubService.Models.TargetCompartmentDetails
{
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
DoesIncludeChildren = true
}
},
MatchType = Oci.OsmanagementhubService.Models.MatchType.Any,
MatchingRule = new Oci.OsmanagementhubService.Models.MatchingRule
{
Tags = new List<Oci.OsmanagementhubService.Models.Tag>
{
new Oci.OsmanagementhubService.Models.DefinedTag
{
Namespace = "EXAMPLE-namespace-Value",
Key = "EXAMPLE-key-Value",
Value = "EXAMPLE-value-Value"
}
},
ManagedInstanceIds = new List<string>
{
"EXAMPLE--Value"
},
ManagedInstanceGroupIds = new List<string>
{
"EXAMPLE--Value"
},
DisplayNames = new List<string>
{
"EXAMPLE--Value"
},
OsNames = new List<Oci.OsmanagementhubService.Models.OsName>
{
Oci.OsmanagementhubService.Models.OsName.OracleLinux
},
Architectures = new List<Oci.OsmanagementhubService.Models.CpuArchType>
{
Oci.OsmanagementhubService.Models.CpuArchType.Aarch64
},
OsFamilies = new List<Oci.OsmanagementhubService.Models.OsFamily>
{
Oci.OsmanagementhubService.Models.OsFamily.Ubuntu2004
},
Statuses = new List<Oci.OsmanagementhubService.Models.ManagedInstanceStatus>
{
Oci.OsmanagementhubService.Models.ManagedInstanceStatus.Error
},
Locations = new List<Oci.OsmanagementhubService.Models.ManagedInstanceLocation>
{
Oci.OsmanagementhubService.Models.ManagedInstanceLocation.OnPremise
},
IsRebootRequired = false
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_G2nQj",
"EXAMPLE_VALUE_Rxg8i5XTrNdtcWF3pOua"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_jcSV7",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_s1PFT",
"EXAMPLE--Value"
}
}
}
}
};
var updateDynamicSetRequest = new Oci.OsmanagementhubService.Requests.UpdateDynamicSetRequest
{
DynamicSetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dynamicSetId-Value",
UpdateDynamicSetDetails = updateDynamicSetDetails,
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRequestId = "KEDQVTRGWOU6SMSS0YBZ<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 DynamicSetClient(provider, new ClientConfiguration()))
{
var response = await client.UpdateDynamicSet(updateDynamicSetRequest);
// Retrieve value from the response.
var id = response.DynamicSet.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"UpdateDynamicSet Failed with {e.Message}");
throw e;
}
}
}
}