# 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_build_pipeline_stage_response = devops_client.create_build_pipeline_stage(
    create_build_pipeline_stage_details=oci.devops.models.CreateBuildStageDetails(
        build_pipeline_stage_type="BUILD",
        build_pipeline_id="ocid1.test.oc1..<unique_ID>EXAMPLE-buildPipelineId-Value",
        build_pipeline_stage_predecessor_collection=oci.devops.models.BuildPipelineStagePredecessorCollection(
            items=[
                oci.devops.models.BuildPipelineStagePredecessor(
                    id="ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")]),
        image="OL7_X86_64_STANDARD_10",
        build_source_collection=oci.devops.models.BuildSourceCollection(
            items=[
                oci.devops.models.BitbucketServerBuildSource(
                    connection_type="BITBUCKET_SERVER",
                    name="EXAMPLE-name-Value",
                    repository_url="EXAMPLE-repositoryUrl-Value",
                    branch="EXAMPLE-branch-Value",
                    connection_id="ocid1.test.oc1..<unique_ID>EXAMPLE-connectionId-Value")]),
        display_name="EXAMPLE-displayName-Value",
        description="EXAMPLE-description-Value",
        freeform_tags={
            'EXAMPLE_KEY_ZzbB9': 'EXAMPLE_VALUE_l8QDVOk0HUCUmAXxjI80'},
        defined_tags={
            'EXAMPLE_KEY_1XBvQ': {
                'EXAMPLE_KEY_lJFim': 'EXAMPLE--Value'}},
        build_spec_file="EXAMPLE-buildSpecFile-Value",
        stage_execution_timeout_in_seconds=402,
        primary_build_source="EXAMPLE-primaryBuildSource-Value",
        build_runner_shape_config=oci.devops.models.DefaultBuildRunnerShapeConfig(
            build_runner_type="DEFAULT"),
        private_access_config=oci.devops.models.ServiceVnicChannel(
            network_channel_type="SERVICE_VNIC_CHANNEL",
            subnet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
            nsg_ids=["EXAMPLE--Value"])),
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    opc_request_id="AWABOXIJUOFBTWCU4END<unique_ID>")

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