# 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).
import oci
# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()
# Initialize service client with default config file
stack_monitoring_client = oci.stack_monitoring.StackMonitoringClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_monitored_resource_response = stack_monitoring_client.create_monitored_resource(
create_monitored_resource_details=oci.stack_monitoring.models.CreateMonitoredResourceDetails(
name="EXAMPLE-name-Value",
type="EXAMPLE-type-Value",
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
display_name="EXAMPLE-displayName-Value",
host_name="EXAMPLE-hostName-Value",
external_id="ocid1.test.oc1..<unique_ID>EXAMPLE-externalId-Value",
management_agent_id="ocid1.test.oc1..<unique_ID>EXAMPLE-managementAgentId-Value",
resource_time_zone="EXAMPLE-resourceTimeZone-Value",
license="STANDARD_EDITION",
properties=[
oci.stack_monitoring.models.MonitoredResourceProperty(
name="EXAMPLE-name-Value",
value="EXAMPLE-value-Value")],
database_connection_details=oci.stack_monitoring.models.ConnectionDetails(
protocol="TCP",
port=17797,
service_name="EXAMPLE-serviceName-Value",
connector_id="ocid1.test.oc1..<unique_ID>EXAMPLE-connectorId-Value",
db_unique_name="EXAMPLE-dbUniqueName-Value",
db_id="ocid1.test.oc1..<unique_ID>EXAMPLE-dbId-Value",
ssl_secret_id="ocid1.test.oc1..<unique_ID>EXAMPLE-sslSecretId-Value"),
credentials=oci.stack_monitoring.models.PreExistingCredentials(
credential_type="EXISTING",
source="EXAMPLE-source-Value",
name="EXAMPLE-name-Value",
type="EXAMPLE-type-Value",
description="EXAMPLE-description-Value"),
aliases=oci.stack_monitoring.models.MonitoredResourceAliasCredential(
source="EXAMPLE-source-Value",
name="EXAMPLE-name-Value",
credential=oci.stack_monitoring.models.MonitoredResourceAliasSourceCredential(
source="EXAMPLE-source-Value",
name="EXAMPLE-name-Value",
service="EXAMPLE-service-Value")),
additional_credentials=[
oci.stack_monitoring.models.PlainTextCredentials(
credential_type="PLAINTEXT",
properties=[
oci.stack_monitoring.models.CredentialProperty(
name="EXAMPLE-name-Value",
value="EXAMPLE-value-Value")],
source="EXAMPLE-source-Value",
name="EXAMPLE-name-Value",
type="EXAMPLE-type-Value",
description="EXAMPLE-description-Value")],
additional_aliases=[
oci.stack_monitoring.models.MonitoredResourceAliasCredential(
source="EXAMPLE-source-Value",
name="EXAMPLE-name-Value",
credential=oci.stack_monitoring.models.MonitoredResourceAliasSourceCredential(
source="EXAMPLE-source-Value",
name="EXAMPLE-name-Value",
service="EXAMPLE-service-Value"))],
freeform_tags={
'EXAMPLE_KEY_ZHPNo': 'EXAMPLE_VALUE_3v9S7i2FYFiENOGHSJWz'},
defined_tags={
'EXAMPLE_KEY_snUeI': {
'EXAMPLE_KEY_FnDWE': 'EXAMPLE--Value'}}),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="9HHFCWY2HW03FONESEMC<unique_ID>",
external_resource_id="ocid1.test.oc1..<unique_ID>EXAMPLE-externalResourceId-Value")
# Get the data from response
print(create_monitored_resource_response.data)