Skip to content

get_groups_for_capacity_reservation async

get_groups_for_capacity_reservation(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    capacity_reservation_id: Optional[CapacityReservationId] = None,
    next_token: Optional[String] = None,
    max_results: Optional[GetGroupsForCapacityReservationRequestMaxResults] = None,
    dry_run: Optional[Boolean] = None,
) -> GetGroupsForCapacityReservationResult

Lists the resource groups to which a Capacity Reservation has been added.

Parameters:

  • capacity_reservation_id (Optional[CapacityReservationId], default: None ) –

    The ID of the Capacity Reservation. If you specify a Capacity Reservation that is shared with you, the operation returns only Capacity Reservation groups that you own.

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

    The token to use to retrieve the next page of results.

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

    The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.

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

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def get_groups_for_capacity_reservation(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    capacity_reservation_id: Optional[
        "capo_ec2.types.capacity_reservation_id.CapacityReservationId"
    ] = None,
    next_token: Optional["capo_ec2.types.string.String"] = None,
    max_results: Optional[
        "capo_ec2.types.get_groups_for_capacity_reservation_request_max_results.GetGroupsForCapacityReservationRequestMaxResults"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.get_groups_for_capacity_reservation_result.GetGroupsForCapacityReservationResult":
    """<p>Lists the resource groups to which a Capacity Reservation has been added.</p>

    Args:
        capacity_reservation_id: <p>The ID of the Capacity Reservation. If you specify a Capacity Reservation that is shared with you, the operation returns only Capacity Reservation groups that you own.</p>
        next_token: <p>The token to use to retrieve the next page of results.</p>
        max_results: <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.get_groups_for_capacity_reservation_request.GetGroupsForCapacityReservationRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.get_groups_for_capacity_reservation_result.GetGroupsForCapacityReservationResult"
    ]:
        import capo_ec2._operations.amazon_ec2.get_groups_for_capacity_reservation

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.get_groups_for_capacity_reservation.async_get_groups_for_capacity_reservation(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetGroupsForCapacityReservation")
    )
    input_: capo_ec2.types.get_groups_for_capacity_reservation_request.GetGroupsForCapacityReservationRequest = {}
    if capacity_reservation_id is not None:
        input_["capacity_reservation_id"] = capacity_reservation_id
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if dry_run is not None:
        input_["dry_run"] = dry_run

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