# 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
devops_client = oci.devops.DevopsClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
create_deploy_stage_response = devops_client.create_deploy_stage(
    create_deploy_stage_details=oci.devops.models.CreateComputeInstanceGroupDeployStageDetails(
        deploy_stage_type="COMPUTE_INSTANCE_GROUP_ROLLING_DEPLOYMENT",
        deploy_pipeline_id="ocid1.test.oc1..<unique_ID>EXAMPLE-deployPipelineId-Value",
        deploy_stage_predecessor_collection=oci.devops.models.DeployStagePredecessorCollection(
            items=[
                oci.devops.models.DeployStagePredecessor(
                    id="ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")]),
        compute_instance_group_deploy_environment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-computeInstanceGroupDeployEnvironmentId-Value",
        deployment_spec_deploy_artifact_id="ocid1.test.oc1..<unique_ID>EXAMPLE-deploymentSpecDeployArtifactId-Value",
        rollout_policy=oci.devops.models.ComputeInstanceGroupLinearRolloutPolicyByPercentage(
            policy_type="COMPUTE_INSTANCE_GROUP_LINEAR_ROLLOUT_POLICY_BY_PERCENTAGE",
            batch_percentage=747,
            batch_delay_in_seconds=1876),
        description="EXAMPLE-description-Value",
        display_name="EXAMPLE-displayName-Value",
        freeform_tags={
            'EXAMPLE_KEY_eUgd2': 'EXAMPLE_VALUE_BIfFAiAzxnVAQbsF5Wa3'},
        defined_tags={
            'EXAMPLE_KEY_hzfR3': {
                'EXAMPLE_KEY_Hiok4': 'EXAMPLE--Value'}},
        deploy_artifact_ids=["EXAMPLE--Value"],
        rollback_policy=oci.devops.models.AutomatedDeployStageRollbackPolicy(
            policy_type="AUTOMATED_STAGE_ROLLBACK_POLICY"),
        failure_policy=oci.devops.models.ComputeInstanceGroupFailurePolicyByCount(
            policy_type="COMPUTE_INSTANCE_GROUP_FAILURE_POLICY_BY_COUNT",
            failure_count=944),
        load_balancer_config=oci.devops.models.LoadBalancerConfig(
            load_balancer_id="ocid1.test.oc1..<unique_ID>EXAMPLE-loadBalancerId-Value",
            listener_name="EXAMPLE-listenerName-Value",
            backend_port=42778)),
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    opc_request_id="0JQCW5PT9PM36ORMNOK0<unique_ID>")

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