Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to api_client to v2023-11-01. #77

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
437 changes: 167 additions & 270 deletions requirements.txt

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions scripts/update_openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
#
# Copyright (c) 2023 Smallstep Labs, Inc <[email protected]> All Rights Reserved.

set -e
set -x

TEMPDIR=$(mktemp -d)
: ${SMALLSTEP_API_URL:="https://gateway.smallstep.com/openapi.json"}

# Update smallstep/openapi.json from URL and update the version to 3.0.2
curl -sL ${SMALLSTEP_API_URL} |jq '.openapi = "3.0.2"'|sponge smallstep/openapi.json

# Update the smallstep-python client libs from smallstep/openapi.json
openapi-python-client update --config scripts/openapi-python-client.yml --path smallstep/openapi.json
openapi-python-client generate --config scripts/openapi-python-client.yml --url ${SMALLSTEP_API_URL} --output-path=${TEMPDIR} --overwrite
rm -rf smallstep/api_client

# Do us a find and replace to fix CamelCase issues
rg disable_custom_sa_ns --files-with-matches smallstep/ | xargs sed -i 's/disable_custom_sa_ns/disable_custom_sans/g'
rg project_i_ds --files-with-matches smallstep/ | xargs sed -i 's/project_i_ds/project_ids/g'
rg static_sa_ns --files-with-matches smallstep/ | xargs sed -i 's/static_sa_ns/static_sans/g'
rg device_metadata_key_sa_ns --files-with-matches smallstep/ | xargs sed -i 's/device_metadata_key_sa_ns/device_metadata_key_sans/g'
rg disable_custom_sa_ns --files-with-matches ${TEMPDIR} | xargs sed -i 's/disable_custom_sa_ns/disable_custom_sans/g'
rg project_i_ds --files-with-matches ${TEMPDIR} | xargs sed -i 's/project_i_ds/project_ids/g'
mv ${TEMPDIR}/api_client smallstep/
3 changes: 2 additions & 1 deletion smallstep/api_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" A client library for accessing Smallstep API """
"""A client library for accessing Smallstep API"""

from .client import AuthenticatedClient, Client

__all__ = (
Expand Down
2 changes: 1 addition & 1 deletion smallstep/api_client/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" Contains methods for accessing the API """
"""Contains methods for accessing the API"""
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ def _get_kwargs(
x_request_id: Union[Unset, str] = UNSET,
accept: Union[Unset, str] = UNSET,
) -> Dict[str, Any]:
headers = {}
headers: Dict[str, Any] = {}
if not isinstance(x_request_id, Unset):
headers["X-Request-Id"] = x_request_id

if not isinstance(accept, Unset):
headers["Accept"] = accept

return {
_kwargs: Dict[str, Any] = {
"method": "delete",
"url": "/attestation-authorities/{attestationAuthorityID}".format(
attestationAuthorityID=attestation_authority_id,
),
"headers": headers,
"url": f"/attestation-authorities/{attestation_authority_id}",
}

_kwargs["headers"] = headers
return _kwargs


def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
if response.status_code == HTTPStatus.NO_CONTENT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ def _get_kwargs(
x_request_id: Union[Unset, str] = UNSET,
accept: Union[Unset, str] = UNSET,
) -> Dict[str, Any]:
headers = {}
headers: Dict[str, Any] = {}
if not isinstance(x_request_id, Unset):
headers["X-Request-Id"] = x_request_id

if not isinstance(accept, Unset):
headers["Accept"] = accept

return {
_kwargs: Dict[str, Any] = {
"method": "get",
"url": "/attestation-authorities",
"headers": headers,
}

_kwargs["headers"] = headers
return _kwargs


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ def _get_kwargs(
x_request_id: Union[Unset, str] = UNSET,
accept: Union[Unset, str] = UNSET,
) -> Dict[str, Any]:
headers = {}
headers: Dict[str, Any] = {}
if not isinstance(x_request_id, Unset):
headers["X-Request-Id"] = x_request_id

if not isinstance(accept, Unset):
headers["Accept"] = accept

return {
_kwargs: Dict[str, Any] = {
"method": "get",
"url": "/attestation-authorities/{attestationAuthorityID}".format(
attestationAuthorityID=attestation_authority_id,
),
"headers": headers,
"url": f"/attestation-authorities/{attestation_authority_id}",
}

_kwargs["headers"] = headers
return _kwargs


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@

def _get_kwargs(
*,
json_body: AttestationAuthority,
body: AttestationAuthority,
x_request_id: Union[Unset, str] = UNSET,
accept: Union[Unset, str] = UNSET,
) -> Dict[str, Any]:
headers = {}
headers: Dict[str, Any] = {}
if not isinstance(x_request_id, Unset):
headers["X-Request-Id"] = x_request_id

if not isinstance(accept, Unset):
headers["Accept"] = accept

json_json_body = json_body.to_dict()

return {
_kwargs: Dict[str, Any] = {
"method": "post",
"url": "/attestation-authorities",
"json": json_json_body,
"headers": headers,
}

_body = body.to_dict()

_kwargs["json"] = _body
headers["Content-Type"] = "application/json"

_kwargs["headers"] = headers
return _kwargs


def _parse_response(
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
Expand Down Expand Up @@ -71,7 +75,7 @@ def _build_response(
def sync_detailed(
*,
client: Union[AuthenticatedClient, Client],
json_body: AttestationAuthority,
body: AttestationAuthority,
x_request_id: Union[Unset, str] = UNSET,
accept: Union[Unset, str] = UNSET,
) -> Response[Union[Any, AttestationAuthority]]:
Expand All @@ -83,11 +87,11 @@ def sync_detailed(
Args:
x_request_id (Union[Unset, str]):
accept (Union[Unset, str]):
json_body (AttestationAuthority): An attestation authority used with the device-attest-01
ACME challenge to verify a device's hardware identity. This object is experimental and
subject to change. Example: {'attestorIntermediates': '-----BEGIN CERTIFICATE-----\n ...
\n-----END CERTIFICATE-----', 'attestorRoots': '-----BEGIN CERTIFICATE-----\n ... \n-----
END CERTIFICATE-----', 'createdAt': '2022-11-10T23:00:00Z', 'id':
body (AttestationAuthority): An attestation authority used with the device-attest-01 ACME
challenge to verify a device's hardware identity. This object is experimental and subject
to change. Example: {'attestorIntermediates': '-----BEGIN CERTIFICATE-----\n ... \n-----
END CERTIFICATE-----', 'attestorRoots': '-----BEGIN CERTIFICATE-----\n ... \n-----END
CERTIFICATE-----', 'createdAt': '2022-11-10T23:00:00Z', 'id':
'35507915-6ce4-4517-802f-1bdb6e9e80d8', 'name': 'Our Attestation Authority', 'root': '
-----BEGIN CERTIFICATE-----\n ... \n-----END CERTIFICATE-----', 'slug':
'teamfooattestationca'}.
Expand All @@ -101,7 +105,7 @@ def sync_detailed(
"""

kwargs = _get_kwargs(
json_body=json_body,
body=body,
x_request_id=x_request_id,
accept=accept,
)
Expand All @@ -116,7 +120,7 @@ def sync_detailed(
def sync(
*,
client: Union[AuthenticatedClient, Client],
json_body: AttestationAuthority,
body: AttestationAuthority,
x_request_id: Union[Unset, str] = UNSET,
accept: Union[Unset, str] = UNSET,
) -> Optional[Union[Any, AttestationAuthority]]:
Expand All @@ -128,11 +132,11 @@ def sync(
Args:
x_request_id (Union[Unset, str]):
accept (Union[Unset, str]):
json_body (AttestationAuthority): An attestation authority used with the device-attest-01
ACME challenge to verify a device's hardware identity. This object is experimental and
subject to change. Example: {'attestorIntermediates': '-----BEGIN CERTIFICATE-----\n ...
\n-----END CERTIFICATE-----', 'attestorRoots': '-----BEGIN CERTIFICATE-----\n ... \n-----
END CERTIFICATE-----', 'createdAt': '2022-11-10T23:00:00Z', 'id':
body (AttestationAuthority): An attestation authority used with the device-attest-01 ACME
challenge to verify a device's hardware identity. This object is experimental and subject
to change. Example: {'attestorIntermediates': '-----BEGIN CERTIFICATE-----\n ... \n-----
END CERTIFICATE-----', 'attestorRoots': '-----BEGIN CERTIFICATE-----\n ... \n-----END
CERTIFICATE-----', 'createdAt': '2022-11-10T23:00:00Z', 'id':
'35507915-6ce4-4517-802f-1bdb6e9e80d8', 'name': 'Our Attestation Authority', 'root': '
-----BEGIN CERTIFICATE-----\n ... \n-----END CERTIFICATE-----', 'slug':
'teamfooattestationca'}.
Expand All @@ -147,7 +151,7 @@ def sync(

return sync_detailed(
client=client,
json_body=json_body,
body=body,
x_request_id=x_request_id,
accept=accept,
).parsed
Expand All @@ -156,7 +160,7 @@ def sync(
async def asyncio_detailed(
*,
client: Union[AuthenticatedClient, Client],
json_body: AttestationAuthority,
body: AttestationAuthority,
x_request_id: Union[Unset, str] = UNSET,
accept: Union[Unset, str] = UNSET,
) -> Response[Union[Any, AttestationAuthority]]:
Expand All @@ -168,11 +172,11 @@ async def asyncio_detailed(
Args:
x_request_id (Union[Unset, str]):
accept (Union[Unset, str]):
json_body (AttestationAuthority): An attestation authority used with the device-attest-01
ACME challenge to verify a device's hardware identity. This object is experimental and
subject to change. Example: {'attestorIntermediates': '-----BEGIN CERTIFICATE-----\n ...
\n-----END CERTIFICATE-----', 'attestorRoots': '-----BEGIN CERTIFICATE-----\n ... \n-----
END CERTIFICATE-----', 'createdAt': '2022-11-10T23:00:00Z', 'id':
body (AttestationAuthority): An attestation authority used with the device-attest-01 ACME
challenge to verify a device's hardware identity. This object is experimental and subject
to change. Example: {'attestorIntermediates': '-----BEGIN CERTIFICATE-----\n ... \n-----
END CERTIFICATE-----', 'attestorRoots': '-----BEGIN CERTIFICATE-----\n ... \n-----END
CERTIFICATE-----', 'createdAt': '2022-11-10T23:00:00Z', 'id':
'35507915-6ce4-4517-802f-1bdb6e9e80d8', 'name': 'Our Attestation Authority', 'root': '
-----BEGIN CERTIFICATE-----\n ... \n-----END CERTIFICATE-----', 'slug':
'teamfooattestationca'}.
Expand All @@ -186,7 +190,7 @@ async def asyncio_detailed(
"""

kwargs = _get_kwargs(
json_body=json_body,
body=body,
x_request_id=x_request_id,
accept=accept,
)
Expand All @@ -199,7 +203,7 @@ async def asyncio_detailed(
async def asyncio(
*,
client: Union[AuthenticatedClient, Client],
json_body: AttestationAuthority,
body: AttestationAuthority,
x_request_id: Union[Unset, str] = UNSET,
accept: Union[Unset, str] = UNSET,
) -> Optional[Union[Any, AttestationAuthority]]:
Expand All @@ -211,11 +215,11 @@ async def asyncio(
Args:
x_request_id (Union[Unset, str]):
accept (Union[Unset, str]):
json_body (AttestationAuthority): An attestation authority used with the device-attest-01
ACME challenge to verify a device's hardware identity. This object is experimental and
subject to change. Example: {'attestorIntermediates': '-----BEGIN CERTIFICATE-----\n ...
\n-----END CERTIFICATE-----', 'attestorRoots': '-----BEGIN CERTIFICATE-----\n ... \n-----
END CERTIFICATE-----', 'createdAt': '2022-11-10T23:00:00Z', 'id':
body (AttestationAuthority): An attestation authority used with the device-attest-01 ACME
challenge to verify a device's hardware identity. This object is experimental and subject
to change. Example: {'attestorIntermediates': '-----BEGIN CERTIFICATE-----\n ... \n-----
END CERTIFICATE-----', 'attestorRoots': '-----BEGIN CERTIFICATE-----\n ... \n-----END
CERTIFICATE-----', 'createdAt': '2022-11-10T23:00:00Z', 'id':
'35507915-6ce4-4517-802f-1bdb6e9e80d8', 'name': 'Our Attestation Authority', 'root': '
-----BEGIN CERTIFICATE-----\n ... \n-----END CERTIFICATE-----', 'slug':
'teamfooattestationca'}.
Expand All @@ -231,7 +235,7 @@ async def asyncio(
return (
await asyncio_detailed(
client=client,
json_body=json_body,
body=body,
x_request_id=x_request_id,
accept=accept,
)
Expand Down
Loading