diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index ce488ba..931e6fd 100755
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -7,26 +7,6 @@ on:
permissions:
contents: read
-# jobs:
-# build:
-# runs-on: ubuntu-latest
-# steps:
-# - name: Checkout repository
-# uses: actions/checkout@v3
-# - name: Install Node.js
-# uses: actions/setup-node@v2
-# with:
-# node-version: '16'
-# - name: Install Antora
-# run: npm i antora
-# - name: Generate Site
-# run: npx antora antora-playbook-local.yml
-# - name: Publish to GitHub Pages
-# uses: peaceiris/actions-gh-pages@v3
-# with:
-# github_token: ${{ secrets.GITHUB_TOKEN }}
-# publish_dir: ./public
-
jobs:
# Build the documentation and upload the static HTML files as an artifact.
build:
diff --git a/antora-playbook-local.yml b/antora-playbook-local.yml
deleted file mode 100755
index 1044496..0000000
--- a/antora-playbook-local.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-site:
- title: opennms.py
-content:
- sources:
- - url: .
- branches: HEAD
- start_path: docs
-ui:
- bundle:
- url: https://github.com/opennms-forge/antora-ui-opennms/releases/download/v3.1.0/ui-bundle.zip
- supplemental_files:
- - path: ui.yml
- contents: |
- static_files:
- - .nojekyll
- - index.html
- - path: .nojekyll
- - path: index.html
- contents: |
-
-asciidoc:
- attributes:
- experimental: true
-output:
- clean: true
- dir: ./public
- destinations:
- - provider: fs
- - provider: archive
diff --git a/docs/antora.yml b/docs/antora.yml
deleted file mode 100755
index 9bdc98c..0000000
--- a/docs/antora.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: opennms.py
-version: "0.0.13"
-prerelease: true
-title: OpenNMS.py
-asciidoc:
- attributes:
- full-display-version: "0.0.13"
- experimental: true
- source-language: asciidoc@
- xrefstyle: short@
- python-version: 3.9
- repo-url: "https://github.com/mmahacek/PyONMS"
-nav:
- - modules/ROOT/nav.adoc
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
deleted file mode 100755
index 0e26f64..0000000
--- a/docs/modules/ROOT/nav.adoc
+++ /dev/null
@@ -1,18 +0,0 @@
-.About
-* xref:introduction.adoc[]
-
-.Using
-* xref:using/introduction.adoc[]
-* xref:using/connecting.adoc[]
-* xref:using/support.adoc[]
-
-.Endpoints
-* xref:endpoints/alarms.adoc[]
-* xref:endpoints/business_services.adoc[]
-* xref:endpoints/events.adoc[]
-* xref:endpoints/foreign_sources.adoc[]
-* xref:endpoints/nodes.adoc[]
-* xref:endpoints/requisitions.adoc[]
-
-.Portal
-* xref:portal/introduction.adoc[]
diff --git a/docs/modules/ROOT/pages/endpoints/alarms.adoc b/docs/modules/ROOT/pages/endpoints/alarms.adoc
deleted file mode 100644
index aa93404..0000000
--- a/docs/modules/ROOT/pages/endpoints/alarms.adoc
+++ /dev/null
@@ -1,69 +0,0 @@
-
-# Alarms
-
-The Alarms endpoint provides read-only access to system alarm records.
-
-== Supported methods
-
-=== get_alarm()
-
-Get alarm by ID.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|id
-|int
-|Required
-|ID of the alarm to retrieve.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|Alarm
-|Alarm object
-|===
-
-=== get_alarms()
-
-Get all alarms in system.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|limit
-|int
-|100
-|Maximum number of alarms to return.
-Set to `0` to get all alarms.
-
-|batch_size
-|int
-|100
-|Number of alarms to get per API call.
-If batch size is less than the limit, multiple API calls will automatically be made until limit is reached.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|List[Alarm]
-|List of Alarm objects.
-|===
diff --git a/docs/modules/ROOT/pages/endpoints/business_services.adoc b/docs/modules/ROOT/pages/endpoints/business_services.adoc
deleted file mode 100644
index 325f430..0000000
--- a/docs/modules/ROOT/pages/endpoints/business_services.adoc
+++ /dev/null
@@ -1,214 +0,0 @@
-
-# Business Services
-
-The Business Services endpoint provides read and write access to Business Service Monitoring (BSM) records.
-
-== Supported methods
-
-=== get_bsm()
-
-Get business service by ID.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|id
-|int
-|Required
-|ID of the business service to retrieve.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|BusinessService
-|BusinessService object
-|===
-
-=== get_bsms()
-
-Get all business services in system.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|threads
-|int
-|10
-|Number of simultaneous threads to make API calls.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|List[BusinessService]
-|List of BusinessService objects.
-|===
-
-=== find_bsm_name()
-
-Search for a business service by name.
-The REST API does not provide a way to search for business service objects by name.
-This method will pull each service record from the server until a matching name is found.
-If the `cache_only` parameter is `True`, only business service objects previously retrieved this session will be searched.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|name
-|str
-|Required
-|Name of the business service to retrieve.
-Must be an exact, case-sensitive match.
-
-|cache_only
-|bool
-|False
-|If True, only search BSM objects that have previously been retrieved this session.
-If False, pull list of BSMs from the server and search for the specified `name`.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|BusinessService
-|BusinessService object
-|===
-
-=== reload_bsm_daemon()
-
-Reloads the business service daemon to apply any create, update, or delete actions.
-
-.Parameters
-[options="header, autowidth", cols="1"]
-|===
-|Description
-
-|This method does not take any parameters
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|None
-|No response is returned from this method.
-|===
-
-
-=== create_bsm()
-
-Create new business service object.
-Will return a `DuplicateEntityError` if there already is an existing business service with the same name.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|bsm
-|BusinessServiceRequest
-|Required
-|BusinessServiceRequest object.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|None
-|No response is returned from this method.
-|===
-
-=== update_bsm()
-
-Update an existing business service object.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|id
-|int
-|Required
-|ID of the business service to update.
-
-|bsm
-|BusinessServiceRequest
-|Required
-|BusinessServiceRequest object to update the specified the service with the given `id`.
-The provided object will overwrite the existing business service.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|None
-|No response is returned from this method.
-|===
-
-=== delete_bsm()
-
-Delete a business service object by ID.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|id
-|int
-|Required
-|ID of the business service to delete.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|None
-|No response is returned from this method.
-|===
diff --git a/docs/modules/ROOT/pages/endpoints/events.adoc b/docs/modules/ROOT/pages/endpoints/events.adoc
deleted file mode 100644
index 2351f3a..0000000
--- a/docs/modules/ROOT/pages/endpoints/events.adoc
+++ /dev/null
@@ -1,71 +0,0 @@
-
-# Events
-
-The Events endpoint provides read-only access to system event records.
-
-== Supported methods
-
-=== get_event()
-
-Get event by ID.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|id
-|int
-|Required
-|ID of the event to retrieve.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|Event
-|Event object
-|===
-
-=== get_events()
-
-Get all events in system.
-
-WARNING: Do not use this with a limit of `0` as you probably have a lot of events in your server.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|limit
-|int
-|100
-|Maximum number of events to return.
-Set to `0` to get all events.
-
-|batch_size
-|int
-|100
-|Number of events to get per API call.
-If batch size is less than the limit, multiple API calls will automatically be made until limit is reached.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|List[Event]
-|List of Event objects.
-|===
diff --git a/docs/modules/ROOT/pages/endpoints/foreign_sources.adoc b/docs/modules/ROOT/pages/endpoints/foreign_sources.adoc
deleted file mode 100644
index c230cbd..0000000
--- a/docs/modules/ROOT/pages/endpoints/foreign_sources.adoc
+++ /dev/null
@@ -1,71 +0,0 @@
-
-# Foreign Sources
-
-The Foreign Sources endpoint currently only provides read-only access to the detectors and policies of a requisition.
-Information regarding requisition nodes is included as part of the xref:ROOT:endpoints/requisitions.adoc[Requisition] endpoint.
-
-
-== Supported methods
-
-=== get_foreign_source()
-
-Get specific foreign source definition by name.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|name
-|str
-|Required
-|Name of foreign source definition to retrieve.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|ForeignSource
-|ForeignSource object
-|===
-
-=== get_foreign_sources()
-
-Get all foreign source definitions in system.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|limit
-|int
-|100
-|Maximum number of foreign source definitions to return.
-Set to `0` to get all foreign source definitions.
-
-|batch_size
-|int
-|100
-|Number of foreign source definitions to get per API call.
-If batch size is less than the limit, multiple API calls will automatically be made until limit is reached.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|List[ForeignSource]
-|List of ForeignSource objects.
-|===
diff --git a/docs/modules/ROOT/pages/endpoints/nodes.adoc b/docs/modules/ROOT/pages/endpoints/nodes.adoc
deleted file mode 100644
index 0392d76..0000000
--- a/docs/modules/ROOT/pages/endpoints/nodes.adoc
+++ /dev/null
@@ -1,112 +0,0 @@
-
-= Nodes
-
-The Nodes endpoint provides read-only access to nodes in inventory.
-Any changes to nodes should be made through a xref:ROOT:endpoints/requisitions.adoc[requisition].
-
-== Supported methods
-
-=== get_node()
-
-Get one node by database ID number.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|id
-|int
-|Required
-|Database ID of node to retrieve.
-
-|components
-|List[NodeComponents]
-|[NodeComponents.ALL]
-|List of <> objects.
-Defaults to include all component options.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|Node
-|Node object
-|===
-
-=== get_nodes()
-
-Get all nodes in inventory.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|components
-|List[NodeComponents]
-|[None]
-|List of <> objects.
-Defaults to include no component options.
-
-|limit
-|int
-|100
-|Maximum number of nodes to return.
-Set to `0` to get all nodes.
-
-|batch_size
-|int
-|100
-|Number of nodes to get per API call.
-If batch size is less than the limit, multiple API calls will automatically be made until limit is reached.
-
-|threads
-|int
-|10
-|Number of simultaneous threads to make API calls.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|List[Node]
-|List of Node objects.
-|===
-
-== NodeComponents
-
-By default, the node endpoints gather only basic information about the node.
-The `components` parameter takes a list of NodeComponents enum values to indicate what additional data to include for the node.
-
-.Example call for just IP and SNMP interfaces
-[source, python]
-----
-nodes = server.nodes.get_nodes(limit=0, components=[NodeComponents.IP, NodeComponents.SNMP])
-----
-
-NOTE: Each components requires an additional API call per node to retrieve data.
-
-Available components:
-
-NodeComponents.SNMP:: SnmpInterfaces.
-NodeComponents.IP:: IPInterfaces.
-NodeComponents.SERVICES:: Monitored Services.
-As services are associated with IP Interfaces, if `SERVICES` is included, all IPInterfaces will also be collected.
-NodeComponents.METADATA:: Metadata records.
-NodeComponents.HARDWARE:: Hardware Inventory.
-Currently only the default set of hardware inventory fields are supported.
-If you have customized hardware inventory collection, including this component will generate an error.
-NodeComponents.ALL:: Includes all of the above components.
diff --git a/docs/modules/ROOT/pages/endpoints/requisitions.adoc b/docs/modules/ROOT/pages/endpoints/requisitions.adoc
deleted file mode 100644
index fabc266..0000000
--- a/docs/modules/ROOT/pages/endpoints/requisitions.adoc
+++ /dev/null
@@ -1,150 +0,0 @@
-
-# Requisitions
-
-The Requisitions endpoint currently only provides read-only access to list of included nodes.
-Information regarding detectors and policies is included as part of the xref:ROOT:endpoints/foreign_sources.adoc[Foreign Sources] endpoint.
-
-
-== Supported methods
-
-=== get_requisition()
-
-Get specific requisition by name.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|name
-|str
-|Required
-|Name of requisition to retrieve.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|Requisition
-|Requisition object
-|===
-
-=== get_requisitions()
-
-Get all requisitions in system.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|limit
-|int
-|100
-|Maximum number of requisitions to return.
-Set to `0` to get all requisitions.
-
-|batch_size
-|int
-|100
-|Number of requisitions to get per API call.
-If batch size is less than the limit, multiple API calls will automatically be made until limit is reached.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|List[Requisition]
-|List of Requisition objects.
-|===
-
-=== import_requisition()
-
-Trigger a reimport of a specified requisition.
-Import and rescan of requisitions happens in the background and the API will not indicate when the import starts or stops, just if the request was received.
-
-.Parameters
-[options="header, autowidth", cols="1,1,1,2"]
-|===
-|Name
-|Type
-|Default
-|Description
-
-|name
-|str
-|Required
-|Name of requisition to reimport.
-
-|rescan
-|bool
-|False
-|If True, perform rescan of existing nodes.
-If False, skip rescan of existing nodes.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|Boolean
-|Returns True or False if request was received.
-|===
-
-=== get_requisition_active_count()
-
-Returns the number of active requisitions in the server.
-
-.Parameters
-[options="header, autowidth", cols="1"]
-|===
-|Description
-
-|This method does not take any parameters.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|int
-|Count of active requisitions.
-|===
-
-=== get_requisition_deployed_count()
-
-Returns the number of deployed requisitions in the server.
-
-.Parameters
-[options="header, autowidth", cols="1"]
-|===
-|Description
-
-|This method does not take any parameters.
-|===
-
-.Returns
-[options="header, autowidth", cols="1,2"]
-|===
-|Type
-|Description
-
-|int
-|Count of deployed requisitions.
-|===
diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc
deleted file mode 100755
index 0e4360c..0000000
--- a/docs/modules/ROOT/pages/index.adoc
+++ /dev/null
@@ -1,8 +0,0 @@
-
-[[welcome-index]]
-= {page-component-title} {page-version} Documentation
-
-
-Welcome to the {page-component-title} {page-version} documentation: information and guides to help you learn about {page-component-title} and start exploring its features.
-
-TIP: Use the left navigation bar to browse the documentation.
diff --git a/docs/modules/ROOT/pages/introduction.adoc b/docs/modules/ROOT/pages/introduction.adoc
deleted file mode 100755
index a863a4b..0000000
--- a/docs/modules/ROOT/pages/introduction.adoc
+++ /dev/null
@@ -1,6 +0,0 @@
-
-[[introduction]]
-= What is {page-component-title}?
-
-{page-component-title} is a Python library for accessing the https://docs.opennms.com/horizon/30/development/rest/rest-api.html[OpenNMS REST API].
-The goal of this project is to provide a way to interact with entities an OpenNMS server as native Python objects.
diff --git a/docs/modules/ROOT/pages/portal/introduction.adoc b/docs/modules/ROOT/pages/portal/introduction.adoc
deleted file mode 100644
index 54b9c49..0000000
--- a/docs/modules/ROOT/pages/portal/introduction.adoc
+++ /dev/null
@@ -1,15 +0,0 @@
-
-= Cloud Portal
-
-The OpenNMS Cloud Portal provides management capabilities for hosted services.
-A library for accessing the Cloud Portal API is included along site the {page-component-title} library.
-
-== Getting started
-
-A `test_portal.py` file is provided as an example of interacting with the library.
-
-Define the following environment variable to store your API key for connecting to the cloud API.
-
-* `portal_secret`
-
-NOTE: The portal endpoints are still in development, therefore documentation is limited.
diff --git a/docs/modules/ROOT/pages/using/connecting.adoc b/docs/modules/ROOT/pages/using/connecting.adoc
deleted file mode 100644
index 2dd507e..0000000
--- a/docs/modules/ROOT/pages/using/connecting.adoc
+++ /dev/null
@@ -1,31 +0,0 @@
-
-= Connecting To A Server
-
-The {page-component-title} library works by defining an instance and then making calls against the various endpoints.
-
-.Define a server instance
-[source, python]
-----
-from pyonms import PyONMS
-
-my_server = PyONMS(
- hostname='http://localhost:8980/opennms',<1>
- username='admin',<2>
- password='admin',
-)
-----
-<1> Replace with the hostname to your instance.
-<2> Ensure the credentials provided have at least `ROLE_REST`.
-
-== Performing endpoint actions
-
-From your server instance object, endpoints can be utilized as class attributes of the server instance.
-
-.Example call to retrieve nodes for the instance
-[source, python]
-----
-nodes = my_server.nodes.get_nodes()
-----
-
-NOTE: Due to the early stage of this library, full documentation is not available for the various endpoints.
-This library does use type hinting, so your IDE should provide information regarding the inputs and results for the various methods.
diff --git a/docs/modules/ROOT/pages/using/introduction.adoc b/docs/modules/ROOT/pages/using/introduction.adoc
deleted file mode 100755
index cebfac9..0000000
--- a/docs/modules/ROOT/pages/using/introduction.adoc
+++ /dev/null
@@ -1,15 +0,0 @@
-
-= Basics
-
-{page-component-title} is still in an early alpha phase.
-It is not currently packaged for deployment via `pip`.
-You can fork the {repo-url}[repository] to contribute to the project or try it in your environment.
-
-== Installing {page-component-title}
-
-{page-component-title} is not published to PyPi at this time, but it can be installed from GitHub.
-The project repo at `git+{repo-url}.git@main#egg=PyONMS` can be used either to install via `pip` or as part of your project's `requirements.txt`.
-
-== Getting started
-
-A `test_example.py` file is provided as an example of interacting with the library.
diff --git a/docs/modules/ROOT/pages/using/support.adoc b/docs/modules/ROOT/pages/using/support.adoc
deleted file mode 100644
index 18120a2..0000000
--- a/docs/modules/ROOT/pages/using/support.adoc
+++ /dev/null
@@ -1,6 +0,0 @@
-
-= Support
-
-The {page-component-title} library is not an officially supported product of The OpenNMS Group.
-The source for the library can be found at {repo-url}.
-Bugs with the library can be reported via the {repo-url}/issues[GitHub Issues] feature and usage questions can be directed to {repo-url}/discussions[GitHub Discussions].
diff --git a/external-functionapp-openapi.yaml b/external-functionapp-openapi.yaml
deleted file mode 100644
index 67d3293..0000000
--- a/external-functionapp-openapi.yaml
+++ /dev/null
@@ -1,1013 +0,0 @@
-openapi: 3.0.1
-info:
- title: Appliance Service APIs
- description: |
- Use the ReST APIs in cases requiring automation or when performing operations on a large number of entities (where repeated use of the portal becomes cumbersome)
- version: '1.0'
-servers:
- - url: 'https://portal.opennms.com/api/v1/external/'
-paths:
- '/appliance':
- get:
- tags:
- - 'Appliance'
- summary: Retrieve all appliances (paginated).
- description: getAppliances
- operationId: get-getappliances
- parameters:
- - name: orderBy
- in: query
- required: false
- schema:
- type: string
- - name: limit
- in: query
- required: false
- schema:
- type: number
- - name: offset
- in: query
- required: false
- schema:
- type: number
- - name: sort
- in: query
- required: false
- schema:
- type: string
- enum: ['ASC', 'DESC']
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- type: object
- properties:
- totalRecords:
- type: number
- pagedRecords:
- type: array
- items:
- $ref: '#/components/schemas/appliance'
- '/appliance/{id}':
- get:
- tags:
- - 'Appliance'
- summary: Retrieve appliance via ID.
- description: getAppliance
- operationId: get-getappliance
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/appliance'
- put:
- tags:
- - 'Appliance'
- summary: Update appliance via ID.
- description: updateAppliance
- operationId: put-updateappliance
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/appliance'
- responses:
- '204':
- description: 'Successfully updated the appliance.'
- '/appliance/{id}/status':
- get:
- tags:
- - 'Appliance Status'
- summary: Retrieve appliance statuses via ID.
- description: |
- getApplianceStatus
- - *connectivityState* - Indicates connection to cloud.
- - *minionStatus* - Indicates state of the Minion.
- - *onmsStatus* - Indicates Minions view of the openNMS instance.
- operationId: get-getappliancestatus
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/status'
- '/appliance-profile':
- get:
- tags:
- - 'Appliance Profile'
- summary: Retrieve all appliance profiles (paginated).
- description: getApplianceProfiles
- operationId: get-getapplianceprofiles
- parameters:
- - name: orderBy
- in: query
- required: false
- schema:
- type: string
- - name: limit
- in: query
- required: false
- schema:
- type: number
- - name: offset
- in: query
- required: false
- schema:
- type: number
- - name: sort
- in: query
- required: false
- schema:
- type: string
- enum: ['ASC', 'DESC']
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- type: object
- properties:
- totalRecords:
- type: number
- pagedRecords:
- type: array
- items:
- $ref: '#/components/schemas/applianceProfile'
- '/appliance-profile/{id}':
- get:
- tags:
- - 'Appliance Profile'
- summary: Retrieve appliance profile via ID.
- description: getApplianceProfile
- operationId: get-getapplianceprofile
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: 'string'
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/applianceProfile'
- '/appliance/{id}/configuration':
- get:
- tags:
- - 'Appliance Configuration'
- summary: Retrieve and download appliance's configuration via ID.
- description: getApplianceConfiguration
- operationId: get-getapplianceconfiguration
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/octet-stream:
- schema:
- type: string
- format: binary
- '/appliance/{id}/info':
- get:
- tags:
- - 'Appliance Info'
- summary: Retrieve appliance platform information (IP addresses, hostname) via ID.
- description: getAppliancePlatformInfoExternal
- operationId: get-getapplianceplatforminfoexternal
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/appliancePlatformInfo'
- '/instance':
- post:
- tags:
- - 'Instance'
- summary: Create instance.
- description: createInstance
- operationId: post-createinstance
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/instanceCreate'
- responses:
- '201':
- description: 'Successfully created an instance'
- content:
- text/plain:
- schema:
- type: string
- get:
- tags:
- - 'Instance'
- summary: Retrieve all instances (paginated).
- description: getInstances
- operationId: get-getinstances
- parameters:
- - name: orderBy
- in: query
- required: false
- schema:
- type: string
- - name: limit
- in: query
- required: false
- schema:
- type: number
- - name: offset
- in: query
- required: false
- schema:
- type: number
- - name: sort
- in: query
- required: false
- schema:
- type: string
- enum: ['ASC', 'DESC']
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- type: object
- properties:
- totalRecords:
- type: number
- pagedRecords:
- type: array
- items:
- $ref: '#/components/schemas/instance'
- '/instance/{id}':
- get:
- tags:
- - 'Instance'
- summary: Retrieve instance via ID.
- description: getInstance
- operationId: get-getinstance
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/instance'
- delete:
- tags:
- - 'Instance'
- summary: Delete instance via ID.
- description: deleteInstance
- operationId: delete-deleteinstance
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '204':
- description: ''
- '/subscription':
- get:
- tags:
- - 'Subscription'
- summary: Retrieve all subscriptions (paginated).
- description: getSubscriptions
- operationId: get-getSubscriptions
- parameters:
- - name: orderBy
- in: query
- required: false
- schema:
- type: string
- - name: limit
- in: query
- required: false
- schema:
- type: number
- - name: offset
- in: query
- required: false
- schema:
- type: number
- - name: sort
- in: query
- required: false
- schema:
- type: string
- enum: [ 'ASC', 'DESC' ]
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- type: object
- properties:
- totalRecords:
- type: number
- pagedRecords:
- type: array
- items:
- $ref: '#/components/schemas/subscription'
- '/subscription/{id}':
- get:
- tags:
- - 'Subscription'
- summary: Retrieve subscription via ID.
- description: getSubscription
- operationId: get-getsubscription
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/subscription'
- '/minion-profile':
- get:
- tags:
- - 'Minion Profile'
- summary: Retrieve all profiles (paginated).
- description: getMinionProfiles
- operationId: get-getminionprofiles
- parameters:
- - name: orderBy
- in: query
- required: false
- schema:
- type: string
- - name: limit
- in: query
- required: false
- schema:
- type: number
- - name: offset
- in: query
- required: false
- schema:
- type: number
- - name: sort
- in: query
- required: false
- schema:
- type: string
- enum: ['ASC', 'DESC']
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- type: object
- properties:
- totalRecords:
- type: number
- pagedRecords:
- type: array
- items:
- $ref: '#/components/schemas/minionProfile'
- '/minion-profile/{id}':
- get:
- tags:
- - 'Minion Profile'
- summary: Retrieve Minion profile via ID.
- description: getMinionProfile
- operationId: get-getminionprofile
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/minionProfile'
- '/connectivity-profile':
- get:
- tags:
- - 'Connectivity Profile'
- summary: Retrieve all connectivity profiles (paginated).
- description: getConnectivityProfiles
- operationId: get-getconnectivityprofiles
- parameters:
- - name: orderBy
- in: query
- required: false
- schema:
- type: string
- - name: limit
- in: query
- required: false
- schema:
- type: number
- - name: offset
- in: query
- required: false
- schema:
- type: number
- - name: sort
- in: query
- required: false
- schema:
- type: string
- enum: ['ASC', 'DESC']
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- type: object
- properties:
- totalRecords:
- type: number
- pagedRecords:
- type: array
- items:
- $ref: '#/components/schemas/connectivityProfile'
- post:
- tags:
- - 'Connectivity Profile'
- summary: Create a connectivity profile.
- description: createConnectivityProfile
- operationId: post-createconnectivityprofile
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/connectivityProfileCreate'
- responses:
- '201':
- description: 'Successfully created a connectivity profile.'
- content:
- text/plain:
- schema:
- type: string
- '/connectivity-profile/{id}':
- get:
- tags:
- - 'Connectivity Profile'
- summary: Retrieve connectivity profile via ID.
- description: getConnectivityProfile
- operationId: get-getconnectivityprofile
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/connectivityProfile'
- delete:
- tags:
- - 'Connectivity Profile'
- summary: Remove connectivity profile via ID.
- description: deleteConnectivityProfile
- operationId: delete-deleteconnectivityprofile
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '204':
- description: 'Successfully deleted the connectivity profile.'
- '/feature-profile':
- get:
- tags:
- - 'Feature Profile'
- summary: Retrieve all feature profiles (paginated).
- description: getFeatureProfiles
- operationId: get-getfeatureprofiles
- parameters:
- - name: orderBy
- in: query
- required: false
- schema:
- type: string
- - name: limit
- in: query
- required: false
- schema:
- type: number
- - name: offset
- in: query
- required: false
- schema:
- type: number
- - name: sort
- in: query
- required: false
- schema:
- type: string
- enum: ['ASC', 'DESC']
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- type: object
- properties:
- totalRecords:
- type: number
- pagedRecords:
- type: array
- items:
- $ref: '#/components/schemas/featureProfile'
- '/feature-profile/{id}':
- get:
- tags:
- - 'Feature Profile'
- summary: Retrieve feature profile via ID.
- description: getFeatureProfile
- operationId: get-getfeatureprofile
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/featureProfile'
- '/location':
- get:
- tags:
- - 'Location'
- summary: Retrieve all locations (paginated).
- description: getLocations
- operationId: get-getlocations
- parameters:
- - name: orderBy
- in: query
- required: false
- schema:
- type: string
- - name: limit
- in: query
- required: false
- schema:
- type: number
- - name: offset
- in: query
- required: false
- schema:
- type: number
- - name: sort
- in: query
- required: false
- schema:
- type: string
- enum: ['ASC', 'DESC']
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- type: object
- properties:
- totalRecords:
- type: number
- pagedRecords:
- type: array
- items:
- $ref: '#/components/schemas/location'
- post:
- tags:
- - 'Location'
- summary: Create a location.
- description: createLocation
- operationId: post-createlocation
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/locationCreate'
- responses:
- '201':
- description: 'Successfully created a location.'
- content:
- text/plain:
- schema:
- type: string
- '/location/{id}':
- get:
- tags:
- - 'Location'
- summary: Retrieve location via ID.
- description: getLocation
- operationId: get-getlocation
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '200':
- description: ''
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/location'
- put:
- tags:
- - 'Location'
- summary: Update location via ID.
- description: updateLocation
- operationId: put-updatelocation
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- requestBody:
- required: true
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/location'
- responses:
- '204':
- description: 'Successfully updated the location.'
- delete:
- tags:
- - 'Location'
- summary: Remove location via ID.
- description: deleteLocation
- operationId: delete-deletelocation
- parameters:
- - name: id
- in: path
- required: true
- schema:
- type: string
- responses:
- '204':
- description: 'Successfully deleted the location.'
-components:
- schemas:
- appliance:
- required:
- - label
- type: object
- properties:
- id:
- type: string
- format: UUID
- readOnly: true
- label:
- type: string
- type:
- type: string
- enum: ['HARDWARE' , 'VIRTUAL']
- readOnly: true
- geoLocationLabel:
- type: string
- latitude:
- type: number
- longitude:
- type: number
- applianceProfileId:
- type: string
- format: UUID
- minion:
- $ref: '#/components/schemas/minion'
- subscriptionId:
- type: string
- format: UUID
- applianceProfile:
- required:
- - name
- type: object
- properties:
- id:
- type: string
- format: UUID
- readOnly: true
- description: Automatically generated backend value.
- example: 08a4abca-ac1b-4424-8881-9ffde851e308
- name:
- type: string
- subscription:
- required:
- - count
- - expiry
- - state
- type: object
- properties:
- id:
- type: string
- format: UUID
- readOnly: true
- example: 08a4abca-ac1b-4424-8881-9ffde851e308
- count:
- type: number
- expiry:
- type: string
- state:
- type: string
- location:
- required:
- - name
- - onmsInstanceId
- - connectivityProfileId
- type: object
- properties:
- id:
- type: string
- format: UUID
- readOnly: true
- description: Automatically generated backend value.
- example: 08a4abca-ac1b-4424-8881-9ffde851e308
- name:
- type: string
- onmsInstanceId:
- type: string
- format: UUID
- example: 9d6d1226-35f7-43a1-b2b7-852b78dbc220
- minionFeatureProfileId:
- type: string
- format: UUID
- example: 7f01217c-d7eb-4e55-b7b6-7e151abe9764
- connectivityProfileId:
- type: string
- format: UUID
- example: edb60e4c-eead-477a-ad9a-6f04e113c80c
- locationCreate:
- required:
- - name
- - onmsInstanceId
- - connectivityProfileId
- type: object
- properties:
- name:
- type: string
- onmsInstanceId:
- type: string
- format: UUID
- example: 9d6d1226-35f7-43a1-b2b7-852b78dbc220
- minionFeatureProfileId:
- type: string
- format: UUID
- example: 7f01217c-d7eb-4e55-b7b6-7e151abe9764
- connectivityProfileId:
- type: string
- format: UUID
- example: edb60e4c-eead-477a-ad9a-6f04e113c80c
- minion:
- type: object
- properties:
- locationId:
- type: string
- format: UUID
- example: 6a75a1ef-b5ff-4733-a9d1-81c82b951865
- minionProfileId:
- type: string
- format: UUID
- example: b426d422-6a51-4e79-8d9c-43810f83c1cb
- status:
- type: object
- properties:
- status:
- type: object
- properties:
- connectivityState:
- type: string
- description: Indicates connection to cloud.
- minionStatus:
- type: string
- description: Indicates state of the Minion.
- enum: ['UP' , 'DOWN' , 'GRACE_PERIOD' , 'UNKNOWN']
- onmsStatus:
- type: string
- description: Indicates Minion's view of the openNMS instance.
- enum: ['UP' , 'DOWN' , 'GRACE_PERIOD' , 'UNKNOWN']
- connectivityProfile:
- type: object
- properties:
- id:
- type: string
- format: UUID
- readOnly: true
- example: 08a4abca-ac1b-4424-8881-9ffde851e308
- onmsInstance:
- readOnly: true
- allOf:
- - $ref: '#/components/schemas/instance'
- name:
- type: string
- connectivityProfileCreate:
- required:
- - name
- - onmsInstanceId
- - httpConfig
- - brokerConfig
- type: object
- properties:
- name:
- type: string
- onmsInstanceId:
- type: string
- format: UUID
- example: 9d6d1226-35f7-43a1-b2b7-852b78dbc220
- httpConfig:
- allOf:
- - $ref: '#/components/schemas/httpConfig'
- brokerConfig:
- oneOf:
- - $ref: '#/components/schemas/brokerJms'
- - $ref: '#/components/schemas/brokerKafka'
- httpConfig:
- required:
- - url
- - user
- - password
- type: object
- properties:
- url:
- type: string
- user:
- type: string
- password:
- type: string
- brokerJms:
- allOf:
- - $ref: '#/components/schemas/brokerConfig'
- - type: object
- required:
- - url
- - user
- - password
- properties:
- url:
- type: string
- user:
- type: string
- password:
- type: string
- brokerKafka:
- allOf:
- - $ref: '#/components/schemas/brokerConfig'
- - type: object
- required:
- - bootstrapServers
- properties:
- bootstrapServers:
- type: string
- brokerConfig:
- required:
- - type
- type: object
- properties:
- type:
- type: string
- description: Indicates type of the broker.
- enum: [ 'JMS' , 'KAFKA' ]
- featureProfile:
- type: object
- properties:
- id:
- type: string
- format: UUID
- readOnly: true
- example: 08a4abca-ac1b-4424-8881-9ffde851e308
- name:
- type: string
- onmsInstance:
- readOnly: true
- allOf:
- - $ref: '#/components/schemas/instance'
- instance:
- type: object
- properties:
- id:
- type: string
- format: UUID
- example: 08a4abca-ac1b-4424-8881-9ffde851e308
- name:
- type: string
- readOnly: true
- instanceCreate:
- required:
- - name
- type: object
- properties:
- name:
- type: string
- readOnly: true
- minionProfile:
- required:
- - processEnvConfigId
- type: object
- properties:
- id:
- type: string
- format: UUID
- readOnly: true
- example: 08a4abca-ac1b-4424-8881-9ffde851e308
- name:
- type: string
- processEnvConfigId:
- type: string
- format: UUID
- example: 08a4abca-ac1b-4424-8881-9ffde851e308
- appliancePlatformInfo:
- type: object
- properties:
- hostname:
- type: string
- readOnly: true
- ipInfo:
- type: object
- additionalProperties:
- type: object
- properties:
- ipAddresses:
- type: array
- items:
- type: string
- interfaceName:
- type: string
- securitySchemes:
- apiKeyHeader:
- type: apiKey
- name: X-API-Key
- in: header
-security:
- - apiKeyHeader: []
diff --git a/pyonms/portal/__init__.py b/pyonms/portal/__init__.py
deleted file mode 100644
index 588d137..0000000
--- a/pyonms/portal/__init__.py
+++ /dev/null
@@ -1,201 +0,0 @@
-# portal.__init__.py
-
-from typing import List, Optional
-
-import requests
-from tqdm import tqdm
-
-from pyonms.models.exceptions import DuplicateEntityError
-from pyonms.portal.models import (
- PortalAppliance,
- PortalApplianceProfile,
- PortalApplianceStatus,
- PortalConnectivityProfile,
- PortalConnectivityProfileCreate,
- PortalFeatureProfile,
- PortalInstance,
- PortalInstanceCreate,
- PortalLocation,
- PortalLocationCreate,
- PortalMinion,
- PortalSubscription,
-)
-
-
-class Portal:
- def __init__(self, secret: str):
- """OpenNMS Cloud Portal
- Attributes:
- secret (str): API Key
- Returns:
- `Portal` object
- """
- self.hostname = "https://portal.opennms.com/api/v1/external/"
- self.base_v1 = self.hostname
- self.secret = secret
- self.headers = {"Accept": "application/json", "X-API-Key": secret}
-
- def __get_batch(
- self,
- url: str,
- endpoint: str,
- limit: int = 0,
- batch_size: int = 100,
- params: dict = {},
- ) -> List[dict]:
- with tqdm(total=limit, unit="record") as pbar:
- result = []
- params["offset"] = 0
- if limit > batch_size:
- params["limit"] = batch_size
- else:
- params["limit"] = limit
- records = self._get(uri=url, params=params, endpoint=endpoint)
- if records.get(endpoint, [None]) == [None]:
- return [None]
- if limit == 0 or records["totalCount"] < limit:
- target_count = records["totalCount"]
- pbar.total = target_count
- else:
- target_count = limit
- while params["offset"] < target_count:
- for record in records[endpoint]:
- result.append(record)
- params["offset"] += 1
- pbar.update(1)
- if params["offset"] >= target_count:
- return result
- records = self._get(uri=url, params=params, endpoint=endpoint)
- return result
-
- def _get(self, uri: str, headers: dict = {}, params: dict = {}) -> dict:
- if not headers:
- headers = self.headers
- response = requests.get(uri, headers=headers, params=params)
- if response.status_code == 200:
- if "was not found" not in response.text:
- return response.json()
- return {}
-
- def _post(
- self,
- uri: str,
- headers: dict = {},
- json: dict = None,
- params: dict = {},
- ) -> dict:
- if not headers:
- headers = self.headers
- if json:
- response = requests.post(uri, headers=headers, json=json, params=params)
- else:
- response = requests.post(uri, headers=headers)
- if response.status_code in [409]:
- raise DuplicateEntityError(name=json["name"], model="PortalInstance")
- return response.text
-
- def _put(
- self, uri: str, json: dict, headers: dict = {}, params: dict = {}
- ) -> requests.Response:
- if not headers:
- headers = self.headers
- return requests.put(uri, headers=headers, json=json, params=params)
-
- def get_appliance(self, id: str) -> PortalAppliance:
- data = self._get(uri=f"{self.base_v1}appliance/{id}")
- if data:
- return PortalAppliance(**data)
- else:
- return None
-
- def update_appliance(self, appliance: PortalAppliance) -> PortalAppliance:
- response = self._put(
- uri=f"{self.base_v1}appliance/{appliance.id}", json=appliance.to_dict()
- )
- if response.status_code in [204]:
- new_instance = self.get_appliance(id=appliance.id)
- return new_instance
-
- def get_all_appliances(self) -> List[Optional[PortalAppliance]]:
- appliances = []
- data = self._get(uri=f"{self.base_v1}appliance")
- for appliance in data["pagedRecords"]:
- appliances.append(PortalAppliance(**appliance))
- return appliances
-
- def get_appliance_status(self, appliance: PortalAppliance) -> PortalApplianceStatus:
- data = self._get(uri=f"{self.base_v1}appliance/{appliance.id}/status")
- return PortalApplianceStatus(**data)
-
- def get_appliance_profile(self, id: str) -> PortalApplianceProfile:
- data = self._get(uri=f"{self.base_v1}appliance-profile/{id}")
- if data:
- return PortalApplianceProfile(**data)
- else:
- return None
-
- def get_instance(self, id: str) -> PortalInstance:
- data = self._get(uri=f"{self.base_v1}instance/{id}")
- if data:
- return PortalInstance(**data)
- else:
- return None
-
- def create_instance(self, instance: PortalInstanceCreate) -> PortalInstance:
- instance_id = self._post(uri=f"{self.base_v1}instance", json=instance.to_dict())
- new_instance = self.get_instance(id=instance_id)
- return new_instance
-
- def get_subscription(self, id: str) -> PortalSubscription:
- data = self._get(uri=f"{self.base_v1}subscription/{id}")
- if data:
- return PortalSubscription(**data)
- else:
- return None
-
- def get_connectivity_profile(self, id: str) -> PortalConnectivityProfile:
- data = self._get(uri=f"{self.base_v1}connectivity-profile/{id}")
- if data:
- return PortalConnectivityProfile(**data)
- else:
- return None
-
- def create_connectivity_profile(
- self, connectivity_profile: PortalConnectivityProfileCreate
- ) -> PortalConnectivityProfile:
- instance_id = self._post(
- uri=f"{self.base_v1}connectivity-profile",
- json=connectivity_profile.to_dict(),
- )
- new_instance = self.get_connectivity_profile(id=instance_id)
- return new_instance
-
- def get_feature_profile(self, id: str) -> PortalFeatureProfile:
- data = self._get(uri=f"{self.base_v1}feature-profile/{id}")
- if data:
- return PortalFeatureProfile(**data)
- else:
- return None
-
- def get_location(self, id: str) -> PortalLocation:
- data = self._get(uri=f"{self.base_v1}location/{id}")
- if data:
- location = PortalLocation(**data)
- if isinstance(location.onmsInstanceId, str):
- location.onmsInstanceId = self.get_instance(location.onmsInstanceId)
- if isinstance(location.minionFeatureProfileId, str):
- location.minionFeatureProfileId = self.get_feature_profile(
- location.minionFeatureProfileId
- )
- if isinstance(location.connectivityProfileId, str):
- location.connectivityProfileId = self.get_connectivity_profile(
- location.connectivityProfileId
- )
- return location
- else:
- return None
-
- def create_location(self, location: PortalLocationCreate) -> PortalLocation:
- instance_id = self._post(uri=f"{self.base_v1}location", json=location.to_dict())
- new_instance = self.get_location(id=instance_id)
- return new_instance
diff --git a/pyonms/portal/models.py b/pyonms/portal/models.py
deleted file mode 100644
index fb93d5b..0000000
--- a/pyonms/portal/models.py
+++ /dev/null
@@ -1,270 +0,0 @@
-# portal.models.py
-
-from dataclasses import dataclass, field
-from datetime import datetime
-from typing import List, Optional, Union
-
-from pyonms.models.exceptions import InvalidValueError
-
-from pyonms.utils import convert_time
-
-APPLIANCE_TYPE = ["HARDWARE", "VIRTUAL"]
-BROKER_TYPE = ["JMS", "KAFKA"]
-MINION_STATUS = ["UP", "DOWN", "GRACE_PERIOD", "UNKNOWN"]
-ONMS_STATUS = ["UP", "DOWN", "GRACE_PERIOD", "UNKNOWN"]
-
-
-@dataclass
-class PortalBrokerConfig:
- type: str
-
- def __post_init__(self):
- if self.type not in BROKER_TYPE:
- raise InvalidValueError(
- name="brokerType", value=self.type, valid=BROKER_TYPE
- )
-
-
-@dataclass
-class PortalBrokerKafka(PortalBrokerConfig):
- bootstrapServers: List[str] = field(default_factory=list)
-
- def to_dict(self) -> dict:
- payload = {"type": self.type, "bootstrapServers": self.bootstrapServers}
- return payload
-
-
-@dataclass
-class PortalBrokerJms(PortalBrokerConfig):
- url: str
- user: str
- password: str
-
- def to_dict(self) -> dict:
- payload = {
- "type": self.type,
- "url": self.url,
- "user": self.user,
- "password": self.password,
- }
- return payload
-
-
-@dataclass
-class PortalHttpConfig:
- url: str
- user: str
- password: str
-
- def to_dict(self) -> dict:
- payload = {"url": self.url, "user": self.user, "password": self.password}
- return payload
-
-
-@dataclass
-class PortalInstance:
- id: str
- name: str
-
-
-@dataclass
-class PortalInstanceCreate:
- name: str
-
- def to_dict(self) -> dict:
- payload = {"name": self.name}
- return payload
-
-
-@dataclass(repr=False)
-class PortalFeatureProfile:
- id: str
- name: str
- onmsInstance: PortalInstance
-
- def __post_init__(self):
- if isinstance(self.onmsInstance, dict):
- self.onmsInstance = PortalInstance(**self.onmsInstance)
-
- def __repr__(self):
- return f"PortalFeatureProfile(id='{self.id}', name='{self.name}', onmsInstance={self.onmsInstance.name})"
-
-
-@dataclass(repr=False)
-class PortalConnectivityProfile:
- id: str
- name: str
- onmsInstance: PortalInstance
-
- def __post_init__(self):
- if isinstance(self.onmsInstance, dict):
- self.onmsInstance = PortalInstance(**self.onmsInstance)
-
- def __repr__(self):
- return f"PortalConnectivityProfile(id='{self.id}', name='{self.name}', onmsInstance={self.onmsInstance.name})"
-
-
-@dataclass
-class PortalConnectivityProfileCreate:
- name: str
- onmsInstance: PortalInstance
- httpConfig: PortalHttpConfig
- brokerConfig: Union[PortalBrokerJms, PortalBrokerKafka]
-
- def to_dict(self) -> dict:
- payload = {
- "name": self.name,
- "httpConfig": self.httpConfig.to_dict(),
- "brokerConfig": self.brokerConfig.to_dict(),
- }
- if isinstance(self.onmsInstance, str):
- payload["onmsInstanceId"] = self.onmsInstance
- elif isinstance(self.onmsInstance, PortalInstance):
- payload["onmsInstanceId"] = self.onmsInstance.id
- return payload
-
-
-@dataclass
-class PortalLocation:
- id: str
- name: str
- onmsInstanceId: PortalInstance
- connectivityProfileId: PortalConnectivityProfile
- minionFeatureProfileId: PortalFeatureProfile = None
-
-
-@dataclass
-class PortalLocationCreate:
- name: str
- onmsInstance: PortalInstance
- connectivityProfile: PortalConnectivityProfile
- minionFeatureProfile: PortalFeatureProfile = None
-
- def to_dict(self) -> dict:
- payload = {"name": self.name}
- if isinstance(self.onmsInstance, str):
- payload["onmsInstanceId"] = self.onmsInstance
- elif isinstance(self.onmsInstance, PortalInstance):
- payload["onmsInstanceId"] = self.onmsInstance.id
- if isinstance(self.connectivityProfile, str):
- payload["connectivityProfileId"] = self.connectivityProfile
- elif isinstance(self.connectivityProfile, PortalConnectivityProfile):
- payload["connectivityProfileId"] = self.connectivityProfile.id
- if self.minionFeatureProfile:
- if isinstance(self.minionFeatureProfile, str):
- payload["minionFeatureProfileId"] = self.minionFeatureProfile
- elif isinstance(self.minionFeatureProfile, PortalFeatureProfile):
- payload["minionFeatureProfileID"] = self.minionFeatureProfile.id
- return payload
-
-
-@dataclass
-class PortalMinionProfile:
- id: str
- name: str
- processEnvConfigId: str
-
-
-@dataclass
-class PortalMinion:
- locationId: Union[str, PortalLocation]
- minionProfileId: Optional[Union[str, PortalMinionProfile]] = None
-
- def to_dict(self) -> dict:
- payload = {}
- if isinstance(self.locationId, str):
- payload["locationId"] = self.locationId
- elif isinstance(self.locationId, PortalLocation):
- payload["locationId"] = self.locationId.id
- if isinstance(self.minionProfileId, str):
- payload["minionProfileId"] = self.minionProfileId
- elif isinstance(self.minionProfileId, PortalMinionProfile):
- payload["minionProfileId"] = self.minionProfileId.id
- return payload
-
-
-@dataclass
-class PortalSubscription:
- id: str
- count: int
- expiry: datetime
- state: str
-
- def __post_init__(self):
- if isinstance(self.expiry, int):
- self.expiry = convert_time(self.expiry)
-
-
-@dataclass(repr=False)
-class PortalAppliance:
- id: str
- label: str
- type: str
- applianceProfileId: str
- minion: PortalMinion
- subscriptionId: PortalSubscription
- geoLocationLabel: str = None
- latitude: float = None
- longitude: float = None
-
- def __post_init__(self):
- if self.type not in APPLIANCE_TYPE:
- raise InvalidValueError(name="type", value=self.type, valid=APPLIANCE_TYPE)
- if isinstance(self.minion, dict):
- self.minion = PortalMinion(**self.minion)
-
- def __repr__(self):
- return f"PortalAppliance(label={self.label}, id={self.id}"
-
- def to_dict(self) -> dict:
- payload = {
- "id": self.id,
- "label": self.label,
- "type": self.type,
- "geoLocationLabel": self.geoLocationLabel,
- "latitude": self.latitude,
- "longitude": self.longitude,
- "applianceProfileId": self.applianceProfileId,
- "minion": self.minion.to_dict(),
- "subscriptionId": self.subscriptionId,
- }
- return payload
-
-
-@dataclass
-class PortalApplianceProfile:
- id: str
- name: str
-
-
-@dataclass
-class PortalApplianceStatus:
- connected: bool
- minionStatus: str
- onmsStatus: str
-
- def __post_init__(self):
- if self.minionStatus not in MINION_STATUS:
- raise InvalidValueError(
- name="minionStatus", value=self.minionStatus, valid=MINION_STATUS
- )
- if self.onmsStatus not in ONMS_STATUS:
- raise InvalidValueError(
- name="onmsStatus", value=self.onmsStatus, valid=ONMS_STATUS
- )
-
-
-@dataclass
-class PortalIpInfo:
- interfaceName: str
- ipAddresses: list = field(default_factory=list)
-
-
-@dataclass
-class PortalAppliancePlatformInfo:
- hostname: str
- ipInfo: PortalIpInfo
-
- def __post_init__(self):
- if isinstance(self.ipInfo, dict):
- self.ipInfo = PortalIpInfo(**self.ipInfo)