mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-07 17:29:39 -06:00
feat: sns integrations from frontend (#249)
This commit is contained in:
@@ -23,6 +23,7 @@ from hatchet_sdk.clients.rest.api.github_api import GithubApi
|
||||
from hatchet_sdk.clients.rest.api.healthcheck_api import HealthcheckApi
|
||||
from hatchet_sdk.clients.rest.api.log_api import LogApi
|
||||
from hatchet_sdk.clients.rest.api.metadata_api import MetadataApi
|
||||
from hatchet_sdk.clients.rest.api.sns_api import SNSApi
|
||||
from hatchet_sdk.clients.rest.api.step_run_api import StepRunApi
|
||||
from hatchet_sdk.clients.rest.api.tenant_api import TenantApi
|
||||
from hatchet_sdk.clients.rest.api.user_api import UserApi
|
||||
@@ -54,6 +55,7 @@ from hatchet_sdk.clients.rest.models.accept_invite_request import AcceptInviteRe
|
||||
from hatchet_sdk.clients.rest.models.create_api_token_request import CreateAPITokenRequest
|
||||
from hatchet_sdk.clients.rest.models.create_api_token_response import CreateAPITokenResponse
|
||||
from hatchet_sdk.clients.rest.models.create_pull_request_from_step_run import CreatePullRequestFromStepRun
|
||||
from hatchet_sdk.clients.rest.models.create_sns_integration_request import CreateSNSIntegrationRequest
|
||||
from hatchet_sdk.clients.rest.models.create_tenant_invite_request import CreateTenantInviteRequest
|
||||
from hatchet_sdk.clients.rest.models.create_tenant_request import CreateTenantRequest
|
||||
from hatchet_sdk.clients.rest.models.event import Event
|
||||
@@ -74,6 +76,7 @@ from hatchet_sdk.clients.rest.models.link_github_repository_request import LinkG
|
||||
from hatchet_sdk.clients.rest.models.list_api_tokens_response import ListAPITokensResponse
|
||||
from hatchet_sdk.clients.rest.models.list_github_app_installations_response import ListGithubAppInstallationsResponse
|
||||
from hatchet_sdk.clients.rest.models.list_pull_requests_response import ListPullRequestsResponse
|
||||
from hatchet_sdk.clients.rest.models.list_sns_integrations import ListSNSIntegrations
|
||||
from hatchet_sdk.clients.rest.models.log_line import LogLine
|
||||
from hatchet_sdk.clients.rest.models.log_line_level import LogLineLevel
|
||||
from hatchet_sdk.clients.rest.models.log_line_list import LogLineList
|
||||
@@ -85,6 +88,7 @@ from hatchet_sdk.clients.rest.models.pull_request_state import PullRequestState
|
||||
from hatchet_sdk.clients.rest.models.reject_invite_request import RejectInviteRequest
|
||||
from hatchet_sdk.clients.rest.models.replay_event_request import ReplayEventRequest
|
||||
from hatchet_sdk.clients.rest.models.rerun_step_run_request import RerunStepRunRequest
|
||||
from hatchet_sdk.clients.rest.models.sns_integration import SNSIntegration
|
||||
from hatchet_sdk.clients.rest.models.step import Step
|
||||
from hatchet_sdk.clients.rest.models.step_run import StepRun
|
||||
from hatchet_sdk.clients.rest.models.step_run_diff import StepRunDiff
|
||||
|
||||
@@ -7,6 +7,7 @@ from hatchet_sdk.clients.rest.api.github_api import GithubApi
|
||||
from hatchet_sdk.clients.rest.api.healthcheck_api import HealthcheckApi
|
||||
from hatchet_sdk.clients.rest.api.log_api import LogApi
|
||||
from hatchet_sdk.clients.rest.api.metadata_api import MetadataApi
|
||||
from hatchet_sdk.clients.rest.api.sns_api import SNSApi
|
||||
from hatchet_sdk.clients.rest.api.step_run_api import StepRunApi
|
||||
from hatchet_sdk.clients.rest.api.tenant_api import TenantApi
|
||||
from hatchet_sdk.clients.rest.api.user_api import UserApi
|
||||
|
||||
873
python-sdk/hatchet_sdk/clients/rest/api/sns_api.py
Normal file
873
python-sdk/hatchet_sdk/clients/rest/api/sns_api.py
Normal file
@@ -0,0 +1,873 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Hatchet API
|
||||
|
||||
The Hatchet API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
import warnings
|
||||
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from pydantic import Field
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated
|
||||
from hatchet_sdk.clients.rest.models.create_sns_integration_request import CreateSNSIntegrationRequest
|
||||
from hatchet_sdk.clients.rest.models.list_sns_integrations import ListSNSIntegrations
|
||||
from hatchet_sdk.clients.rest.models.sns_integration import SNSIntegration
|
||||
|
||||
from hatchet_sdk.clients.rest.api_client import ApiClient, RequestSerialized
|
||||
from hatchet_sdk.clients.rest.api_response import ApiResponse
|
||||
from hatchet_sdk.clients.rest.rest import RESTResponseType
|
||||
|
||||
|
||||
class SNSApi:
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator
|
||||
Ref: https://openapi-generator.tech
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
def __init__(self, api_client=None) -> None:
|
||||
if api_client is None:
|
||||
api_client = ApiClient.get_default()
|
||||
self.api_client = api_client
|
||||
|
||||
|
||||
@validate_call
|
||||
def sns_create(
|
||||
self,
|
||||
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
|
||||
create_sns_integration_request: Optional[CreateSNSIntegrationRequest] = None,
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> SNSIntegration:
|
||||
"""Create SNS integration
|
||||
|
||||
Create SNS integration
|
||||
|
||||
:param tenant: The tenant id (required)
|
||||
:type tenant: str
|
||||
:param create_sns_integration_request:
|
||||
:type create_sns_integration_request: CreateSNSIntegrationRequest
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._sns_create_serialize(
|
||||
tenant=tenant,
|
||||
create_sns_integration_request=create_sns_integration_request,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'201': "SNSIntegration",
|
||||
'400': "APIErrors",
|
||||
'401': "APIErrors",
|
||||
'405': "APIErrors",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
).data
|
||||
|
||||
|
||||
@validate_call
|
||||
def sns_create_with_http_info(
|
||||
self,
|
||||
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
|
||||
create_sns_integration_request: Optional[CreateSNSIntegrationRequest] = None,
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> ApiResponse[SNSIntegration]:
|
||||
"""Create SNS integration
|
||||
|
||||
Create SNS integration
|
||||
|
||||
:param tenant: The tenant id (required)
|
||||
:type tenant: str
|
||||
:param create_sns_integration_request:
|
||||
:type create_sns_integration_request: CreateSNSIntegrationRequest
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._sns_create_serialize(
|
||||
tenant=tenant,
|
||||
create_sns_integration_request=create_sns_integration_request,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'201': "SNSIntegration",
|
||||
'400': "APIErrors",
|
||||
'401': "APIErrors",
|
||||
'405': "APIErrors",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
)
|
||||
|
||||
|
||||
@validate_call
|
||||
def sns_create_without_preload_content(
|
||||
self,
|
||||
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
|
||||
create_sns_integration_request: Optional[CreateSNSIntegrationRequest] = None,
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> RESTResponseType:
|
||||
"""Create SNS integration
|
||||
|
||||
Create SNS integration
|
||||
|
||||
:param tenant: The tenant id (required)
|
||||
:type tenant: str
|
||||
:param create_sns_integration_request:
|
||||
:type create_sns_integration_request: CreateSNSIntegrationRequest
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._sns_create_serialize(
|
||||
tenant=tenant,
|
||||
create_sns_integration_request=create_sns_integration_request,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'201': "SNSIntegration",
|
||||
'400': "APIErrors",
|
||||
'401': "APIErrors",
|
||||
'405': "APIErrors",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _sns_create_serialize(
|
||||
self,
|
||||
tenant,
|
||||
create_sns_integration_request,
|
||||
_request_auth,
|
||||
_content_type,
|
||||
_headers,
|
||||
_host_index,
|
||||
) -> RequestSerialized:
|
||||
|
||||
_host = None
|
||||
|
||||
_collection_formats: Dict[str, str] = {
|
||||
}
|
||||
|
||||
_path_params: Dict[str, str] = {}
|
||||
_query_params: List[Tuple[str, str]] = []
|
||||
_header_params: Dict[str, Optional[str]] = _headers or {}
|
||||
_form_params: List[Tuple[str, str]] = []
|
||||
_files: Dict[str, str] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
if tenant is not None:
|
||||
_path_params['tenant'] = tenant
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
if create_sns_integration_request is not None:
|
||||
_body_params = create_sns_integration_request
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'application/json'
|
||||
]
|
||||
)
|
||||
|
||||
# set the HTTP header `Content-Type`
|
||||
if _content_type:
|
||||
_header_params['Content-Type'] = _content_type
|
||||
else:
|
||||
_default_content_type = (
|
||||
self.api_client.select_header_content_type(
|
||||
[
|
||||
'application/json'
|
||||
]
|
||||
)
|
||||
)
|
||||
if _default_content_type is not None:
|
||||
_header_params['Content-Type'] = _default_content_type
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
'cookieAuth',
|
||||
'bearerAuth'
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='POST',
|
||||
resource_path='/api/v1/tenants/{tenant}/sns',
|
||||
path_params=_path_params,
|
||||
query_params=_query_params,
|
||||
header_params=_header_params,
|
||||
body=_body_params,
|
||||
post_params=_form_params,
|
||||
files=_files,
|
||||
auth_settings=_auth_settings,
|
||||
collection_formats=_collection_formats,
|
||||
_host=_host,
|
||||
_request_auth=_request_auth
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@validate_call
|
||||
def sns_delete(
|
||||
self,
|
||||
sns: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The SNS integration id")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> None:
|
||||
"""Delete SNS integration
|
||||
|
||||
Delete SNS integration
|
||||
|
||||
:param sns: The SNS integration id (required)
|
||||
:type sns: str
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._sns_delete_serialize(
|
||||
sns=sns,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'204': None,
|
||||
'400': "APIErrors",
|
||||
'401': "APIErrors",
|
||||
'405': "APIErrors",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
).data
|
||||
|
||||
|
||||
@validate_call
|
||||
def sns_delete_with_http_info(
|
||||
self,
|
||||
sns: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The SNS integration id")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> ApiResponse[None]:
|
||||
"""Delete SNS integration
|
||||
|
||||
Delete SNS integration
|
||||
|
||||
:param sns: The SNS integration id (required)
|
||||
:type sns: str
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._sns_delete_serialize(
|
||||
sns=sns,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'204': None,
|
||||
'400': "APIErrors",
|
||||
'401': "APIErrors",
|
||||
'405': "APIErrors",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
)
|
||||
|
||||
|
||||
@validate_call
|
||||
def sns_delete_without_preload_content(
|
||||
self,
|
||||
sns: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The SNS integration id")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> RESTResponseType:
|
||||
"""Delete SNS integration
|
||||
|
||||
Delete SNS integration
|
||||
|
||||
:param sns: The SNS integration id (required)
|
||||
:type sns: str
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._sns_delete_serialize(
|
||||
sns=sns,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'204': None,
|
||||
'400': "APIErrors",
|
||||
'401': "APIErrors",
|
||||
'405': "APIErrors",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _sns_delete_serialize(
|
||||
self,
|
||||
sns,
|
||||
_request_auth,
|
||||
_content_type,
|
||||
_headers,
|
||||
_host_index,
|
||||
) -> RequestSerialized:
|
||||
|
||||
_host = None
|
||||
|
||||
_collection_formats: Dict[str, str] = {
|
||||
}
|
||||
|
||||
_path_params: Dict[str, str] = {}
|
||||
_query_params: List[Tuple[str, str]] = []
|
||||
_header_params: Dict[str, Optional[str]] = _headers or {}
|
||||
_form_params: List[Tuple[str, str]] = []
|
||||
_files: Dict[str, str] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
if sns is not None:
|
||||
_path_params['sns'] = sns
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'application/json'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
'cookieAuth',
|
||||
'bearerAuth'
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='DELETE',
|
||||
resource_path='/api/v1/sns/{sns}',
|
||||
path_params=_path_params,
|
||||
query_params=_query_params,
|
||||
header_params=_header_params,
|
||||
body=_body_params,
|
||||
post_params=_form_params,
|
||||
files=_files,
|
||||
auth_settings=_auth_settings,
|
||||
collection_formats=_collection_formats,
|
||||
_host=_host,
|
||||
_request_auth=_request_auth
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@validate_call
|
||||
def sns_list(
|
||||
self,
|
||||
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> ListSNSIntegrations:
|
||||
"""List SNS integrations
|
||||
|
||||
List SNS integrations
|
||||
|
||||
:param tenant: The tenant id (required)
|
||||
:type tenant: str
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._sns_list_serialize(
|
||||
tenant=tenant,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "ListSNSIntegrations",
|
||||
'400': "APIErrors",
|
||||
'401': "APIErrors",
|
||||
'405': "APIErrors",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
).data
|
||||
|
||||
|
||||
@validate_call
|
||||
def sns_list_with_http_info(
|
||||
self,
|
||||
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> ApiResponse[ListSNSIntegrations]:
|
||||
"""List SNS integrations
|
||||
|
||||
List SNS integrations
|
||||
|
||||
:param tenant: The tenant id (required)
|
||||
:type tenant: str
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._sns_list_serialize(
|
||||
tenant=tenant,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "ListSNSIntegrations",
|
||||
'400': "APIErrors",
|
||||
'401': "APIErrors",
|
||||
'405': "APIErrors",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
response_data.read()
|
||||
return self.api_client.response_deserialize(
|
||||
response_data=response_data,
|
||||
response_types_map=_response_types_map,
|
||||
)
|
||||
|
||||
|
||||
@validate_call
|
||||
def sns_list_without_preload_content(
|
||||
self,
|
||||
tenant: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="The tenant id")],
|
||||
_request_timeout: Union[
|
||||
None,
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Tuple[
|
||||
Annotated[StrictFloat, Field(gt=0)],
|
||||
Annotated[StrictFloat, Field(gt=0)]
|
||||
]
|
||||
] = None,
|
||||
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
||||
_content_type: Optional[StrictStr] = None,
|
||||
_headers: Optional[Dict[StrictStr, Any]] = None,
|
||||
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
||||
) -> RESTResponseType:
|
||||
"""List SNS integrations
|
||||
|
||||
List SNS integrations
|
||||
|
||||
:param tenant: The tenant id (required)
|
||||
:type tenant: str
|
||||
:param _request_timeout: timeout setting for this request. If one
|
||||
number provided, it will be total request
|
||||
timeout. It can also be a pair (tuple) of
|
||||
(connection, read) timeouts.
|
||||
:type _request_timeout: int, tuple(int, int), optional
|
||||
:param _request_auth: set to override the auth_settings for an a single
|
||||
request; this effectively ignores the
|
||||
authentication in the spec for a single request.
|
||||
:type _request_auth: dict, optional
|
||||
:param _content_type: force content-type for the request.
|
||||
:type _content_type: str, Optional
|
||||
:param _headers: set to override the headers for a single
|
||||
request; this effectively ignores the headers
|
||||
in the spec for a single request.
|
||||
:type _headers: dict, optional
|
||||
:param _host_index: set to override the host_index for a single
|
||||
request; this effectively ignores the host_index
|
||||
in the spec for a single request.
|
||||
:type _host_index: int, optional
|
||||
:return: Returns the result object.
|
||||
""" # noqa: E501
|
||||
|
||||
_param = self._sns_list_serialize(
|
||||
tenant=tenant,
|
||||
_request_auth=_request_auth,
|
||||
_content_type=_content_type,
|
||||
_headers=_headers,
|
||||
_host_index=_host_index
|
||||
)
|
||||
|
||||
_response_types_map: Dict[str, Optional[str]] = {
|
||||
'200': "ListSNSIntegrations",
|
||||
'400': "APIErrors",
|
||||
'401': "APIErrors",
|
||||
'405': "APIErrors",
|
||||
}
|
||||
response_data = self.api_client.call_api(
|
||||
*_param,
|
||||
_request_timeout=_request_timeout
|
||||
)
|
||||
return response_data.response
|
||||
|
||||
|
||||
def _sns_list_serialize(
|
||||
self,
|
||||
tenant,
|
||||
_request_auth,
|
||||
_content_type,
|
||||
_headers,
|
||||
_host_index,
|
||||
) -> RequestSerialized:
|
||||
|
||||
_host = None
|
||||
|
||||
_collection_formats: Dict[str, str] = {
|
||||
}
|
||||
|
||||
_path_params: Dict[str, str] = {}
|
||||
_query_params: List[Tuple[str, str]] = []
|
||||
_header_params: Dict[str, Optional[str]] = _headers or {}
|
||||
_form_params: List[Tuple[str, str]] = []
|
||||
_files: Dict[str, str] = {}
|
||||
_body_params: Optional[bytes] = None
|
||||
|
||||
# process the path parameters
|
||||
if tenant is not None:
|
||||
_path_params['tenant'] = tenant
|
||||
# process the query parameters
|
||||
# process the header parameters
|
||||
# process the form parameters
|
||||
# process the body parameter
|
||||
|
||||
|
||||
# set the HTTP header `Accept`
|
||||
_header_params['Accept'] = self.api_client.select_header_accept(
|
||||
[
|
||||
'application/json'
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# authentication setting
|
||||
_auth_settings: List[str] = [
|
||||
'cookieAuth',
|
||||
'bearerAuth'
|
||||
]
|
||||
|
||||
return self.api_client.param_serialize(
|
||||
method='GET',
|
||||
resource_path='/api/v1/tenants/{tenant}/sns',
|
||||
path_params=_path_params,
|
||||
query_params=_query_params,
|
||||
header_params=_header_params,
|
||||
body=_body_params,
|
||||
post_params=_form_params,
|
||||
files=_files,
|
||||
auth_settings=_auth_settings,
|
||||
collection_formats=_collection_formats,
|
||||
_host=_host,
|
||||
_request_auth=_request_auth
|
||||
)
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from hatchet_sdk.clients.rest.models.accept_invite_request import AcceptInviteRe
|
||||
from hatchet_sdk.clients.rest.models.create_api_token_request import CreateAPITokenRequest
|
||||
from hatchet_sdk.clients.rest.models.create_api_token_response import CreateAPITokenResponse
|
||||
from hatchet_sdk.clients.rest.models.create_pull_request_from_step_run import CreatePullRequestFromStepRun
|
||||
from hatchet_sdk.clients.rest.models.create_sns_integration_request import CreateSNSIntegrationRequest
|
||||
from hatchet_sdk.clients.rest.models.create_tenant_invite_request import CreateTenantInviteRequest
|
||||
from hatchet_sdk.clients.rest.models.create_tenant_request import CreateTenantRequest
|
||||
from hatchet_sdk.clients.rest.models.event import Event
|
||||
@@ -45,6 +46,7 @@ from hatchet_sdk.clients.rest.models.link_github_repository_request import LinkG
|
||||
from hatchet_sdk.clients.rest.models.list_api_tokens_response import ListAPITokensResponse
|
||||
from hatchet_sdk.clients.rest.models.list_github_app_installations_response import ListGithubAppInstallationsResponse
|
||||
from hatchet_sdk.clients.rest.models.list_pull_requests_response import ListPullRequestsResponse
|
||||
from hatchet_sdk.clients.rest.models.list_sns_integrations import ListSNSIntegrations
|
||||
from hatchet_sdk.clients.rest.models.log_line import LogLine
|
||||
from hatchet_sdk.clients.rest.models.log_line_level import LogLineLevel
|
||||
from hatchet_sdk.clients.rest.models.log_line_list import LogLineList
|
||||
@@ -56,6 +58,7 @@ from hatchet_sdk.clients.rest.models.pull_request_state import PullRequestState
|
||||
from hatchet_sdk.clients.rest.models.reject_invite_request import RejectInviteRequest
|
||||
from hatchet_sdk.clients.rest.models.replay_event_request import ReplayEventRequest
|
||||
from hatchet_sdk.clients.rest.models.rerun_step_run_request import RerunStepRunRequest
|
||||
from hatchet_sdk.clients.rest.models.sns_integration import SNSIntegration
|
||||
from hatchet_sdk.clients.rest.models.step import Step
|
||||
from hatchet_sdk.clients.rest.models.step_run import StepRun
|
||||
from hatchet_sdk.clients.rest.models.step_run_diff import StepRunDiff
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Hatchet API
|
||||
|
||||
The Hatchet API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class CreateSNSIntegrationRequest(BaseModel):
|
||||
"""
|
||||
CreateSNSIntegrationRequest
|
||||
""" # noqa: E501
|
||||
topic_arn: StrictStr = Field(description="The Amazon Resource Name (ARN) of the SNS topic.", alias="topicArn")
|
||||
__properties: ClassVar[List[str]] = ["topicArn"]
|
||||
|
||||
model_config = {
|
||||
"populate_by_name": True,
|
||||
"validate_assignment": True,
|
||||
"protected_namespaces": (),
|
||||
}
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of CreateSNSIntegrationRequest from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of CreateSNSIntegrationRequest from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"topicArn": obj.get("topicArn")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Hatchet API
|
||||
|
||||
The Hatchet API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from hatchet_sdk.clients.rest.models.pagination_response import PaginationResponse
|
||||
from hatchet_sdk.clients.rest.models.sns_integration import SNSIntegration
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class ListSNSIntegrations(BaseModel):
|
||||
"""
|
||||
ListSNSIntegrations
|
||||
""" # noqa: E501
|
||||
pagination: PaginationResponse
|
||||
rows: List[SNSIntegration]
|
||||
__properties: ClassVar[List[str]] = ["pagination", "rows"]
|
||||
|
||||
model_config = {
|
||||
"populate_by_name": True,
|
||||
"validate_assignment": True,
|
||||
"protected_namespaces": (),
|
||||
}
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ListSNSIntegrations from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of pagination
|
||||
if self.pagination:
|
||||
_dict['pagination'] = self.pagination.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in rows (list)
|
||||
_items = []
|
||||
if self.rows:
|
||||
for _item in self.rows:
|
||||
if _item:
|
||||
_items.append(_item.to_dict())
|
||||
_dict['rows'] = _items
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ListSNSIntegrations from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"pagination": PaginationResponse.from_dict(obj["pagination"]) if obj.get("pagination") is not None else None,
|
||||
"rows": [SNSIntegration.from_dict(_item) for _item in obj["rows"]] if obj.get("rows") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Hatchet API
|
||||
|
||||
The Hatchet API
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, Field, StrictStr
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class SNSIntegration(BaseModel):
|
||||
"""
|
||||
SNSIntegration
|
||||
""" # noqa: E501
|
||||
metadata: APIResourceMeta
|
||||
tenant_id: StrictStr = Field(description="The unique identifier for the tenant that the SNS integration belongs to.", alias="tenantId")
|
||||
topic_arn: StrictStr = Field(description="The Amazon Resource Name (ARN) of the SNS topic.", alias="topicArn")
|
||||
ingest_url: Optional[StrictStr] = Field(default=None, description="The URL to send SNS messages to.", alias="ingestUrl")
|
||||
__properties: ClassVar[List[str]] = ["metadata", "tenantId", "topicArn", "ingestUrl"]
|
||||
|
||||
model_config = {
|
||||
"populate_by_name": True,
|
||||
"validate_assignment": True,
|
||||
"protected_namespaces": (),
|
||||
}
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of SNSIntegration from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of metadata
|
||||
if self.metadata:
|
||||
_dict['metadata'] = self.metadata.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of SNSIntegration from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"metadata": APIResourceMeta.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None,
|
||||
"tenantId": obj.get("tenantId"),
|
||||
"topicArn": obj.get("topicArn"),
|
||||
"ingestUrl": obj.get("ingestUrl")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
Reference in New Issue
Block a user