// 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.LoganalyticsService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Loganalytics
{
    public class ValidateEndpointExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var logAnalyticsEndpoint = new Oci.LoganalyticsService.Models.LogListTypeEndpoint
			{
				ListEndpoint = new Oci.LoganalyticsService.Models.LogListEndpoint
				{
					Name = "EXAMPLE-name-Value",
					Description = "EXAMPLE-description-Value",
					Model = "EXAMPLE-model-Value",
					EndpointId = 38,
					Request = new Oci.LoganalyticsService.Models.EndpointRequest
					{
						Method = Oci.LoganalyticsService.Models.EndpointRequest.MethodEnum.Get,
						Url = "EXAMPLE-url-Value",
						ContentType = "EXAMPLE-contentType-Value",
						Payload = "EXAMPLE-payload-Value",
						Headers = new List<Oci.LoganalyticsService.Models.NameValuePair>
						{
							new Oci.LoganalyticsService.Models.NameValuePair
							{
								Name = "EXAMPLE-name-Value",
								Value = "EXAMPLE-value-Value"
							}
						},
						FormParameters = new List<Oci.LoganalyticsService.Models.NameValuePair>
						{
							new Oci.LoganalyticsService.Models.NameValuePair
							{
								Name = "EXAMPLE-name-Value",
								Value = "EXAMPLE-value-Value"
							}
						}
					},
					Response = new Oci.LoganalyticsService.Models.EndpointResponse
					{
						ContentType = "EXAMPLE-contentType-Value",
						Example = "EXAMPLE-example-Value"
					},
					Credentials = new Oci.LoganalyticsService.Models.EndpointCredentials
					{
						CredentialType = Oci.LoganalyticsService.Models.EndpointCredentials.CredentialTypeEnum.DynamicToken,
						CredentialName = "EXAMPLE-credentialName-Value",
						CredentialEndpoint = new Oci.LoganalyticsService.Models.CredentialEndpoint
						{
							Name = "EXAMPLE-name-Value",
							Description = "EXAMPLE-description-Value",
							Model = "EXAMPLE-model-Value",
							EndpointId = 880,
							Response = new Oci.LoganalyticsService.Models.EndpointResponse
							{
								ContentType = "EXAMPLE-contentType-Value",
								Example = "EXAMPLE-example-Value"
							},
							Proxy = new Oci.LoganalyticsService.Models.EndpointProxy
							{
								Url = "EXAMPLE-url-Value",
								CredentialName = "EXAMPLE-credentialName-Value",
								CredentialType = Oci.LoganalyticsService.Models.EndpointProxy.CredentialTypeEnum.BasicAuth
							}
						}
					},
					Proxy = new Oci.LoganalyticsService.Models.EndpointProxy
					{
						Url = "EXAMPLE-url-Value",
						CredentialName = "EXAMPLE-credentialName-Value",
						CredentialType = Oci.LoganalyticsService.Models.EndpointProxy.CredentialTypeEnum.Token
					},
					IsEnabled = false,
					IsSystem = true,
					EndpointProperties = new List<Oci.LoganalyticsService.Models.LogAnalyticsProperty>
					{
						new Oci.LoganalyticsService.Models.LogAnalyticsProperty
						{
							Name = "EXAMPLE-name-Value",
							Value = "EXAMPLE-value-Value"
						}
					}
				},
				LogEndpoints = new List<Oci.LoganalyticsService.Models.LogEndpoint>
				{
					new Oci.LoganalyticsService.Models.LogEndpoint
					{
						Name = "EXAMPLE-name-Value",
						Description = "EXAMPLE-description-Value",
						Model = "EXAMPLE-model-Value",
						EndpointId = 970,
						Request = new Oci.LoganalyticsService.Models.EndpointRequest
						{
							Method = Oci.LoganalyticsService.Models.EndpointRequest.MethodEnum.Post,
							Url = "EXAMPLE-url-Value",
							ContentType = "EXAMPLE-contentType-Value",
							Payload = "EXAMPLE-payload-Value",
							Headers = new List<Oci.LoganalyticsService.Models.NameValuePair>
							{
								new Oci.LoganalyticsService.Models.NameValuePair
								{
									Name = "EXAMPLE-name-Value",
									Value = "EXAMPLE-value-Value"
								}
							},
							FormParameters = new List<Oci.LoganalyticsService.Models.NameValuePair>
							{
								new Oci.LoganalyticsService.Models.NameValuePair
								{
									Name = "EXAMPLE-name-Value",
									Value = "EXAMPLE-value-Value"
								}
							}
						},
						Response = new Oci.LoganalyticsService.Models.EndpointResponse
						{
							ContentType = "EXAMPLE-contentType-Value",
							Example = "EXAMPLE-example-Value"
						},
						Credentials = new Oci.LoganalyticsService.Models.EndpointCredentials
						{
							CredentialType = Oci.LoganalyticsService.Models.EndpointCredentials.CredentialTypeEnum.BasicAuth,
							CredentialName = "EXAMPLE-credentialName-Value",
							CredentialEndpoint = new Oci.LoganalyticsService.Models.CredentialEndpoint
							{
								Name = "EXAMPLE-name-Value",
								Description = "EXAMPLE-description-Value",
								Model = "EXAMPLE-model-Value",
								EndpointId = 636,
								Response = new Oci.LoganalyticsService.Models.EndpointResponse
								{
									ContentType = "EXAMPLE-contentType-Value",
									Example = "EXAMPLE-example-Value"
								},
								Proxy = new Oci.LoganalyticsService.Models.EndpointProxy
								{
									Url = "EXAMPLE-url-Value",
									CredentialName = "EXAMPLE-credentialName-Value",
									CredentialType = Oci.LoganalyticsService.Models.EndpointProxy.CredentialTypeEnum.Token
								}
							}
						},
						Proxy = new Oci.LoganalyticsService.Models.EndpointProxy
						{
							Url = "EXAMPLE-url-Value",
							CredentialName = "EXAMPLE-credentialName-Value",
							CredentialType = Oci.LoganalyticsService.Models.EndpointProxy.CredentialTypeEnum.None
						},
						IsEnabled = true,
						IsSystem = false,
						EndpointProperties = new List<Oci.LoganalyticsService.Models.LogAnalyticsProperty>
						{
							new Oci.LoganalyticsService.Models.LogAnalyticsProperty
							{
								Name = "EXAMPLE-name-Value",
								Value = "EXAMPLE-value-Value"
							}
						}
					}
				}
			};
			var validateEndpointRequest = new Oci.LoganalyticsService.Requests.ValidateEndpointRequest
			{
				NamespaceName = "EXAMPLE-namespaceName-Value",
				ValidateEndpointDetails = logAnalyticsEndpoint,
				OpcRequestId = "T5K7KMFU7CKY5E8N4O2L<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 LogAnalyticsClient(provider, new ClientConfiguration()))
				{
					var response = await client.ValidateEndpoint(validateEndpointRequest);
					// Retrieve value from the response.
					var statusValue = response.ValidateEndpointResult.Status;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"ValidateEndpoint Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?