Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Edge Connect web interfaces under "Support > Rest API"
Many, but not all API functions have been implemented yet. Development
is underway to continue to add further functions.

As of 0.13.0+ ~62% of non-deprecated Swagger functions are covered.
As of 0.14.0+ 64% of non-deprecated Swagger functions are covered.


## Install
Expand Down
2 changes: 1 addition & 1 deletion _version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.13.0a3.dev0"
version = "0.14.0a1.dev0"
40 changes: 40 additions & 0 deletions docs/source/release-notes/0.14.0-a1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
0.14.0-a1 -- 2021-07-13
-----------------------


🚀 Features
~~~~~~~~~~~~~

Added the following Orchestrator functions from Swagger

from .orch._license
- get_nx_licensed_appliances
- get_vx_licensed_appliances
- get_portal_licensed_summary
- get_portal_licensed_appliances
- change_appliance_license
- grant_appliance_base_license
- revoke_appliance_base_license
- delete_appliance_license_token

from .orch._wan_next_hop_health
- get_wan_next_hop_health_config


# Custom certs introduced in Orchestrator 9.0.4+ and Edge Connect 9+

from .orch._custom_certs
- get_custom_certs
- update_custom_certs
- delete_custom_cert
- get_custom_certs_enabled
- set_custom_certs_enabled
- check_custom_certs_orchestrator_to_portal
- check_custom_certs_appliances_to_portal
- verify_custom_cert


📚 Documentation
~~~~~~~~~~~~~~~~~~

- Updated README with Swagger coverage %
1 change: 1 addition & 0 deletions docs/source/release-notes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ All of the release notes for pyedgeconnect are organized below
==================

.. toctree::
0.14.0-a1
0.13.0-a1
21 changes: 21 additions & 0 deletions pyedgeconnect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,16 @@ def __init__(
from .orch._broadcast_cli import broadcast_cli
from .orch._built_in_policies import get_built_in_policies
from .orch._custom_appliance_tags import get_custom_appliance_tags
from .orch._custom_certs import (
check_custom_certs_appliances_to_portal,
check_custom_certs_orchestrator_to_portal,
delete_custom_cert,
get_custom_certs,
get_custom_certs_enabled,
set_custom_certs_enabled,
update_custom_certs,
verify_custom_cert,
)
from .orch._db_partition import delete_db_partition, get_db_partition
from .orch._debug_files import (
cancel_debug_file_download,
Expand Down Expand Up @@ -804,6 +814,16 @@ def __init__(
get_ip_allow_list_drops,
update_ip_allow_list,
)
from .orch._license import (
change_appliance_license,
delete_appliance_license_token,
get_nx_licensed_appliances,
get_portal_licensed_appliances,
get_portal_licensed_summary,
get_vx_licensed_appliances,
grant_appliance_base_license,
revoke_appliance_base_license,
)
from .orch._link_integrity import get_link_integrity_test_result
from .orch._location import get_location_coordinates_from_address
from .orch._logging import get_appliance_syslog_config
Expand Down Expand Up @@ -1078,6 +1098,7 @@ def __init__(
from .orch._vrrp import get_vrrp_interfaes
from .orch._vti import get_vti_interfaes
from .orch._vxoa_hostname import update_appliance_hostname
from .orch._wan_next_hop_health import get_wan_next_hop_health_config
from .orch._wccp import (
get_wccp_service_group_settings,
get_wccp_state,
Expand Down
273 changes: 273 additions & 0 deletions pyedgeconnect/orch/_custom_certs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
# MIT License
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP.
#
# customCerts : Custom CA Certificate Trust Store


def get_custom_certs(self) -> list:
"""Returns list of custom CA certificates from Orchestrator

.. list-table::
:header-rows: 1

* - Swagger Section
- Method
- Endpoint
* - customCerts
- GET
- /customCert

:return: Returns list of custom certificates in Orchestrator \n
* keyword **alias** (`str`): Alias used to identify the CA
Certificate
* keyword **key** (`str`): The CA Certificate
* keyword **lastUpdatedTimestamp** (`str`): The timestamp of the
last time the CA Certificate was updated in Orchestrator
* keyword **expiration** (`str`): CA Certificate's expiration
date
* keyword **issuer** (`str`): CA Certificate's issuer
* keyword **issuedTo** (`str`): CA Certificate's issued to
:rtype: list
"""
return self._get("/customCert")


def update_custom_certs(
self,
alias: str,
key: str,
expiration: str,
issuer: str,
issued_to: str,
last_timestamp: str = "",
) -> bool:
"""Add new or update existing custom CA certificate

.. list-table::
:header-rows: 1

* - Swagger Section
- Method
- Endpoint
* - customCerts
- POST
- /customCert

:param alias: Alias used to identify the CA Certificate
:type alias: str
:param key: The CA Certificate
:type key: str
:param expiration: CA Certificate's expiration date
:type expiration: str
:param issuer: CA Certificate's issuer
:type issuer: str
:param issued_to: CA Certificate's issued to
:type issued_to: str
:param last_timestamp: The timestamp of the last time the CA
Certificate was updated in Orchestrator
:type last_timestamp: str, optional
:return: Returns True/False based on successful call
:rtype: bool
"""
data = {
"alias": alias,
"key": key,
"lastUpdatedTimestamp": last_timestamp,
"expiration": expiration,
"issuer": issuer,
"issuedTo": issued_to,
}

return self._post(
"/customCert",
data=data,
expected_status=[204],
return_type="bool",
)


def delete_custom_cert(
self,
alias: str,
) -> bool:
"""Delete custom CA certificate

.. list-table::
:header-rows: 1

* - Swagger Section
- Method
- Endpoint
* - customCerts
- DELETE
- /customCert/{alias}

:param alias: Alias used to identify the CA Certificate
:type alias: str
:return: Returns True/False based on successful call
:rtype: bool
"""
return self._delete(
"/customCert/{}".format(alias),
expected_status=[204],
return_type="bool",
)


def get_custom_certs_enabled(self) -> dict:
"""Returns whether or not Orchestrator is currently using custom CA
certificate trust store

.. list-table::
:header-rows: 1

* - Swagger Section
- Method
- Endpoint
* - customCerts
- GET
- /customCert/enable

:return: Returns dictionary of custom certificates status \n
* keyword **enabled** (`bool`): ``True`` if custom CA
certificate trust store is in use, ``False`` if not in use
:rtype: dict
"""
return self._get("/customCert/enable")


def set_custom_certs_enabled(
self,
enabled: bool,
) -> dict:
"""Enable or disable custom CA certificate trust store

.. list-table::
:header-rows: 1

* - Swagger Section
- Method
- Endpoint
* - customCerts
- POST
- /customCert/enable

:param enabled: Set to ``True`` to enable use of custom CA
certificates trust store, ``False`` to use default certificates
trust store
:type enabled: bool
:return: Returns True/False based on successful call
:rtype: bool
"""
data = {"Enabled": enabled}

return self._post(
"/customCert/enable",
data=data,
expected_status=[204],
return_type="bool",
)


def check_custom_certs_orchestrator_to_portal(
self,
custom_certs: bool,
) -> dict:
"""Checks whether Orchestrator can connect to Portal using the
default or custom CA certificates

.. list-table::
:header-rows: 1

* - Swagger Section
- Method
- Endpoint
* - customCerts
- GET
- /customCert/orchestratorConnectivity/{custom}

:return: TBD
:rtype: TBD
"""
return self._get(
"/customCert/orchestratorConnectivity/{}".format(custom_certs)
)


def check_custom_certs_appliances_to_portal(
self,
custom_certs: bool,
) -> dict:
"""Checks whether appliances can connect to Portal and Orchestrator
using the default or custom CA certificates

.. list-table::
:header-rows: 1

* - Swagger Section
- Method
- Endpoint
* - customCerts
- GET
- /customCert/applianceConnectivity/{custom}

:return: TBD
:rtype: TBD
"""
return self._get(
"/customCert/applianceConnectivity/{}".format(custom_certs)
)


def verify_custom_cert(
self,
alias: str,
key: str,
expiration: str,
issuer: str,
issued_to: str,
last_timestamp: str = "",
) -> bool:
"""Verify the custom CA certificate

.. list-table::
:header-rows: 1

* - Swagger Section
- Method
- Endpoint
* - customCerts
- POST
- /customCert/verify

:param alias: Alias used to identify the CA Certificate
:type alias: str
:param key: The CA Certificate
:type key: str
:param expiration: CA Certificate's expiration date
:type expiration: str
:param issuer: CA Certificate's issuer
:type issuer: str
:param issued_to: CA Certificate's issued to
:type issued_to: str
:param last_timestamp: The timestamp of the last time the CA
Certificate was updated in Orchestrator
:type last_timestamp: str, optional
:return: Returns True/False based on successful call
:rtype: bool
"""
data = {
"alias": alias,
"key": key,
"lastUpdatedTimestamp": last_timestamp,
"expiration": expiration,
"issuer": issuer,
"issuedTo": issued_to,
}

return self._post(
"/customCert/verify",
data=data,
expected_status=[204],
return_type="bool",
)
Loading