Skip to content

create_network_migration_definition async

create_network_migration_definition(
    name: NetworkMigrationDefinitionName,
    target_s3_configuration: TargetS3Configuration,
    target_network: TargetNetwork,
    *,
    config_overrides: Optional[AsyncmgnClientConfig] = None,
    description: Optional[NetworkMigrationDefinitionDescription] = None,
    source_configurations: Optional[SourceConfigurationList] = None,
    target_deployment: Optional[TargetDeployment] = None,
    vpc_provisioning_strategy: Optional[VpcProvisioningStrategy] = None,
    cidr_mappings: Optional[CidrMappingsList] = None,
    tags: Optional[TagsMap] = None,
    scope_tags: Optional[ScopeTagsMap] = None,
) -> NetworkMigrationDefinition

Creates a new network migration definition that specifies the source and target network configuration for a migration.

Parameters:

  • name (NetworkMigrationDefinitionName) –

    The name of the network migration definition.

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

    A description of the network migration definition.

  • source_configurations (Optional[SourceConfigurationList], default: None ) –

    A list of source configurations for the network migration.

  • target_s3_configuration (TargetS3Configuration) –

    The S3 configuration for storing the target network artifacts.

  • target_network (TargetNetwork) –

    The target network configuration including topology and CIDR ranges.

  • target_deployment (Optional[TargetDeployment], default: None ) –

    The target deployment configuration for the migrated network.

  • vpc_provisioning_strategy (Optional[VpcProvisioningStrategy], default: None ) –

    Specifies whether to create new target VPCs or use existing ones. Set to CREATE_NEW to provision new target VPCs as part of the migration, or USE_EXISTING to migrate into existing VPCs in the target account.

  • cidr_mappings (Optional[CidrMappingsList], default: None ) –

    A list of CIDR mappings that map original source CIDR ranges to updated target CIDR ranges. CIDR mappings can be provided only when vpcProvisioningStrategy is set to USE_EXISTING.

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

    Tags to assign to the network migration definition.

  • scope_tags (Optional[ScopeTagsMap], default: None ) –

    Scope tags for the network migration definition to control access and organization.

Raises:

Examples:

Sample CreateNetworkMigrationDefinition call

>>> await client.create_network_migration_definition(name='network1', description='network 1 description', target_deployment='SINGLE_ACCOUNT', source_configurations=[{'sourceEnvironment': 'NSX', 'sourceS3Configuration': {'s3Bucket': 'source_bucket', 's3Key': 'source_key', 's3BucketOwner': '012345678901'}}], target_s3_configuration={'s3Bucket': 'target_bucket', 's3BucketOwner': '012345678901'}, target_network={'topology': 'ISOLATED_VPC', 'inboundCidr': '192.168.1.0/24'})
Source code in docs_src/capo_mgn/_services/async_mgn.py
async def create_network_migration_definition(
    self,
    name: "capo_mgn.types.network_migration_definition_name.NetworkMigrationDefinitionName",
    target_s3_configuration: "capo_mgn.types.target_s3_configuration.TargetS3Configuration",
    target_network: "capo_mgn.types.target_network.TargetNetwork",
    *,
    config_overrides: Optional[AsyncmgnClientConfig] = None,
    description: Optional[
        "capo_mgn.types.network_migration_definition_description.NetworkMigrationDefinitionDescription"
    ] = None,
    source_configurations: Optional[
        "capo_mgn.types.source_configuration_list.SourceConfigurationList"
    ] = None,
    target_deployment: Optional[
        "capo_mgn.types.target_deployment.TargetDeployment"
    ] = None,
    vpc_provisioning_strategy: Optional[
        "capo_mgn.types.vpc_provisioning_strategy.VpcProvisioningStrategy"
    ] = None,
    cidr_mappings: Optional[
        "capo_mgn.types.cidr_mappings_list.CidrMappingsList"
    ] = None,
    tags: Optional["capo_mgn.types.tags_map.TagsMap"] = None,
    scope_tags: Optional["capo_mgn.types.scope_tags_map.ScopeTagsMap"] = None,
) -> "capo_mgn.types.network_migration_definition.NetworkMigrationDefinition":
    """<p>Creates a new network migration definition that specifies the source and target network configuration for a migration.</p>

    Args:
        name: <p>The name of the network migration definition.</p>
        description: <p>A description of the network migration definition.</p>
        source_configurations: <p>A list of source configurations for the network migration.</p>
        target_s3_configuration: <p>The S3 configuration for storing the target network artifacts.</p>
        target_network: <p>The target network configuration including topology and CIDR ranges.</p>
        target_deployment: <p>The target deployment configuration for the migrated network.</p>
        vpc_provisioning_strategy: <p>Specifies whether to create new target VPCs or use existing ones. Set to <code>CREATE_NEW</code> to provision new target VPCs as part of the migration, or <code>USE_EXISTING</code> to migrate into existing VPCs in the target account.</p>
        cidr_mappings: <p>A list of CIDR mappings that map original source CIDR ranges to updated target CIDR ranges. CIDR mappings can be provided only when <code>vpcProvisioningStrategy</code> is set to <code>USE_EXISTING</code>.</p>
        tags: <p>Tags to assign to the network migration definition.</p>
        scope_tags: <p>Scope tags for the network migration definition to control access and organization.</p>

    Raises:
        capo_mgn.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request could not be completed because it exceeded the service quota.</p>
        capo_mgn.errors.validation_exception.ValidationException: <p>Validate exception.</p>
        capo_mgn.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Sample CreateNetworkMigrationDefinition call

        >>> await client.create_network_migration_definition(name='network1', description='network 1 description', target_deployment='SINGLE_ACCOUNT', source_configurations=[{'sourceEnvironment': 'NSX', 'sourceS3Configuration': {'s3Bucket': 'source_bucket', 's3Key': 'source_key', 's3BucketOwner': '012345678901'}}], target_s3_configuration={'s3Bucket': 'target_bucket', 's3BucketOwner': '012345678901'}, target_network={'topology': 'ISOLATED_VPC', 'inboundCidr': '192.168.1.0/24'})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_mgn.types.create_network_migration_definition_request.CreateNetworkMigrationDefinitionRequest]",
    ) -> AsyncOperationResponse[
        "capo_mgn.types.network_migration_definition.NetworkMigrationDefinition"
    ]:
        import capo_mgn._operations.application_migration_service.create_network_migration_definition

        (
            output,
            http_response,
        ) = await capo_mgn._operations.application_migration_service.create_network_migration_definition.async_create_network_migration_definition(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_mgn.types.create_network_migration_definition_request.CreateNetworkMigrationDefinitionRequest",
    ) -> dict[str, Any]:
        import capo_mgn.types.create_network_migration_definition_request

        return capo_mgn.types.create_network_migration_definition_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_mgn.types.network_migration_definition.NetworkMigrationDefinition",
    ) -> dict[str, Any]:
        import capo_mgn.types.network_migration_definition

        return capo_mgn.types.network_migration_definition.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateNetworkMigrationDefinition",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_mgn.types.create_network_migration_definition_request.CreateNetworkMigrationDefinitionRequest = {
        "name": name,
        "target_s3_configuration": target_s3_configuration,
        "target_network": target_network,
    }
    if description is not None:
        input_["description"] = description
    if source_configurations is not None:
        input_["source_configurations"] = source_configurations
    if target_deployment is not None:
        input_["target_deployment"] = target_deployment
    if vpc_provisioning_strategy is not None:
        input_["vpc_provisioning_strategy"] = vpc_provisioning_strategy
    if cidr_mappings is not None:
        input_["cidr_mappings"] = cidr_mappings
    if tags is not None:
        input_["tags"] = tags
    if scope_tags is not None:
        input_["scope_tags"] = scope_tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output