// 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.AdmService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Adm
{
public class CreateRemediationRecipeExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createRemediationRecipeDetails = new Oci.AdmService.Models.CreateRemediationRecipeDetails
{
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
DisplayName = "EXAMPLE-displayName-Value",
ScmConfiguration = new Oci.AdmService.Models.ExternalScmConfiguration
{
ExternalScmType = Oci.AdmService.Models.ExternalScmConfiguration.ExternalScmTypeEnum.Github,
RepositoryUrl = "EXAMPLE-repositoryUrl-Value",
Username = "EXAMPLE-username-Value",
PatSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-patSecretId-Value",
Branch = "EXAMPLE-branch-Value",
BuildFileLocation = "EXAMPLE-buildFileLocation-Value",
IsAutomergeEnabled = false
},
VerifyConfiguration = new Oci.AdmService.Models.NoneVerifyConfiguration
{
},
DetectConfiguration = new Oci.AdmService.Models.DetectConfiguration
{
Exclusions = new List<string>
{
"EXAMPLE--Value"
},
UpgradePolicy = Oci.AdmService.Models.DetectConfiguration.UpgradePolicyEnum.Nearest,
MaxPermissibleCvssV2Score = (float)9.203714,
MaxPermissibleCvssV3Score = (float)0.25108218,
MaxPermissibleSeverity = Oci.AdmService.Models.ConfigSeverity.Medium
},
NetworkConfiguration = new Oci.AdmService.Models.NetworkConfiguration
{
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
NsgIds = new List<string>
{
"EXAMPLE--Value"
}
},
KnowledgeBaseId = "ocid1.test.oc1..<unique_ID>EXAMPLE-knowledgeBaseId-Value",
IsRunTriggeredOnKbChange = true,
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_UB6DA",
"EXAMPLE_VALUE_G1vl9WoR2GCIJLuKB1Dy"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_oy7DV",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_7TseU",
"EXAMPLE--Value"
}
}
}
}
};
var createRemediationRecipeRequest = new Oci.AdmService.Requests.CreateRemediationRecipeRequest
{
CreateRemediationRecipeDetails = createRemediationRecipeDetails,
OpcRequestId = "UUEHFSE12QQ0XWZBQ2YT<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 ApplicationDependencyManagementClient(provider, new ClientConfiguration()))
{
var response = await client.CreateRemediationRecipe(createRemediationRecipeRequest);
// Retrieve value from the response.
var versionValue = response.httpResponseMessage.Version;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateRemediationRecipe Failed with {e.Message}");
throw e;
}
}
}
}