Skip to content

Commit

Permalink
Update python SDK 1.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
he2ss authored and github-actions[bot] committed Jun 18, 2024
1 parent 7aa0b3c commit 356f959
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 164 deletions.
105 changes: 4 additions & 101 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# crowdsec_service_api - 1.16.0
# crowdsec_service_api - 1.17.0


## Installation
Expand All @@ -7,105 +7,8 @@
pip install crowdsec_service_api
```

## License



## API Endpoint services

[Blocklists](./doc/Blocklists.md)

[Integrations](./doc/Integrations.md)

[Info](./doc/Info.md)

## API Endpoint models

[ApiKeyCredentials](./doc/Models.md#apikeycredentials)

[BasicAuthCredentials](./doc/Models.md#basicauthcredentials)

[BlocklistAddIPsRequest](./doc/Models.md#blocklistaddipsrequest)

[BlocklistContentStats](./doc/Models.md#blocklistcontentstats)

[BlocklistCreateRequest](./doc/Models.md#blocklistcreaterequest)

[BlocklistCreateResponse](./doc/Models.md#blocklistcreateresponse)

[BlocklistDeleteIPsRequest](./doc/Models.md#blocklistdeleteipsrequest)

[BlocklistGetResponse](./doc/Models.md#blocklistgetresponse)

[BlocklistIncludeFilters](./doc/Models.md#blocklistincludefilters)

[BlocklistResponse](./doc/Models.md#blocklistresponse)

[BlocklistShareRequest](./doc/Models.md#blocklistsharerequest)

[BlocklistSources](./doc/Models.md#blocklistsources)

[BlocklistStats](./doc/Models.md#blockliststats)

[BlocklistSubscriberEntity](./doc/Models.md#blocklistsubscriberentity)

[BlocklistSubscribersResponse](./doc/Models.md#blocklistsubscribersresponse)

[BlocklistSubscription](./doc/Models.md#blocklistsubscription)

[BlocklistSubscriptionRequest](./doc/Models.md#blocklistsubscriptionrequest)

[BlocklistSubscriptionResponse](./doc/Models.md#blocklistsubscriptionresponse)
# Usage
You can access the full usage documentation [here](https://github.com/crowdsecurity/crowdsec-service-api-sdk-python/tree/main/doc).

[BlocklistUpdateRequest](./doc/Models.md#blocklistupdaterequest)

[BlocklistUsageStats](./doc/Models.md#blocklistusagestats)

[Body_uploadBlocklistContent](./doc/Models.md#body_uploadblocklistcontent)

[CtiAs](./doc/Models.md#ctias)

[CtiBehavior](./doc/Models.md#ctibehavior)

[CtiCategory](./doc/Models.md#cticategory)

[CtiCountry](./doc/Models.md#cticountry)

[CtiIp](./doc/Models.md#ctiip)

[CtiScenario](./doc/Models.md#ctiscenario)

[EntityType](./doc/Models.md#entitytype)

[HTTPValidationError](./doc/Models.md#httpvalidationerror)

[IntegrationCreateRequest](./doc/Models.md#integrationcreaterequest)

[IntegrationCreateResponse](./doc/Models.md#integrationcreateresponse)

[IntegrationGetResponse](./doc/Models.md#integrationgetresponse)

[IntegrationType](./doc/Models.md#integrationtype)

[IntegrationUpdateRequest](./doc/Models.md#integrationupdaterequest)

[IntegrationUpdateResponse](./doc/Models.md#integrationupdateresponse)

[Links](./doc/Models.md#links)

[OutputFormat](./doc/Models.md#outputformat)

[Page_BlocklistResponse_](./doc/Models.md#page_blocklistresponse_)

[Page_IntegrationGetResponse_](./doc/Models.md#page_integrationgetresponse_)

[Permission](./doc/Models.md#permission)

[PricingTiers](./doc/Models.md#pricingtiers)

[Share](./doc/Models.md#share)

[Stats](./doc/Models.md#stats)
## License

[ValidationError](./doc/Models.md#validationerror)
```
Binary file modified crowdsec_service_api/__pycache__/base_model.cpython-311.pyc
Binary file not shown.
Binary file modified crowdsec_service_api/__pycache__/http_client.cpython-311.pyc
Binary file not shown.
19 changes: 7 additions & 12 deletions crowdsec_service_api/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: <stdin>
# timestamp: 2024-06-13T13:59:52+00:00
# timestamp: 2024-06-18T14:56:09+00:00

from __future__ import annotations

Expand Down Expand Up @@ -645,17 +645,12 @@ class BlocklistStats(BaseModelSdk):
}
),
]
usage_stats: Annotated[
Optional[BlocklistUsageStats],
Field(
{
'engines_subscribed_directly': 0,
'engines_subscribed_through_org': 0,
'engines_subscribed_through_tag': 0,
'total_subscribed_engines': 0,
}
),
]
usage_stats: Optional[BlocklistUsageStats] = {
'engines_subscribed_directly': 0,
'engines_subscribed_through_org': 0,
'engines_subscribed_through_tag': 0,
'total_subscribed_engines': 0,
}
addition_2days: Annotated[Optional[int], Field(0, title='Addition 2Days')]
addition_month: Annotated[Optional[int], Field(0, title='Addition Month')]
suppression_2days: Annotated[Optional[int], Field(0, title='Suppression 2Days')]
Expand Down
Binary file not shown.
52 changes: 14 additions & 38 deletions doc/Blocklists.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,22 @@
# Blocklists Methods
| Method | Description |
| ------ | ----------- |
| [get_blocklists](#get_blocklists) | Get multiple blocklists. Only blocklists owned by your organization,
shared with your organization or public blocklists are returned. Filters and pagination are available as query parameters. |
| [create_blocklist](#create_blocklist) | Create a new blocklist owned by your organization. The name must be unique within your organization.
The list will only be visible to your organization and organizations you shared the blocklist with. This operation is submitted to quotas |
| [get_blocklists](#get_blocklists) | Get multiple blocklists. Only blocklists owned by your organization, shared with your organization or public blocklists are returned. Filters and pagination are available as query parameters. |
| [create_blocklist](#create_blocklist) | Create a new blocklist owned by your organization. The name must be unique within your organization. The list will only be visible to your organization and organizations you shared the blocklist with. This operation is submitted to quotas |
| [get_blocklist](#get_blocklist) | Get the details of a blocklist by ID. The content of the blocklist is not returned. |
| [delete_blocklist](#delete_blocklist) | Delete a blocklist by ID. If the blocklist is shared with other organizations or it has subscriptions, the operation will fail.
If you want to force delete the blocklist, you can use the force query parameter, so the blocklists will be unshared / unsubscribed. |
| [delete_blocklist](#delete_blocklist) | Delete a blocklist by ID. If the blocklist is shared with other organizations or it has subscriptions, the operation will fail. If you want to force delete the blocklist, you can use the force query parameter, so the blocklists will be unshared / unsubscribed. |
| [update_blocklist](#update_blocklist) | Update a blocklist's details by ID. It is not possible to update the blocklist content using this operation. |
| [add_ips_to_blocklist](#add_ips_to_blocklist) | Add IPs to a blocklist. If an IP is already in the blocklist, its expiration will be updated with the new expiration. |
| [delete_ips_from_blocklist](#delete_ips_from_blocklist) | Delete IPs from a blocklist |
| [download_blocklist_content](#download_blocklist_content) | Download blocklist content as a list of ips as plain text separated by new lines. The response will include the ETag header for cache control.
If_Modified_Since and If_None_Match cache control headers are supported for conditional requests. |
| [download_blocklist_content](#download_blocklist_content) | Download blocklist content as a list of ips as plain text separated by new lines. The response will include the ETag header for cache control. If_Modified_Since and If_None_Match cache control headers are supported for conditional requests. |
| [get_blocklist_subscribers](#get_blocklist_subscribers) | Get blocklist subscribers within your organization. |
| [subscribe_blocklist](#subscribe_blocklist) | Subscribe to a blocklist with a remediation type. If the entity type is the full organization or a Tag,
all the engines belonging to the organization or the Tag will be subscribed
and new engines that will join the organization or the Tag will also be automatically subscribed.
If the subscription has been done on an organization or Tag you cannot unsubscribe individual engines.
In case of errors for some subscribers, the operation will still succeed for the entities that were successfully subscribed
and you'll have the list of errors in the operation's result.
This operation is submitted to quotas. |
| [subscribe_blocklist](#subscribe_blocklist) | Subscribe to a blocklist with a remediation type. If the entity type is the full organization or a Tag, all the engines belonging to the organization or the Tag will be subscribed and new engines that will join the organization or the Tag will also be automatically subscribed. If the subscription has been done on an organization or Tag you cannot unsubscribe individual engines. In case of errors for some subscribers, the operation will still succeed for the entities that were successfully subscribed and you'll have the list of errors in the operation's result. This operation is submitted to quotas. |
| [unsubscribe_blocklist](#unsubscribe_blocklist) | Unsubscribe from a blocklist. You cannot unsubscribe individual engines if the subscription has been done on an organization or Tag. |
| [share_blocklist](#share_blocklist) | Share a blocklist with other organizations given their IDs. The blocklist must be owned by your organization.
You can give read-only access or read-write access to the blocklist. Sharing a blocklist will not automatically subscribe the shared organizations to the blocklist. |
| [unshare_blocklist](#unshare_blocklist) | Unshare a blocklist with other organizations. If the blocklist is subscribed by the organization, the operation will fail.
Use force query parameter to unshare a blocklist even if subscriptions exists. |
| [share_blocklist](#share_blocklist) | Share a blocklist with other organizations given their IDs. The blocklist must be owned by your organization. You can give read-only access or read-write access to the blocklist. Sharing a blocklist will not automatically subscribe the shared organizations to the blocklist. |
| [unshare_blocklist](#unshare_blocklist) | Unshare a blocklist with other organizations. If the blocklist is subscribed by the organization, the operation will fail.Use force query parameter to unshare a blocklist even if subscriptions exists. |

## **get_blocklists**
### Get multiple blocklists. Only blocklists owned by your organization,
shared with your organization or public blocklists are returned. Filters and pagination are available as query parameters.
### Get multiple blocklists. Only blocklists owned by your organization, shared with your organization or public blocklists are returned. Filters and pagination are available as query parameters.
- Endpoint: `/blocklists`
- Method: `GET`

Expand Down Expand Up @@ -73,8 +60,7 @@ print(response)


## **create_blocklist**
### Create a new blocklist owned by your organization. The name must be unique within your organization.
The list will only be visible to your organization and organizations you shared the blocklist with. This operation is submitted to quotas
### Create a new blocklist owned by your organization. The name must be unique within your organization. The list will only be visible to your organization and organizations you shared the blocklist with. This operation is submitted to quotas
- Endpoint: `/blocklists`
- Method: `POST`

Expand Down Expand Up @@ -149,8 +135,7 @@ print(response)


## **delete_blocklist**
### Delete a blocklist by ID. If the blocklist is shared with other organizations or it has subscriptions, the operation will fail.
If you want to force delete the blocklist, you can use the force query parameter, so the blocklists will be unshared / unsubscribed.
### Delete a blocklist by ID. If the blocklist is shared with other organizations or it has subscriptions, the operation will fail. If you want to force delete the blocklist, you can use the force query parameter, so the blocklists will be unshared / unsubscribed.
- Endpoint: `/blocklists/{blocklist_id}`
- Method: `DELETE`

Expand Down Expand Up @@ -306,8 +291,7 @@ print(response)


## **download_blocklist_content**
### Download blocklist content as a list of ips as plain text separated by new lines. The response will include the ETag header for cache control.
If_Modified_Since and If_None_Match cache control headers are supported for conditional requests.
### Download blocklist content as a list of ips as plain text separated by new lines. The response will include the ETag header for cache control. If_Modified_Since and If_None_Match cache control headers are supported for conditional requests.
- Endpoint: `/blocklists/{blocklist_id}/download`
- Method: `GET`

Expand Down Expand Up @@ -379,13 +363,7 @@ print(response)


## **subscribe_blocklist**
### Subscribe to a blocklist with a remediation type. If the entity type is the full organization or a Tag,
all the engines belonging to the organization or the Tag will be subscribed
and new engines that will join the organization or the Tag will also be automatically subscribed.
If the subscription has been done on an organization or Tag you cannot unsubscribe individual engines.
In case of errors for some subscribers, the operation will still succeed for the entities that were successfully subscribed
and you'll have the list of errors in the operation's result.
This operation is submitted to quotas.
### Subscribe to a blocklist with a remediation type. If the entity type is the full organization or a Tag, all the engines belonging to the organization or the Tag will be subscribed and new engines that will join the organization or the Tag will also be automatically subscribed. If the subscription has been done on an organization or Tag you cannot unsubscribe individual engines. In case of errors for some subscribers, the operation will still succeed for the entities that were successfully subscribed and you'll have the list of errors in the operation's result. This operation is submitted to quotas.
- Endpoint: `/blocklists/{blocklist_id}/subscribers`
- Method: `POST`

Expand Down Expand Up @@ -458,8 +436,7 @@ print(response)


## **share_blocklist**
### Share a blocklist with other organizations given their IDs. The blocklist must be owned by your organization.
You can give read-only access or read-write access to the blocklist. Sharing a blocklist will not automatically subscribe the shared organizations to the blocklist.
### Share a blocklist with other organizations given their IDs. The blocklist must be owned by your organization. You can give read-only access or read-write access to the blocklist. Sharing a blocklist will not automatically subscribe the shared organizations to the blocklist.
- Endpoint: `/blocklists/{blocklist_id}/shares`
- Method: `POST`

Expand Down Expand Up @@ -496,8 +473,7 @@ print(response)


## **unshare_blocklist**
### Unshare a blocklist with other organizations. If the blocklist is subscribed by the organization, the operation will fail.
Use force query parameter to unshare a blocklist even if subscriptions exists.
### Unshare a blocklist with other organizations. If the blocklist is subscribed by the organization, the operation will fail.Use force query parameter to unshare a blocklist even if subscriptions exists.
- Endpoint: `/blocklists/{blocklist_id}/shares/{unshare_organization_id}`
- Method: `DELETE`

Expand Down
14 changes: 4 additions & 10 deletions doc/Integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
| Method | Description |
| ------ | ----------- |
| [get_integrations](#get_integrations) | Get integrations owned by your organization |
| [create_integration](#create_integration) | Create an integration to a firewall or remediation component, owned by your organization.
The name should be unique within the organization.
This operation is submitted to quotas. |
| [create_integration](#create_integration) | Create an integration to a firewall or remediation component, owned by your organization. The name should be unique within the organization. This operation is submitted to quotas. |
| [get_integration](#get_integration) | Get an integration by ID |
| [delete_integration](#delete_integration) | Delete the integration by ID |
| [update_integration](#update_integration) | Update the integration details |
| [get_integration_content](#get_integration_content) | Get the ips associated to the integration in plain text format. The content can be paginated to accomodate limits in firewalls. |
| [head_integration_content](#head_integration_content) | Check if the integration has content |
| [get_integration_content_stream](#get_integration_content_stream) | Get the ips associated to the integration in a format compatible with a remediation component.
As for the remediation components, you can fetch the full content with startup=true or only the changes since the last pull |
| [get_integration_content_stream](#get_integration_content_stream) | Get the ips associated to the integration in a format compatible with a remediation component. As for the remediation components, you can fetch the full content with startup=true or only the changes since the last pull |

## **get_integrations**
### Get integrations owned by your organization
Expand Down Expand Up @@ -50,9 +47,7 @@ print(response)


## **create_integration**
### Create an integration to a firewall or remediation component, owned by your organization.
The name should be unique within the organization.
This operation is submitted to quotas.
### Create an integration to a firewall or remediation component, owned by your organization. The name should be unique within the organization. This operation is submitted to quotas.
- Endpoint: `/integrations`
- Method: `POST`

Expand Down Expand Up @@ -258,8 +253,7 @@ print(response)


## **get_integration_content_stream**
### Get the ips associated to the integration in a format compatible with a remediation component.
As for the remediation components, you can fetch the full content with startup=true or only the changes since the last pull
### Get the ips associated to the integration in a format compatible with a remediation component. As for the remediation components, you can fetch the full content with startup=true or only the changes since the last pull
- Endpoint: `/integrations/{integration_id}/v1/decisions/stream`
- Method: `GET`

Expand Down
Loading

0 comments on commit 356f959

Please sign in to comment.