Skip to content

get_resource_share_associations

get_resource_share_associations(
    association_type: ResourceShareAssociationType,
    *,
    config_overrides: Optional[RAMClientConfig] = None,
    resource_share_arns: Optional[ResourceShareArnList] = None,
    resource_arn: Optional[String] = None,
    principal: Optional[String] = None,
    association_status: Optional[ResourceShareAssociationStatus] = None,
    next_token: Optional[String] = None,
    max_results: Optional[MaxResults] = None,
) -> GetResourceShareAssociationsResponse

Retrieves the lists of resources and principals that associated for resource shares that you own.

Always check the NextToken response parameter for a null value when calling a paginated operation. These operations can occasionally return an empty set of results even when there are more results available. The NextToken response parameter value is null only when there are no more results to display.

Parameters:

  • association_type (ResourceShareAssociationType) –

    Specifies whether you want to retrieve the associations that involve a specified resource or principal.

    • PRINCIPAL – list the principals whose associations you want to see.

    • RESOURCE – list the resources whose associations you want to see.

  • resource_share_arns (Optional[ResourceShareArnList], default: None ) –

    Specifies a list of Amazon Resource Names (ARNs) of the resource share whose associations you want to retrieve.

  • resource_arn (Optional[String], default: None ) –

    Specifies the Amazon Resource Name (ARN) of a resource whose resource shares you want to retrieve.

    You cannot specify this parameter if the association type is PRINCIPAL.

  • principal (Optional[String], default: None ) –

    Specifies the ID of the principal whose resource shares you want to retrieve. This can be an Amazon Web Services account ID, an organization ID, an organizational unit ID, or the Amazon Resource Name (ARN) of an individual IAM role or user.

    You cannot specify this parameter if the association type is RESOURCE.

  • association_status (Optional[ResourceShareAssociationStatus], default: None ) –

    Specifies that you want to retrieve only associations that have this status.

  • next_token (Optional[String], default: None ) –

    Specifies that you want to receive the next page of results. Valid only if you received a NextToken response in the previous request. If you did, it indicates that more output is available. Set this parameter to the value provided by the previous call's NextToken response to request the next page of results.

  • max_results (Optional[MaxResults], default: None ) –

    Specifies the total number of results that you want included on each page of the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the number you specify, the NextToken response element is returned with a value (not null). Include the specified value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that the service might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

Raises:

Source code in docs_src/capo_ram/_services/ram.py
def get_resource_share_associations(
    self,
    association_type: "capo_ram.types.resource_share_association_type.ResourceShareAssociationType",
    *,
    config_overrides: Optional[RAMClientConfig] = None,
    resource_share_arns: Optional[
        "capo_ram.types.resource_share_arn_list.ResourceShareArnList"
    ] = None,
    resource_arn: Optional["capo_ram.types.string.String"] = None,
    principal: Optional["capo_ram.types.string.String"] = None,
    association_status: Optional[
        "capo_ram.types.resource_share_association_status.ResourceShareAssociationStatus"
    ] = None,
    next_token: Optional["capo_ram.types.string.String"] = None,
    max_results: Optional["capo_ram.types.max_results.MaxResults"] = None,
) -> "capo_ram.types.get_resource_share_associations_response.GetResourceShareAssociationsResponse":
    """<p>Retrieves the lists of resources and principals that associated for resource shares that you own.</p> <note> <p>Always check the <code>NextToken</code> response parameter for a <code>null</code> value when calling a paginated operation. These operations can occasionally return an empty set of results even when there are more results available. The <code>NextToken</code> response parameter value is <code>null</code> <i>only</i> when there are no more results to display.</p> </note>

    Args:
        association_type: <p>Specifies whether you want to retrieve the associations that involve a specified resource or principal.</p> <ul> <li> <p> <code>PRINCIPAL</code> – list the principals whose associations you want to see.</p> </li> <li> <p> <code>RESOURCE</code> – list the resources whose associations you want to see.</p> </li> </ul>
        resource_share_arns: <p>Specifies a list of <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> of the resource share whose associations you want to retrieve.</p>
        resource_arn: <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of a resource whose resource shares you want to retrieve.</p> <p>You cannot specify this parameter if the association type is <code>PRINCIPAL</code>.</p>
        principal: <p>Specifies the ID of the principal whose resource shares you want to retrieve. This can be an Amazon Web Services account ID, an organization ID, an organizational unit ID, or the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of an individual IAM role or user.</p> <p>You cannot specify this parameter if the association type is <code>RESOURCE</code>.</p>
        association_status: <p>Specifies that you want to retrieve only associations that have this status.</p>
        next_token: <p>Specifies that you want to receive the next page of results. Valid only if you received a <code>NextToken</code> response in the previous request. If you did, it indicates that more output is available. Set this parameter to the value provided by the previous call's <code>NextToken</code> response to request the next page of results.</p>
        max_results: <p>Specifies the total number of results that you want included on each page of the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the number you specify, the <code>NextToken</code> response element is returned with a value (not null). Include the specified value as the <code>NextToken</code> request parameter in the next call to the operation to get the next part of the results. Note that the service might return fewer results than the maximum even when there are more results available. You should check <code>NextToken</code> after every operation to ensure that you receive all of the results.</p>

    Raises:
        capo_ram.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The operation failed because the specified value for <code>NextToken</code> isn't valid. You must specify a value you received in the <code>NextToken</code> response of a previous call to this operation.</p>
        capo_ram.errors.invalid_parameter_exception.InvalidParameterException: <p>The operation failed because a parameter you specified isn't valid.</p>
        capo_ram.errors.malformed_arn_exception.MalformedArnException: <p>The operation failed because the specified <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> has a format that isn't valid.</p>
        capo_ram.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>The operation failed because the requested operation isn't permitted.</p>
        capo_ram.errors.server_internal_exception.ServerInternalException: <p>The operation failed because the service could not respond to the request due to an internal problem. Try again later.</p>
        capo_ram.errors.service_unavailable_exception.ServiceUnavailableException: <p>The operation failed because the service isn't available. Try again later.</p>
        capo_ram.errors.unknown_resource_exception.UnknownResourceException: <p>The operation failed because a specified resource couldn't be found.</p>
        capo_ram.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ram.types.get_resource_share_associations_request.GetResourceShareAssociationsRequest]",
    ) -> OperationResponse[
        "capo_ram.types.get_resource_share_associations_response.GetResourceShareAssociationsResponse"
    ]:
        import capo_ram._operations.amazon_resource_sharing.get_resource_share_associations

        output, http_response = (
            capo_ram._operations.amazon_resource_sharing.get_resource_share_associations.get_resource_share_associations(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetResourceShareAssociations")
    )
    input_: capo_ram.types.get_resource_share_associations_request.GetResourceShareAssociationsRequest = {
        "association_type": association_type
    }
    if resource_share_arns is not None:
        input_["resource_share_arns"] = resource_share_arns
    if resource_arn is not None:
        input_["resource_arn"] = resource_arn
    if principal is not None:
        input_["principal"] = principal
    if association_status is not None:
        input_["association_status"] = association_status
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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