Skip to content

Commit

Permalink
✨ feat(Core): Criação de nova funcionalidade no metodo get que permit…
Browse files Browse the repository at this point in the history
…e passar querys ultilizadas na pagína de filtro
  • Loading branch information
Kaioguilherme1 committed Jul 17, 2024
1 parent 7a18ea1 commit 3bcbd89
Show file tree
Hide file tree
Showing 92 changed files with 459 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
## Unreleased

## V1.2.0 (2024-07-17)
### ✨ Features

- **Core**: Criação de nova funcionalidade no metodo get que permite passar querys ultilizadas na pagína de filtro

### 📝💡 Documentation

- **docs**: Create contributing documentation
- **netboxcli**: update documentation in code
- **netboxcli-docstrings**: add reference tags

Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,11 @@ Aqui está um checklist do que está atualmente disponível no NetboxCli e do qu
Este checklist será atualizado à medida que novas funcionalidades forem implementadas.
Agradecemos por seu interesse e paciência enquanto trabalhamos para tornar o NetboxCli mais abrangente e útil para suas necessidades de automação e gerenciamento de rede.

## 📌 Versão 1.1.7
## 📌 Versão 1.2.0

### **Adições na Versão 1.1.7**
### **Adições na Versão 1.2.0**

- **Correções de Bugs: ** Correção de bugs menores e melhorias de desempenho em todo o código.
- **Melhorias de Desempenho: ** Otimização de consultas e operações para melhorar o desempenho geral do NetboxCli.
- **Atualizações de Documentação: ** Atualizações e melhorias na documentação para refletir as mudanças mais recentes.
- **Criação de nova feature:** Criação de nova funcionalidade no metodo get que permite passar querys ultilizadas na pagína de filtro

## ✒️ Autores

Expand Down
5 changes: 5 additions & 0 deletions compile/api_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -51,6 +52,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -70,6 +72,9 @@ def get(
Get resources by search query:
>>> result = nb.{class_main}.{subclass}.get(search="query")
Get resources by filter query:
>>> result = nb.{class_main}.{subclass}.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.{class_main}.{subclass}.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/circuits/circuit_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.circuits.circuit_types.get(search="query")
Get resources by filter query:
>>> result = nb.circuits.circuit_types.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.circuits.circuit_types.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/circuits/circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.circuits.circuits.get(search="query")
Get resources by filter query:
>>> result = nb.circuits.circuits.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.circuits.circuits.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/circuits/provider_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.circuits.provider_accounts.get(search="query")
Get resources by filter query:
>>> result = nb.circuits.provider_accounts.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.circuits.provider_accounts.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/circuits/provider_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.circuits.provider_networks.get(search="query")
Get resources by filter query:
>>> result = nb.circuits.provider_networks.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.circuits.provider_networks.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/circuits/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.circuits.providers.get(search="query")
Get resources by filter query:
>>> result = nb.circuits.providers.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.circuits.providers.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/connections/cables.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.connections.cables.get(search="query")
Get resources by filter query:
>>> result = nb.connections.cables.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.connections.cables.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/connections/wireless_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.connections.wireless_links.get(search="query")
Get resources by filter query:
>>> result = nb.connections.wireless_links.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.connections.wireless_links.get()
Expand Down
8 changes: 8 additions & 0 deletions netboxcli/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -54,6 +55,7 @@ def get(
name: (str): The name of the resource to retrieve.
tags: (list): List of tags to filter resources.
search: (str): Search query to filter resources.
filter: (str): Filter query especified by the user in to filter resources.
limit: (int): Maximum number of results to return. Defaults to 1000.
Returns:
Expand Down Expand Up @@ -84,6 +86,11 @@ def get(
response = self._netbox._request(
'get', f'{self._endpoint}?q={search}&?limit={limit}'
)

if filter:
response = self._netbox._request(
'get', f'{self._endpoint}?{filter}&?limit={limit}'
)
else:
response = self._netbox._request(
'get', f'{self._endpoint}?limit={limit}'
Expand All @@ -102,6 +109,7 @@ def get(
filtered_resources.append(item)

return response

else:
return response

Expand Down
5 changes: 5 additions & 0 deletions netboxcli/customization/custom_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.customization.custom_fields.get(search="query")
Get resources by filter query:
>>> result = nb.customization.custom_fields.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.customization.custom_fields.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/customization/custom_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.customization.custom_links.get(search="query")
Get resources by filter query:
>>> result = nb.customization.custom_links.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.customization.custom_links.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/customization/export_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.customization.export_templates.get(search="query")
Get resources by filter query:
>>> result = nb.customization.export_templates.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.customization.export_templates.get()
Expand Down
5 changes: 5 additions & 0 deletions netboxcli/customization/image_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def get(
name: str = None,
tags: list = None,
search: str = None,
filter: str = None,
limit: int = 1000,
) -> dict:
"""
Expand All @@ -26,6 +27,7 @@ def get(
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
filter (str, optional): Filter query especified by the user in to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Examples:
Expand All @@ -45,6 +47,9 @@ def get(
Get resources by search query:
>>> result = nb.customization.image_attachments.get(search="query")
Get resources by filter query:
>>> result = nb.customization.image_attachments.get(filter="assigned_to_interface=True")
Get all resources:
>>> result = nb.customization.image_attachments.get()
Expand Down
Loading

0 comments on commit 3bcbd89

Please sign in to comment.