Skip to content

create_environment

create_environment(
    name: EntityName,
    instance_type: String20,
    engine_type: EngineType,
    *,
    config_overrides: Optional[m2ClientConfig] = None,
    description: Optional[EntityDescription] = None,
    engine_version: Optional[EngineVersion] = None,
    subnet_ids: Optional[String50List] = None,
    security_group_ids: Optional[String50List] = None,
    storage_configurations: Optional[StorageConfigurationList] = None,
    publicly_accessible: Optional[Boolean] = None,
    high_availability_config: Optional[HighAvailabilityConfig] = None,
    tags: Optional[TagMap] = None,
    preferred_maintenance_window: Optional[String50] = None,
    network_type: Optional[NetworkType] = None,
    client_token: Optional[ClientToken] = None,
    kms_key_id: Optional[str] = None,
) -> CreateEnvironmentResponse

Creates a runtime environment for a given runtime engine.

Parameters:

  • name (EntityName) –

    The name of the runtime environment. Must be unique within the account.

  • instance_type (String20) –

    The type of instance for the runtime environment.

  • description (Optional[EntityDescription], default: None ) –

    The description of the runtime environment.

  • engine_type (EngineType) –

    The engine type for the runtime environment.

  • engine_version (Optional[EngineVersion], default: None ) –

    The version of the engine type for the runtime environment.

  • subnet_ids (Optional[String50List], default: None ) –

    The list of subnets associated with the VPC for this runtime environment.

  • security_group_ids (Optional[String50List], default: None ) –

    The list of security groups for the VPC associated with this runtime environment.

  • storage_configurations (Optional[StorageConfigurationList], default: None ) –

    Optional. The storage configurations for this runtime environment.

  • publicly_accessible (Optional[Boolean], default: None ) –

    Specifies whether the runtime environment is publicly accessible.

  • high_availability_config (Optional[HighAvailabilityConfig], default: None ) –

    The details of a high availability configuration for this runtime environment.

  • tags (Optional[TagMap], default: None ) –

    The tags for the runtime environment.

  • preferred_maintenance_window (Optional[String50], default: None ) –

    Configures the maintenance window that you want for the runtime environment. The maintenance window must have the format ddd:hh24:mi-ddd:hh24:mi and must be less than 24 hours. The following two examples are valid maintenance windows: sun:23:45-mon:00:15 or sat:01:00-sat:03:00.

    If you do not provide a value, a random system-generated value will be assigned.

  • network_type (Optional[NetworkType], default: None ) –

    The network type required for the runtime environment.

  • client_token (Optional[ClientToken], default: None ) –

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request to create an environment. The service generates the clientToken when the API call is triggered. The token expires after one hour, so if you retry the API within this timeframe with the same clientToken, you will get the same response. The service also handles deleting the clientToken after it expires.

  • kms_key_id (Optional[str], default: None ) –

    The identifier of a customer managed key.

Raises:

Source code in docs_src/capo_m2/_services/m2.py
def create_environment(
    self,
    name: "capo_m2.types.entity_name.EntityName",
    instance_type: "capo_m2.types.string20.String20",
    engine_type: "capo_m2.types.engine_type.EngineType",
    *,
    config_overrides: Optional[m2ClientConfig] = None,
    description: Optional[
        "capo_m2.types.entity_description.EntityDescription"
    ] = None,
    engine_version: Optional["capo_m2.types.engine_version.EngineVersion"] = None,
    subnet_ids: Optional["capo_m2.types.string50_list.String50List"] = None,
    security_group_ids: Optional["capo_m2.types.string50_list.String50List"] = None,
    storage_configurations: Optional[
        "capo_m2.types.storage_configuration_list.StorageConfigurationList"
    ] = None,
    publicly_accessible: Optional["capo_m2.types.boolean.Boolean"] = None,
    high_availability_config: Optional[
        "capo_m2.types.high_availability_config.HighAvailabilityConfig"
    ] = None,
    tags: Optional["capo_m2.types.tag_map.TagMap"] = None,
    preferred_maintenance_window: Optional[
        "capo_m2.types.string50.String50"
    ] = None,
    network_type: Optional["capo_m2.types.network_type.NetworkType"] = None,
    client_token: Optional["capo_m2.types.client_token.ClientToken"] = None,
    kms_key_id: Optional[str] = None,
) -> "capo_m2.types.create_environment_response.CreateEnvironmentResponse":
    """<p>Creates a runtime environment for a given runtime engine.</p>

    Args:
        name: <p>The name of the runtime environment. Must be unique within the account.</p>
        instance_type: <p>The type of instance for the runtime environment.</p>
        description: <p>The description of the runtime environment.</p>
        engine_type: <p>The engine type for the runtime environment.</p>
        engine_version: <p>The version of the engine type for the runtime environment.</p>
        subnet_ids: <p>The list of subnets associated with the VPC for this runtime environment.</p>
        security_group_ids: <p>The list of security groups for the VPC associated with this runtime environment.</p>
        storage_configurations: <p>Optional. The storage configurations for this runtime environment.</p>
        publicly_accessible: <p>Specifies whether the runtime environment is publicly accessible.</p>
        high_availability_config: <p>The details of a high availability configuration for this runtime environment.</p>
        tags: <p>The tags for the runtime environment.</p>
        preferred_maintenance_window: <p>Configures the maintenance window that you want for the runtime environment. The maintenance window must have the format <code>ddd:hh24:mi-ddd:hh24:mi</code> and must be less than 24 hours. The following two examples are valid maintenance windows: <code>sun:23:45-mon:00:15</code> or <code>sat:01:00-sat:03:00</code>. </p> <p>If you do not provide a value, a random system-generated value will be assigned.</p>
        network_type: <p>The network type required for the runtime environment.</p>
        client_token: <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request to create an environment. The service generates the clientToken when the API call is triggered. The token expires after one hour, so if you retry the API within this timeframe with the same clientToken, you will get the same response. The service also handles deleting the clientToken after it expires. </p>
        kms_key_id: <p>The identifier of a customer managed key.</p>

    Raises:
        capo_m2.errors.access_denied_exception.AccessDeniedException: <p>The account or role doesn't have the right permissions to make the request.</p>
        capo_m2.errors.conflict_exception.ConflictException: <p>The parameters provided in the request conflict with existing resources.</p>
        capo_m2.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_m2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>One or more quotas for Amazon Web Services Mainframe Modernization exceeds the limit.</p>
        capo_m2.errors.throttling_exception.ThrottlingException: <p>The number of requests made exceeds the limit.</p>
        capo_m2.errors.validation_exception.ValidationException: <p>One or more parameters provided in the request is not valid.</p>
        capo_m2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_m2.types.create_environment_request.CreateEnvironmentRequest]",
    ) -> OperationResponse[
        "capo_m2.types.create_environment_response.CreateEnvironmentResponse"
    ]:
        import capo_m2._operations.aws_supernova_control_plane_service.create_environment

        output, http_response = (
            capo_m2._operations.aws_supernova_control_plane_service.create_environment.create_environment(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEnvironment")
    )
    input_: capo_m2.types.create_environment_request.CreateEnvironmentRequest = {
        "name": name,
        "instance_type": instance_type,
        "engine_type": engine_type,
    }
    if description is not None:
        input_["description"] = description
    if engine_version is not None:
        input_["engine_version"] = engine_version
    if subnet_ids is not None:
        input_["subnet_ids"] = subnet_ids
    if security_group_ids is not None:
        input_["security_group_ids"] = security_group_ids
    if storage_configurations is not None:
        input_["storage_configurations"] = storage_configurations
    if publicly_accessible is not None:
        input_["publicly_accessible"] = publicly_accessible
    if high_availability_config is not None:
        input_["high_availability_config"] = high_availability_config
    if tags is not None:
        input_["tags"] = tags
    if preferred_maintenance_window is not None:
        input_["preferred_maintenance_window"] = preferred_maintenance_window
    if network_type is not None:
        input_["network_type"] = network_type
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output