Skip to content

Commit

Permalink
Release v0.21.1 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
semantic-release-bot committed Aug 1, 2022
1 parent 569cb9f commit 3e200b3
Show file tree
Hide file tree
Showing 18 changed files with 478 additions and 47 deletions.
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "qcs-api-client"
version = "0.21.0"
version = "0.21.1"
description = "A client library for accessing the Rigetti QCS API"
license = "Apache-2.0"
repository = "https://github.com/rigetti/qcs-api-client-python"
Expand Down
162 changes: 162 additions & 0 deletions qcs_api_client/api/endpoints/restart_endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
from typing import Any, Dict, cast

import httpx
from retrying import retry

from ...models.restart_endpoint_request import RestartEndpointRequest
from ...types import Response
from ...util.errors import QCSHTTPStatusError, raise_for_status
from ...util.retry import DEFAULT_RETRY_ARGUMENTS


def _get_kwargs(
endpoint_id: str,
*,
client: httpx.Client,
json_body: RestartEndpointRequest,
) -> Dict[str, Any]:
url = "{}/v1/endpoints/{endpointId}:restart".format(client.base_url, endpointId=endpoint_id)

headers = {k: v for (k, v) in client.headers.items()}
cookies = {k: v for (k, v) in client.cookies}

json_json_body = json_body.to_dict()

return {
"method": "post",
"url": url,
"headers": headers,
"cookies": cookies,
"timeout": client.timeout,
"json": json_json_body,
}


def _parse_response(*, response: httpx.Response) -> Any:
raise_for_status(response)
if response.status_code == 200:
response_200 = cast(Any, response.json())
return response_200
else:
raise QCSHTTPStatusError(
f"Unexpected response: status code {response.status_code}", response=response, error=None
)


def _build_response(*, response: httpx.Response) -> Response[Any]:
"""
Construct the Response class from the raw ``httpx.Response``.
"""
return Response.build_from_httpx_response(response=response, parse_function=_parse_response)


@retry(**DEFAULT_RETRY_ARGUMENTS)
def sync(
endpoint_id: str,
*,
client: httpx.Client,
json_body: RestartEndpointRequest,
httpx_request_kwargs: Dict[str, Any] = {},
) -> Response[Any]:
"""Restart Endpoint
Restart an entire endpoint or a single component within an endpoint.
Args:
endpoint_id (str):
json_body (RestartEndpointRequest):
Returns:
Response[Any]
"""

kwargs = _get_kwargs(
endpoint_id=endpoint_id,
client=client,
json_body=json_body,
)
kwargs.update(httpx_request_kwargs)
response = client.request(
**kwargs,
)

return _build_response(response=response)


@retry(**DEFAULT_RETRY_ARGUMENTS)
def sync_from_dict(
endpoint_id: str,
*,
client: httpx.Client,
json_body_dict: Dict,
httpx_request_kwargs: Dict[str, Any] = {},
) -> Response[Any]:
json_body = RestartEndpointRequest.from_dict(json_body_dict)

kwargs = _get_kwargs(
endpoint_id=endpoint_id,
client=client,
json_body=json_body,
)
kwargs.update(httpx_request_kwargs)
response = client.request(
**kwargs,
)

return _build_response(response=response)


@retry(**DEFAULT_RETRY_ARGUMENTS)
async def asyncio(
endpoint_id: str,
*,
client: httpx.AsyncClient,
json_body: RestartEndpointRequest,
httpx_request_kwargs: Dict[str, Any] = {},
) -> Response[Any]:
"""Restart Endpoint
Restart an entire endpoint or a single component within an endpoint.
Args:
endpoint_id (str):
json_body (RestartEndpointRequest):
Returns:
Response[Any]
"""

kwargs = _get_kwargs(
endpoint_id=endpoint_id,
client=client,
json_body=json_body,
)
kwargs.update(httpx_request_kwargs)
response = await client.request(
**kwargs,
)

return _build_response(response=response)


@retry(**DEFAULT_RETRY_ARGUMENTS)
async def asyncio_from_dict(
endpoint_id: str,
*,
client: httpx.AsyncClient,
json_body_dict: Dict,
httpx_request_kwargs: Dict[str, Any] = {},
) -> Response[Any]:
json_body = RestartEndpointRequest.from_dict(json_body_dict)

kwargs = _get_kwargs(
endpoint_id=endpoint_id,
client=client,
json_body=json_body,
)
kwargs.update(httpx_request_kwargs)
response = client.request(
**kwargs,
)

return _build_response(response=response)
22 changes: 12 additions & 10 deletions qcs_api_client/api/reservations/create_reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ def sync(
Create a new reservation.
The following precedence applies when specifying the reservation subject account ID and type:
* request body `accountId` field, or if unset then `X-QCS-ACCOUNT-ID` header, or if unset then
requesting user's ID.
* request body `accountType` field, or if unset then `X-QCS-ACCOUNT-TYPE` header, or if unset then
\"user\" type.
The following precedence applies when specifying the reservation subject account
ID and type:
* request body `accountId` field, or if unset then `X-QCS-ACCOUNT-ID` header,
or if unset then requesting user's ID.
* request body `accountType` field, or if unset then `X-QCS-ACCOUNT-TYPE`
header, or if unset then \"user\" type.
Args:
json_body (CreateReservationRequest):
Expand Down Expand Up @@ -119,11 +120,12 @@ async def asyncio(
Create a new reservation.
The following precedence applies when specifying the reservation subject account ID and type:
* request body `accountId` field, or if unset then `X-QCS-ACCOUNT-ID` header, or if unset then
requesting user's ID.
* request body `accountType` field, or if unset then `X-QCS-ACCOUNT-TYPE` header, or if unset then
\"user\" type.
The following precedence applies when specifying the reservation subject account
ID and type:
* request body `accountId` field, or if unset then `X-QCS-ACCOUNT-ID` header,
or if unset then requesting user's ID.
* request body `accountType` field, or if unset then `X-QCS-ACCOUNT-TYPE`
header, or if unset then \"user\" type.
Args:
json_body (CreateReservationRequest):
Expand Down
6 changes: 4 additions & 2 deletions qcs_api_client/api/reservations/list_reservations.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def sync(
"""List Reservations
List existing reservations for the authenticated user,
or a target user when specifying `X-QCS-ACCOUNT-ID` and `X-QCS-ACCOUNT-TYPE` headers.
or a target user when specifying `X-QCS-ACCOUNT-ID` and `X-QCS-ACCOUNT-TYPE`
headers.
Available filter fields include:
Expand Down Expand Up @@ -115,7 +116,8 @@ async def asyncio(
"""List Reservations
List existing reservations for the authenticated user,
or a target user when specifying `X-QCS-ACCOUNT-ID` and `X-QCS-ACCOUNT-TYPE` headers.
or a target user when specifying `X-QCS-ACCOUNT-ID` and `X-QCS-ACCOUNT-TYPE`
headers.
Available filter fields include:
Expand Down
4 changes: 4 additions & 0 deletions qcs_api_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from .billing_price_recurrence_aggregate_usage import BillingPriceRecurrenceAggregateUsage
from .billing_price_recurrence_interval import BillingPriceRecurrenceInterval
from .billing_price_recurrence_usage_type import BillingPriceRecurrenceUsageType
from .billing_price_scheme import BillingPriceScheme
from .billing_price_tiers_mode import BillingPriceTiersMode
from .billing_product import BillingProduct
from .billing_product_object import BillingProductObject
from .billing_upcoming_invoice import BillingUpcomingInvoice
Expand Down Expand Up @@ -65,6 +67,8 @@
from .quantum_processor import QuantumProcessor
from .remove_group_user_request import RemoveGroupUserRequest
from .reservation import Reservation
from .restart_endpoint_request import RestartEndpointRequest
from .tier import Tier
from .translate_native_quil_to_encrypted_binary_request import TranslateNativeQuilToEncryptedBinaryRequest
from .translate_native_quil_to_encrypted_binary_response import TranslateNativeQuilToEncryptedBinaryResponse
from .translate_native_quil_to_encrypted_binary_response_memory_descriptors import (
Expand Down
Loading

0 comments on commit 3e200b3

Please sign in to comment.