// 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.RoverService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Rover
{
public class CreateRoverNodeExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createRoverNodeDetails = new Oci.RoverService.Models.CreateRoverNodeDetails
{
DisplayName = "EXAMPLE-displayName-Value",
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
Shape = "EXAMPLE-shape-Value",
CustomerShippingAddress = new Oci.RoverService.Models.ShippingAddress
{
Addressee = "EXAMPLE-addressee-Value",
CareOf = "EXAMPLE-careOf-Value",
Address1 = "EXAMPLE-address1-Value",
Address2 = "EXAMPLE-address2-Value",
Address3 = "EXAMPLE-address3-Value",
Address4 = "EXAMPLE-address4-Value",
CityOrLocality = "EXAMPLE-cityOrLocality-Value",
StateOrRegion = "EXAMPLE-stateOrRegion-Value",
Zipcode = "EXAMPLE-zipcode-Value",
Country = "EXAMPLE-country-Value",
PhoneNumber = "EXAMPLE-phoneNumber-Value",
Email = "EXAMPLE-email-Value"
},
NodeWorkloads = new List<Oci.RoverService.Models.RoverWorkload>
{
new Oci.RoverService.Models.RoverWorkload
{
Name = "EXAMPLE-name-Value",
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
Size = "EXAMPLE-size-Value",
ObjectCount = "EXAMPLE-objectCount-Value",
Prefix = "EXAMPLE-prefix-Value",
RangeStart = "EXAMPLE-rangeStart-Value",
RangeEnd = "EXAMPLE-rangeEnd-Value",
WorkloadType = "EXAMPLE-workloadType-Value",
WorkRequestId = "ocid1.test.oc1..<unique_ID>EXAMPLE-workRequestId-Value"
}
},
SuperUserPassword = "EXAMPLE-superUserPassword-Value",
UnlockPassphrase = "EXAMPLE-unlockPassphrase-Value",
PointOfContact = "EXAMPLE-pointOfContact-Value",
PointOfContactPhoneNumber = "EXAMPLE-pointOfContactPhoneNumber-Value",
ShippingPreference = Oci.RoverService.Models.CreateRoverNodeDetails.ShippingPreferenceEnum.CustomerPickup,
ShippingVendor = "EXAMPLE-shippingVendor-Value",
TimePickupExpected = DateTime.Parse("09/01/2027 12:05:56"),
PublicKey = "EXAMPLE-publicKey-Value",
TimeReturnWindowStarts = DateTime.Parse("03/30/2028 04:28:22"),
TimeReturnWindowEnds = DateTime.Parse("02/22/2005 16:13:32"),
LifecycleState = Oci.RoverService.Models.LifecycleState.Deleting,
EnclosureType = Oci.RoverService.Models.EnclosureType.Ruggadized,
LifecycleStateDetails = "EXAMPLE-lifecycleStateDetails-Value",
SerialNumber = "EXAMPLE-serialNumber-Value",
OracleShippingTrackingUrl = "EXAMPLE-oracleShippingTrackingUrl-Value",
IsImportRequested = true,
ImportCompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-importCompartmentId-Value",
ImportFileBucket = "EXAMPLE-importFileBucket-Value",
DataValidationCode = "EXAMPLE-dataValidationCode-Value",
MasterKeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-masterKeyId-Value",
CertificateAuthorityId = "ocid1.test.oc1..<unique_ID>EXAMPLE-certificateAuthorityId-Value",
TimeCertValidityEnd = DateTime.Parse("06/20/2035 22:24:30"),
CommonName = "EXAMPLE-commonName-Value",
CertCompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-certCompartmentId-Value",
CertKeyAlgorithm = Oci.RoverService.Models.CertKeyAlgorithm.Rsa2048,
CertSignatureAlgorithm = Oci.RoverService.Models.CertSignatureAlgorithm.Sha384WithRsa,
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_pK5oU",
"EXAMPLE_VALUE_r9VjukNogJ46xWGjtuFN"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_ec1du",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_NgUBv",
"EXAMPLE--Value"
}
}
}
},
SystemTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_4RRDK",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_MDclj",
"EXAMPLE--Value"
}
}
}
}
};
var createRoverNodeRequest = new Oci.RoverService.Requests.CreateRoverNodeRequest
{
CreateRoverNodeDetails = createRoverNodeDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "BYEHMB6U1UCJFORMIEGX<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 RoverNodeClient(provider, new ClientConfiguration()))
{
var response = await client.CreateRoverNode(createRoverNodeRequest);
// Retrieve value from the response.
var id = response.RoverNode.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateRoverNode Failed with {e.Message}");
throw e;
}
}
}
}