Skip to content

Commit

Permalink
AlertManager release update
Browse files Browse the repository at this point in the history
  • Loading branch information
totvslabs committed Aug 17, 2023
1 parent c94d40c commit fe90256
Show file tree
Hide file tree
Showing 12 changed files with 449 additions and 14 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Class | Method | HTTP request | Description
*HealthCheckApi* | [**get_health_check**](docs/HealthCheckApi.md#get_health_check) | **GET** /health_check |
*NotificationsApi* | [**get_notification_log_get**](docs/NotificationsApi.md#get_notification_log_get) | **GET** /notifications/{id} |
*NotificationsApi* | [**get_notification_log_get_all**](docs/NotificationsApi.md#get_notification_log_get_all) | **GET** /notifications |
*NotificationsApi* | [**post_notification_log_resend**](docs/NotificationsApi.md#post_notification_log_resend) | **POST** /notifications/{id}/resend |
*PoliciesApi* | [**delete_policies_delete**](docs/PoliciesApi.md#delete_policies_delete) | **DELETE** /policies/{id} |
*PoliciesApi* | [**get_policies_get**](docs/PoliciesApi.md#get_policies_get) | **GET** /policies/{id} |
*PoliciesApi* | [**get_policies_get_all**](docs/PoliciesApi.md#get_policies_get_all) | **GET** /policies |
Expand All @@ -121,6 +122,7 @@ Class | Method | HTTP request | Description
## Documentation For Models

- [EventSchema](docs/EventSchema.md)
- [NotificationSchema](docs/NotificationSchema.md)
- [PaginationSchema](docs/PaginationSchema.md)
- [PolicyChannelSchema](docs/PolicyChannelSchema.md)
- [PolicySchema](docs/PolicySchema.md)
Expand Down
35 changes: 35 additions & 0 deletions docs/NotificationSchema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# NotificationSchema


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**client_uuid** | **str** | Notification Client UUID |
**created_at** | **datetime** | | [optional]
**events** | **List[str]** | List of notification events | [optional]
**first_event** | **datetime** | | [optional]
**id** | **str** | Id |
**retries** | **int** | Quantity notification retries | [optional]
**status** | **str** | Notification status |
**updated_at** | **datetime** | | [optional]

## Example

```python
from labs_alert_manager_client.models.notification_schema import NotificationSchema

# TODO update the JSON string below
json = "{}"
# create an instance of NotificationSchema from a JSON string
notification_schema_instance = NotificationSchema.from_json(json)
# print the JSON string representation of the object
print NotificationSchema.to_json()

# convert the object into a dict
notification_schema_dict = notification_schema_instance.to_dict()
# create an instance of NotificationSchema from a dict
notification_schema_form_dict = notification_schema.from_dict(notification_schema_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


82 changes: 79 additions & 3 deletions docs/NotificationsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Method | HTTP request | Description
------------- | ------------- | -------------
[**get_notification_log_get**](NotificationsApi.md#get_notification_log_get) | **GET** /notifications/{id} |
[**get_notification_log_get_all**](NotificationsApi.md#get_notification_log_get_all) | **GET** /notifications |
[**post_notification_log_resend**](NotificationsApi.md#post_notification_log_resend) | **POST** /notifications/{id}/resend |


# **get_notification_log_get**
> PolicyChannelSchema get_notification_log_get(id)
> NotificationSchema get_notification_log_get(id)


Expand All @@ -20,7 +21,7 @@ Method | HTTP request | Description
import time
import os
import labs_alert_manager_client
from labs_alert_manager_client.models.policy_channel_schema import PolicyChannelSchema
from labs_alert_manager_client.models.notification_schema import NotificationSchema
from labs_alert_manager_client.rest import ApiException
from pprint import pprint

Expand Down Expand Up @@ -65,7 +66,7 @@ Name | Type | Description | Notes

### Return type

[**PolicyChannelSchema**](PolicyChannelSchema.md)
[**NotificationSchema**](NotificationSchema.md)

### Authorization

Expand Down Expand Up @@ -154,3 +155,78 @@ This endpoint does not need any parameter.

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **post_notification_log_resend**
> NotificationSchema post_notification_log_resend(id)


### Example

* Api Key Authentication (auth_token):
```python
import time
import os
import labs_alert_manager_client
from labs_alert_manager_client.models.notification_schema import NotificationSchema
from labs_alert_manager_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = labs_alert_manager_client.Configuration(
host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: auth_token
configuration.api_key['auth_token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['auth_token'] = 'Bearer'

# Enter a context with an instance of the API client
with labs_alert_manager_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = labs_alert_manager_client.NotificationsApi(api_client)
id = 'id_example' # str |

try:
api_response = api_instance.post_notification_log_resend(id)
print("The response of NotificationsApi->post_notification_log_resend:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling NotificationsApi->post_notification_log_resend: %s\n" % e)
```



### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **str**| |

### Return type

[**NotificationSchema**](NotificationSchema.md)

### Authorization

[auth_token](../README.md#auth_token)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | A successful response | - |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

2 changes: 1 addition & 1 deletion docs/PolicySchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**channels** | **object** | List of channel notification |
**channels** | **List[str]** | List of channel notification |
**client_source** | **str** | Policy Client source |
**client_uuid** | **str** | Policy Client UUID |
**created_at** | **datetime** | | [optional]
Expand Down
1 change: 1 addition & 0 deletions labs_alert_manager_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

# import models into sdk package
from labs_alert_manager_client.models.event_schema import EventSchema
from labs_alert_manager_client.models.notification_schema import NotificationSchema
from labs_alert_manager_client.models.pagination_schema import PaginationSchema
from labs_alert_manager_client.models.policy_channel_schema import PolicyChannelSchema
from labs_alert_manager_client.models.policy_schema import PolicySchema
147 changes: 142 additions & 5 deletions labs_alert_manager_client/api/notifications_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

from pydantic import StrictStr

from labs_alert_manager_client.models.notification_schema import NotificationSchema
from labs_alert_manager_client.models.pagination_schema import PaginationSchema
from labs_alert_manager_client.models.policy_channel_schema import PolicyChannelSchema

from labs_alert_manager_client.api_client import ApiClient
from labs_alert_manager_client.api_response import ApiResponse
Expand All @@ -45,7 +45,7 @@ def __init__(self, api_client=None):
self.api_client = api_client

@validate_arguments
def get_notification_log_get(self, id : StrictStr, **kwargs) -> PolicyChannelSchema: # noqa: E501
def get_notification_log_get(self, id : StrictStr, **kwargs) -> NotificationSchema: # noqa: E501
"""get_notification_log_get # noqa: E501
This method makes a synchronous HTTP request by default. To make an
Expand All @@ -65,7 +65,7 @@ def get_notification_log_get(self, id : StrictStr, **kwargs) -> PolicyChannelSch
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: PolicyChannelSchema
:rtype: NotificationSchema
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
Expand Down Expand Up @@ -106,7 +106,7 @@ def get_notification_log_get_with_http_info(self, id : StrictStr, **kwargs) -> A
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(PolicyChannelSchema, status_code(int), headers(HTTPHeaderDict))
:rtype: tuple(NotificationSchema, status_code(int), headers(HTTPHeaderDict))
"""

_params = locals()
Expand Down Expand Up @@ -161,7 +161,7 @@ def get_notification_log_get_with_http_info(self, id : StrictStr, **kwargs) -> A
_auth_settings = ['auth_token'] # noqa: E501

_response_types_map = {
'200': "PolicyChannelSchema",
'200': "NotificationSchema",
}

return self.api_client.call_api(
Expand Down Expand Up @@ -309,3 +309,140 @@ def get_notification_log_get_all_with_http_info(self, **kwargs) -> ApiResponse:
_request_timeout=_params.get('_request_timeout'),
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))

@validate_arguments
def post_notification_log_resend(self, id : StrictStr, **kwargs) -> NotificationSchema: # noqa: E501
"""post_notification_log_resend # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.post_notification_log_resend(id, async_req=True)
>>> result = thread.get()
:param id: (required)
:type id: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
: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.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: NotificationSchema
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the post_notification_log_resend_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.post_notification_log_resend_with_http_info(id, **kwargs) # noqa: E501

@validate_arguments
def post_notification_log_resend_with_http_info(self, id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501
"""post_notification_log_resend # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.post_notification_log_resend_with_http_info(id, async_req=True)
>>> result = thread.get()
:param id: (required)
:type id: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
:param _return_http_data_only: response data instead of ApiResponse
object with status code, headers, etc
:type _return_http_data_only: bool, optional
: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.
: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
:type _content_type: string, optional: force content-type for the request
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(NotificationSchema, status_code(int), headers(HTTPHeaderDict))
"""

_params = locals()

_all_params = [
'id'
]
_all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth',
'_content_type',
'_headers'
]
)

# validate the arguments
for _key, _val in _params['kwargs'].items():
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method post_notification_log_resend" % _key
)
_params[_key] = _val
del _params['kwargs']

_collection_formats = {}

# process the path parameters
_path_params = {}
if _params['id']:
_path_params['id'] = _params['id']


# process the query parameters
_query_params = []
# process the header parameters
_header_params = dict(_params.get('_headers', {}))
# process the form parameters
_form_params = []
_files = {}
# process the body parameter
_body_params = None
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501

# authentication setting
_auth_settings = ['auth_token'] # noqa: E501

_response_types_map = {
'200': "NotificationSchema",
}

return self.api_client.call_api(
'/notifications/{id}/resend', 'POST',
_path_params,
_query_params,
_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
response_types_map=_response_types_map,
auth_settings=_auth_settings,
async_req=_params.get('async_req'),
_return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
_preload_content=_params.get('_preload_content', True),
_request_timeout=_params.get('_request_timeout'),
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
1 change: 1 addition & 0 deletions labs_alert_manager_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# import models into model package
from labs_alert_manager_client.models.event_schema import EventSchema
from labs_alert_manager_client.models.notification_schema import NotificationSchema
from labs_alert_manager_client.models.pagination_schema import PaginationSchema
from labs_alert_manager_client.models.policy_channel_schema import PolicyChannelSchema
from labs_alert_manager_client.models.policy_schema import PolicySchema
Loading

0 comments on commit fe90256

Please sign in to comment.