Skip to content

set_ip_address_type async

set_ip_address_type(
    resource_type: ResourceType,
    resource_name: ResourceName,
    ip_address_type: IpAddressType,
    *,
    config_overrides: Optional[AsyncLightsailClientConfig] = None,
    accept_bundle_update: Optional[boolean] = None,
) -> SetIpAddressTypeResult

Sets the IP address type for an Amazon Lightsail resource.

Use this action to enable dual-stack for a resource, which enables IPv4 and IPv6 for the specified resource. Alternately, you can use this action to disable dual-stack, and enable IPv4 only.

Parameters:

  • resource_type (ResourceType) –

    The resource type.

    The resource values are Distribution, Instance, and LoadBalancer.

    Distribution-related APIs are available only in the N. Virginia (us-east-1) Amazon Web Services Region. Set your Amazon Web Services Region configuration to us-east-1 to create, view, or edit distributions.

  • resource_name (ResourceName) –

    The name of the resource for which to set the IP address type.

  • ip_address_type (IpAddressType) –

    The IP address type to set for the specified resource.

    The possible values are ipv4 for IPv4 only, ipv6 for IPv6 only, and dualstack for IPv4 and IPv6.

  • accept_bundle_update (Optional[boolean], default: None ) –

    Required parameter to accept the instance bundle update when changing to, and from, IPv6-only.

    An instance bundle will change when switching from dual-stack or ipv4, to ipv6. It also changes when switching from ipv6, to dual-stack or ipv4.

    You must include this parameter in the command to update the bundle. For example, if you switch from dual-stack to ipv6, the bundle will be updated, and billing for the IPv6-only instance bundle begins immediately.

Raises:

  • AccessDeniedException –

    Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.

  • AccountSetupInProgressException –

    Lightsail throws this exception when an account is still in the setup in progress state.

  • InvalidInputException –

    Lightsail throws this exception when user input does not conform to the validation rules of an input field.

    Domain and distribution APIs are only available in the N. Virginia (us-east-1) Amazon Web Services Region. Please set your Amazon Web Services Region configuration to us-east-1 to create, view, or edit these resources.

  • NotFoundException –

    Lightsail throws this exception when it cannot find a resource.

  • OperationFailureException –

    Lightsail throws this exception when an operation fails to execute.

  • RegionSetupInProgressException –

    Lightsail throws this exception when an operation is performed on resources in an opt-in Region that is currently being set up.

  • ServiceException –

    A general service exception.

  • UnauthenticatedException –

    Lightsail throws this exception when the user has not been authenticated.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_lightsail/_services/async_lightsail.py
async def set_ip_address_type(
    self,
    resource_type: "capo_lightsail.types.resource_type.ResourceType",
    resource_name: "capo_lightsail.types.resource_name.ResourceName",
    ip_address_type: "capo_lightsail.types.ip_address_type.IpAddressType",
    *,
    config_overrides: Optional[AsyncLightsailClientConfig] = None,
    accept_bundle_update: Optional["capo_lightsail.types.boolean.boolean"] = None,
) -> "capo_lightsail.types.set_ip_address_type_result.SetIpAddressTypeResult":
    """<p>Sets the IP address type for an Amazon Lightsail resource.</p> <p>Use this action to enable dual-stack for a resource, which enables IPv4 and IPv6 for the specified resource. Alternately, you can use this action to disable dual-stack, and enable IPv4 only.</p>

    Args:
        resource_type: <p>The resource type.</p> <p>The resource values are <code>Distribution</code>, <code>Instance</code>, and <code>LoadBalancer</code>.</p> <note> <p>Distribution-related APIs are available only in the N. Virginia (<code>us-east-1</code>) Amazon Web Services Region. Set your Amazon Web Services Region configuration to <code>us-east-1</code> to create, view, or edit distributions.</p> </note>
        resource_name: <p>The name of the resource for which to set the IP address type.</p>
        ip_address_type: <p>The IP address type to set for the specified resource.</p> <p>The possible values are <code>ipv4</code> for IPv4 only, <code>ipv6</code> for IPv6 only, and <code>dualstack</code> for IPv4 and IPv6.</p>
        accept_bundle_update: <p>Required parameter to accept the instance bundle update when changing to, and from, IPv6-only.</p> <note> <p>An instance bundle will change when switching from <code>dual-stack</code> or <code>ipv4</code>, to <code>ipv6</code>. It also changes when switching from <code>ipv6</code>, to <code>dual-stack</code> or <code>ipv4</code>.</p> <p>You must include this parameter in the command to update the bundle. For example, if you switch from <code>dual-stack</code> to <code>ipv6</code>, the bundle will be updated, and billing for the IPv6-only instance bundle begins immediately.</p> </note>

    Raises:
        capo_lightsail.errors.access_denied_exception.AccessDeniedException: <p>Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.</p>
        capo_lightsail.errors.account_setup_in_progress_exception.AccountSetupInProgressException: <p>Lightsail throws this exception when an account is still in the setup in progress state.</p>
        capo_lightsail.errors.invalid_input_exception.InvalidInputException: <p>Lightsail throws this exception when user input does not conform to the validation rules of an input field.</p> <note> <p>Domain and distribution APIs are only available in the N. Virginia (<code>us-east-1</code>) Amazon Web Services Region. Please set your Amazon Web Services Region configuration to <code>us-east-1</code> to create, view, or edit these resources.</p> </note>
        capo_lightsail.errors.not_found_exception.NotFoundException: <p>Lightsail throws this exception when it cannot find a resource.</p>
        capo_lightsail.errors.operation_failure_exception.OperationFailureException: <p>Lightsail throws this exception when an operation fails to execute.</p>
        capo_lightsail.errors.region_setup_in_progress_exception.RegionSetupInProgressException: <p>Lightsail throws this exception when an operation is performed on resources in an opt-in Region that is currently being set up.</p>
        capo_lightsail.errors.service_exception.ServiceException: <p>A general service exception.</p>
        capo_lightsail.errors.unauthenticated_exception.UnauthenticatedException: <p>Lightsail throws this exception when the user has not been authenticated.</p>
        capo_lightsail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lightsail.types.set_ip_address_type_request.SetIpAddressTypeRequest]",
    ) -> AsyncOperationResponse[
        "capo_lightsail.types.set_ip_address_type_result.SetIpAddressTypeResult"
    ]:
        import capo_lightsail._operations.lightsail_20161128.set_ip_address_type

        (
            output,
            http_response,
        ) = await capo_lightsail._operations.lightsail_20161128.set_ip_address_type.async_set_ip_address_type(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SetIpAddressType")
    )
    input_: capo_lightsail.types.set_ip_address_type_request.SetIpAddressTypeRequest = {
        "resource_type": resource_type,
        "resource_name": resource_name,
        "ip_address_type": ip_address_type,
    }
    if accept_bundle_update is not None:
        input_["accept_bundle_update"] = accept_bundle_update

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