/empy

Client for Equinix Metal generated with openapi-generator-cli [python-nextgen]

Primary LanguagePython

empy

$ wget https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.3.0-SNAPSHOT/openapi-generator-cli-6.3.0-20230113.095040-74.jar -O oag.jar
$ java -jar oag.jar generate -g python-nextgen -i ../em/metal-python/openapi.fixed.yaml -o empy --package-name empy --git-repo-id empy --git-user-id t0mk
$ find empy -type f -name "*.py" | xargs sed -i 's/true/True/g'
$ find empy -type f -name "*.py" | xargs sed -i 's/false/False/g'

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonNextgenClientCodegen

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/t0mk/empy.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/t0mk/empy.git)

Then import the package:

import empy

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import empy

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function

import time
import empy
from empy.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.equinix.com/metal/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = empy.Configuration(
    host = "https://api.equinix.com/metal/v1"
)

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

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

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


# Enter a context with an instance of the API client
with empy.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = empy.DevicesApi(api_client)
    id = 'id_example' # str | Project UUID
    create_device_request = empy.CreateDeviceRequest() # CreateDeviceRequest | Device to create

    try:
        # Create a device
        api_response = api_instance.create_device(id, create_device_request)
        print("The response of DevicesApi->create_device:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling DevicesApi->create_device: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.equinix.com/metal/v1

Class Method HTTP request Description
DevicesApi create_device POST /projects/{id}/devices Create a device
DevicesApi delete_device DELETE /devices/{id} Delete the device
DevicesApi find_device_by_id GET /devices/{id} Retrieve a device
DevicesApi find_project_devices GET /projects/{id}/devices Retrieve all devices of a project
DevicesApi update_device PUT /devices/{id} Update the device
OrganizationsApi create_organization POST /organizations Create an organization
OrganizationsApi create_organization_project POST /organizations/{id}/projects Create a project for the organization
OrganizationsApi find_organization_projects GET /organizations/{id}/projects Retrieve all projects of an organization
OrganizationsApi find_organizations GET /organizations Retrieve all organizations
ProjectsApi create_project POST /projects Create a project
ProjectsApi delete_project DELETE /projects/{id} Delete the project
ProjectsApi find_project_by_id GET /projects/{id} Retrieve a project
ProjectsApi find_projects GET /projects Retrieve all projects
ProjectsApi update_project PUT /projects/{id} Update the project

Documentation For Models

Documentation For Authorization

x_auth_token

  • Type: API key
  • API key parameter name: X-Auth-Token
  • Location: HTTP header

Author

support@equinixmetal.com