# 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
fleet_apps_management_client = oci.fleet_apps_management.FleetAppsManagementClient(
    config)


# Send the request to service, some parameters are not required, see API
# doc for more info
update_fleet_response = fleet_apps_management_client.update_fleet(
    fleet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-fleetId-Value",
    update_fleet_details=oci.fleet_apps_management.models.UpdateFleetDetails(
        display_name="EXAMPLE-displayName-Value",
        description="EXAMPLE-description-Value",
        notification_preferences=[
            oci.fleet_apps_management.models.NotificationPreference(
                topic_id="ocid1.test.oc1..<unique_ID>EXAMPLE-topicId-Value",
                compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
                preferences=oci.fleet_apps_management.models.Preferences(
                    upcoming_schedule=oci.fleet_apps_management.models.UpcomingSchedule(
                        on_upcoming_schedule=False,
                        notify_before="EXAMPLE-notifyBefore-Value"),
                    on_job_failure=True,
                    on_topology_modification=False,
                    on_task_pause=True,
                    on_task_failure=True,
                    on_task_success=True,
                    on_resource_non_compliance=True,
                    on_runbook_newer_version=False))],
        is_target_auto_confirm=True,
        resource_selection=oci.fleet_apps_management.models.DynamicResourceSelection(
            resource_selection_type="DYNAMIC",
            rule_selection_criteria=oci.fleet_apps_management.models.SelectionCriteria(
                match_condition="ANY",
                rules=[
                                    oci.fleet_apps_management.models.Rule(
                                        compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
                                        resource_compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-resourceCompartmentId-Value",
                                        conditions=[
                                            oci.fleet_apps_management.models.Condition(
                                                attr_group="EXAMPLE-attrGroup-Value",
                                                attr_key="EXAMPLE-attrKey-Value",
                                                attr_value="EXAMPLE-attrValue-Value")],
                                        basis="EXAMPLE-basis-Value")])),
        products=["EXAMPLE--Value"],
        freeform_tags={
            'EXAMPLE_KEY_BE0xq': 'EXAMPLE_VALUE_pZilWANk7tia9ERMLRsH'},
        defined_tags={
            'EXAMPLE_KEY_GFaHO': {
                'EXAMPLE_KEY_sGzU3': 'EXAMPLE--Value'}}),
    if_match="EXAMPLE-ifMatch-Value",
    opc_request_id="YBMOGIZMOJAW8CUUUXNU<unique_ID>")

# Get the data from response
print(update_fleet_response.data)

Was this article helpful?