// 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).

package main

import (
	"context"
	"fmt"
	"time"

	"github.com/oracle/oci-go-sdk/v65/apmsynthetics"
	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleCreateMonitor() {
	// 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.
	client, err := apmsynthetics.NewApmSyntheticClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := apmsynthetics.CreateMonitorRequest{ApmDomainId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-apmDomainId-Value"),
		CreateMonitorDetails: apmsynthetics.CreateMonitorDetails{SchedulingPolicy: apmsynthetics.SchedulingPolicyBatchedRoundRobin,
			AvailabilityConfiguration: &apmsynthetics.AvailabilityConfiguration{MaxAllowedFailuresPerInterval: common.Int(30),
				MinAllowedRunsPerInterval: common.Int(402)},
			DisplayName:             common.String("EXAMPLE-displayName-Value"),
			IsIPv6:                  common.Bool(false),
			IsRunOnce:               common.Bool(true),
			RepeatIntervalInSeconds: common.Int(585),
			ScriptParameters: []apmsynthetics.MonitorScriptParameter{apmsynthetics.MonitorScriptParameter{ParamValue: common.String("EXAMPLE-paramValue-Value"),
				ParamName: common.String("EXAMPLE-paramName-Value")}},
			BatchIntervalInSeconds: common.Int(733),
			DefinedTags:            map[string]map[string]interface{}{"EXAMPLE_KEY_XQyWe": map[string]interface{}{"EXAMPLE_KEY_G5Jw0": "EXAMPLE--Value"}},
			Target:                 common.String("EXAMPLE-target-Value"),
			VantagePoints:          []string{"EXAMPLE--Value"},
			Configuration: apmsynthetics.SqlMonitorConfiguration{ConnectionString: common.String("EXAMPLE-connectionString-Value"),
				DatabaseRole: common.String("EXAMPLE-databaseRole-Value"),
				DatabaseType: apmsynthetics.DatabaseTypeOracle,
				DatabaseWalletDetails: &apmsynthetics.DatabaseWalletDetails{DatabaseWallet: common.String("EXAMPLE-databaseWallet-Value"),
					ServiceName: common.String("EXAMPLE-serviceName-Value")},
				DnsConfiguration: &apmsynthetics.DnsConfiguration{IsOverrideDns: common.Bool(false),
					OverrideDnsIp: common.String("EXAMPLE-overrideDnsIp-Value")},
				Query: common.String("EXAMPLE-query-Value"),
				DatabaseAuthenticationDetails: &apmsynthetics.BasicAuthenticationDetails{Username: common.String("EXAMPLE-username-Value"),
					Password: apmsynthetics.PasswordInText{Password: common.String("EXAMPLE-password-Value")}},
				DatabaseConnectionType: apmsynthetics.DatabaseConnectionTypeCloudWallet,
				IsFailureRetried:       common.Bool(true)},
			FreeformTags:     map[string]string{"EXAMPLE_KEY_E0j7n": "EXAMPLE_VALUE_HZJwZm5JW44F7NrIPopS"},
			ScriptId:         common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-scriptId-Value"),
			Status:           apmsynthetics.MonitorStatusInvalid,
			TimeoutInSeconds: common.Int(395),
			IsRunNow:         common.Bool(true),
			MaintenanceWindowSchedule: &apmsynthetics.MaintenanceWindowSchedule{TimeEnded: &common.SDKTime{Time: time.Now()},
				TimeStarted: &common.SDKTime{Time: time.Now()}},
			MonitorType: apmsynthetics.MonitorTypesScriptedBrowser},
		OpcRequestId:  common.String("WUMZGYD72M3UEB7VPTZU<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}

	// Send the request using the service client
	resp, err := client.CreateMonitor(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}