// 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.CapacitymanagementService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Capacitymanagement
{
public class CreateOccmDemandSignalItemExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createOccmDemandSignalItemDetails = new Oci.CapacitymanagementService.Models.CreateOccmDemandSignalItemDetails
{
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
DemandSignalId = "ocid1.test.oc1..<unique_ID>EXAMPLE-demandSignalId-Value",
DemandSignalCatalogResourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-demandSignalCatalogResourceId-Value",
RequestType = Oci.CapacitymanagementService.Models.OccmDemandSignalItemRequestType.Demand,
Region = "EXAMPLE-region-Value",
AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
TargetCompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-targetCompartmentId-Value",
DemandQuantity = 580,
TimeNeededBefore = DateTime.Parse("10/29/2009 00:07:48"),
ResourceProperties = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_opiG2",
"EXAMPLE_VALUE_HZM9jWKviI2qiqmkyqUG"
}
},
Notes = "EXAMPLE-notes-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_utPQ5",
"EXAMPLE_VALUE_06LZf5r5ji0JuKgqXbKX"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_VQ3U6",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_BmSYV",
"EXAMPLE--Value"
}
}
}
}
};
var createOccmDemandSignalItemRequest = new Oci.CapacitymanagementService.Requests.CreateOccmDemandSignalItemRequest
{
CreateOccmDemandSignalItemDetails = createOccmDemandSignalItemDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "YSRHETNRSX154Q2UUS4Y<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 DemandSignalClient(provider, new ClientConfiguration()))
{
var response = await client.CreateOccmDemandSignalItem(createOccmDemandSignalItemRequest);
// Retrieve value from the response.
var hasValueValue = response.RetryAfter.HasValue;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateOccmDemandSignalItem Failed with {e.Message}");
throw e;
}
}
}
}