Skip to content

update_resource async

update_resource(
    organization_id: OrganizationId,
    resource_id: EntityIdentifier,
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
    name: Optional[ResourceName] = None,
    booking_options: Optional[BookingOptions] = None,
    description: Optional[NewResourceDescription] = None,
    type: Optional[ResourceType] = None,
    hidden_from_global_address_list: Optional[BooleanObject] = None,
) -> UpdateResourceResponse

Updates data for the resource. To have the latest information, it must be preceded by a DescribeResource call. The dataset in the request should be the one expected when performing another DescribeResource call.

Parameters:

  • organization_id (OrganizationId) –

    The identifier associated with the organization for which the resource is updated.

  • resource_id (EntityIdentifier) –

    The identifier of the resource to be updated.

    The identifier can accept ResourceId, Resourcename, or email. The following identity formats are available:

    • Resource ID: r-0123456789a0123456789b0123456789

    • Email address: [email protected]

    • Resource name: resource

  • name (Optional[ResourceName], default: None ) –

    The name of the resource to be updated.

  • booking_options (Optional[BookingOptions], default: None ) –

    The resource's booking options to be updated.

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

    Updates the resource description.

  • type (Optional[ResourceType], default: None ) –

    Updates the resource type.

  • hidden_from_global_address_list (Optional[BooleanObject], default: None ) –

    If enabled, the resource is hidden from the global address list.

Raises:

Source code in docs_src/capo_workmail/_services/async_work_mail.py
async def update_resource(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    resource_id: "capo_workmail.types.entity_identifier.EntityIdentifier",
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
    name: Optional["capo_workmail.types.resource_name.ResourceName"] = None,
    booking_options: Optional[
        "capo_workmail.types.booking_options.BookingOptions"
    ] = None,
    description: Optional[
        "capo_workmail.types.new_resource_description.NewResourceDescription"
    ] = None,
    type: Optional["capo_workmail.types.resource_type.ResourceType"] = None,
    hidden_from_global_address_list: Optional[
        "capo_workmail.types.boolean_object.BooleanObject"
    ] = None,
) -> "capo_workmail.types.update_resource_response.UpdateResourceResponse":
    """<p>Updates data for the resource. To have the latest information, it must be preceded by a <a>DescribeResource</a> call. The dataset in the request should be the one expected when performing another <code>DescribeResource</code> call.</p>

    Args:
        organization_id: <p>The identifier associated with the organization for which the resource is updated.</p>
        resource_id: <p>The identifier of the resource to be updated.</p> <p>The identifier can accept <i>ResourceId</i>, <i>Resourcename</i>, or <i>email</i>. The following identity formats are available:</p> <ul> <li> <p>Resource ID: r-0123456789a0123456789b0123456789</p> </li> <li> <p>Email address: [email protected]</p> </li> <li> <p>Resource name: resource</p> </li> </ul>
        name: <p>The name of the resource to be updated.</p>
        booking_options: <p>The resource's booking options to be updated.</p>
        description: <p>Updates the resource description.</p>
        type: <p>Updates the resource type.</p>
        hidden_from_global_address_list: <p>If enabled, the resource is hidden from the global address list.</p>

    Raises:
        capo_workmail.errors.directory_unavailable_exception.DirectoryUnavailableException: <p>The directory is unavailable. It might be located in another Region or deleted.</p>
        capo_workmail.errors.email_address_in_use_exception.EmailAddressInUseException: <p>The email address that you're trying to assign is already created for a different user, group, or resource.</p>
        capo_workmail.errors.entity_not_found_exception.EntityNotFoundException: <p>The identifier supplied for the user, group, or resource does not exist in your organization.</p>
        capo_workmail.errors.entity_state_exception.EntityStateException: <p>You are performing an operation on a user, group, or resource that isn't in the expected state, such as trying to delete an active user.</p>
        capo_workmail.errors.invalid_configuration_exception.InvalidConfigurationException: <p>The configuration for a resource isn't valid. A resource must either be able to auto-respond to requests or have at least one delegate associated that can do so on its behalf.</p>
        capo_workmail.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the input parameters don't match the service's restrictions.</p>
        capo_workmail.errors.mail_domain_not_found_exception.MailDomainNotFoundException: <p>The domain specified is not found in your organization.</p>
        capo_workmail.errors.mail_domain_state_exception.MailDomainStateException: <p>After a domain has been added to the organization, it must be verified. The domain is not yet verified.</p>
        capo_workmail.errors.name_availability_exception.NameAvailabilityException: <p>The user, group, or resource name isn't unique in WorkMail.</p>
        capo_workmail.errors.organization_not_found_exception.OrganizationNotFoundException: <p>An operation received a valid organization identifier that either doesn't belong or exist in the system.</p>
        capo_workmail.errors.organization_state_exception.OrganizationStateException: <p>The organization must have a valid state to perform certain operations on the organization or its members.</p>
        capo_workmail.errors.unsupported_operation_exception.UnsupportedOperationException: <p>You can't perform a write operation against a read-only directory.</p>
        capo_workmail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workmail.types.update_resource_request.UpdateResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_workmail.types.update_resource_response.UpdateResourceResponse"
    ]:
        import capo_workmail._operations.work_mail_service.update_resource

        (
            output,
            http_response,
        ) = await capo_workmail._operations.work_mail_service.update_resource.async_update_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_workmail.types.update_resource_request.UpdateResourceRequest",
    ) -> dict[str, Any]:
        import capo_workmail.types.update_resource_request

        return capo_workmail.types.update_resource_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateResource", redact_input=_redact_input),
    )
    input_: capo_workmail.types.update_resource_request.UpdateResourceRequest = {
        "organization_id": organization_id,
        "resource_id": resource_id,
    }
    if name is not None:
        input_["name"] = name
    if booking_options is not None:
        input_["booking_options"] = booking_options
    if description is not None:
        input_["description"] = description
    if type is not None:
        input_["type"] = type
    if hidden_from_global_address_list is not None:
        input_["hidden_from_global_address_list"] = hidden_from_global_address_list

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