Skip to content

Latest commit

 

History

History
604 lines (418 loc) · 19.6 KB

File metadata and controls

604 lines (418 loc) · 19.6 KB

hyperstack.EnvironmentApi

All URIs are relative to https://infrahub-api.nexgencloud.com/v1

Method HTTP request Description
create_environment POST /core/environments Create environment
delete_environment DELETE /core/environments/{id} Delete environment
fetch_environment_name_availability GET /core/environments/name-availability/{name} Fetch environment name availability
get_environment GET /core/environments/{id} Retrieve environment
get_environment_vm_quota GET /core/environments/{id}/vm-quota Get environment VM quota
list_environments GET /core/environments List environments
update_environment PUT /core/environments/{id} Update environment

create_environment

Environment create_environment(payload)

Create environment

Creates an environment—a container to organize your resources, including SSH key pairs, virtual machines, and volumes. To create your environment, provide your desired environment name, and region in the request body.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.create_environment import CreateEnvironment
from hyperstack.models.environment import Environment
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/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: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

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

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.EnvironmentApi(api_client)
    payload = hyperstack.CreateEnvironment() # CreateEnvironment | 

    try:
        # Create environment
        api_response = api_instance.create_environment(payload)
        print("The response of EnvironmentApi->create_environment:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling EnvironmentApi->create_environment: %s\n" % e)

Parameters

Name Type Description Notes
payload CreateEnvironment

Return type

Environment

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Environment has been created successfully -
400 Bad Request -
401 Unauthorized -
404 Not Found -
409 Conflict -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_environment

ResponseModel delete_environment(id)

Delete environment

Deletes an environment permanently. Provide the environment ID in the path to remove the specified environment.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.response_model import ResponseModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/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: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

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

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.EnvironmentApi(api_client)
    id = 56 # int | 

    try:
        # Delete environment
        api_response = api_instance.delete_environment(id)
        print("The response of EnvironmentApi->delete_environment:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling EnvironmentApi->delete_environment: %s\n" % e)

Parameters

Name Type Description Notes
id int

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The environment has been successfully deleted. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

fetch_environment_name_availability

NameAvailableModel fetch_environment_name_availability(name)

Fetch environment name availability

Check if a Environment name is available

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.name_available_model import NameAvailableModel
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/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: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

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

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.EnvironmentApi(api_client)
    name = 'name_example' # str | 

    try:
        # Fetch environment name availability
        api_response = api_instance.fetch_environment_name_availability(name)
        print("The response of EnvironmentApi->fetch_environment_name_availability:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling EnvironmentApi->fetch_environment_name_availability: %s\n" % e)

Parameters

Name Type Description Notes
name str

Return type

NameAvailableModel

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Success -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_environment

Environment get_environment(id)

Retrieve environment

Retrieves details about a specific environment. Provide the environment ID in the path and the new environment name in the request body to modify the specified environment.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.environment import Environment
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/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: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

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

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.EnvironmentApi(api_client)
    id = 56 # int | 

    try:
        # Retrieve environment
        api_response = api_instance.get_environment(id)
        print("The response of EnvironmentApi->get_environment:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling EnvironmentApi->get_environment: %s\n" % e)

Parameters

Name Type Description Notes
id int

Return type

Environment

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Environment details retrieved successfully. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_environment_vm_quota

VMQuota get_environment_vm_quota(id)

Get environment VM quota

Retrieves VM quota information for a specific environment, including current VM count, maximum VMs allowed, available VMs, and percentage used in an environment before reaching the subnet IP limit.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.vm_quota import VMQuota
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/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: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

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

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.EnvironmentApi(api_client)
    id = 56 # int | 

    try:
        # Get environment VM quota
        api_response = api_instance.get_environment_vm_quota(id)
        print("The response of EnvironmentApi->get_environment_vm_quota:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling EnvironmentApi->get_environment_vm_quota: %s\n" % e)

Parameters

Name Type Description Notes
id int

Return type

VMQuota

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 VM quota information retrieved successfully. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_environments

Environments list_environments(page=page, page_size=page_size, search=search)

List environments

Returns a list of your existing environments, providing the following details for each; environment ID, name, region, and the date and time of creation. For more information on environments, click here.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.environments import Environments
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/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: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

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

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.EnvironmentApi(api_client)
    page = 'page_example' # str | Page Number (optional)
    page_size = 'page_size_example' # str | Data Per Page (optional)
    search = 'search_example' # str | Search By ID or Name or Region (optional)

    try:
        # List environments
        api_response = api_instance.list_environments(page=page, page_size=page_size, search=search)
        print("The response of EnvironmentApi->list_environments:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling EnvironmentApi->list_environments: %s\n" % e)

Parameters

Name Type Description Notes
page str Page Number [optional]
page_size str Data Per Page [optional]
search str Search By ID or Name or Region [optional]

Return type

Environments

Authorization

apiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful retrieval of environments list. -
400 Bad Request -
401 Unauthorized -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_environment

Environment update_environment(id, payload)

Update environment

Updates the name of an existing environment. Provide the environment ID in the path and the new environment name in the request body to modify the specified environment.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.environment import Environment
from hyperstack.models.update_environment import UpdateEnvironment
from hyperstack.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://infrahub-api.nexgencloud.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = hyperstack.Configuration(
    host = "https://infrahub-api.nexgencloud.com/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: apiKey
configuration.api_key['apiKey'] = os.environ["API_KEY"]

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

# Enter a context with an instance of the API client
with hyperstack.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = hyperstack.EnvironmentApi(api_client)
    id = 56 # int | 
    payload = hyperstack.UpdateEnvironment() # UpdateEnvironment | 

    try:
        # Update environment
        api_response = api_instance.update_environment(id, payload)
        print("The response of EnvironmentApi->update_environment:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling EnvironmentApi->update_environment: %s\n" % e)

Parameters

Name Type Description Notes
id int
payload UpdateEnvironment

Return type

Environment

Authorization

apiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Environment name successfully updated. -
400 Bad Request -
401 Unauthorized -
404 Not Found -
500 Internal Server Error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]