Skip to content

Latest commit

 

History

History
436 lines (302 loc) · 14 KB

File metadata and controls

436 lines (302 loc) · 14 KB

hyperstack.TemplateApi

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

Method HTTP request Description
create_template POST /core/marketplace/templates Create template
delete_template DELETE /core/marketplace/templates/{id} Delete template
get_template GET /core/marketplace/templates/{id} Retrieve template details
list_templates GET /core/marketplace/templates List templates
update_template PUT /core/marketplace/templates/{id} Update template

create_template

Template create_template(content, description, is_public, name)

Create template

Creates a resource template for deployment.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.template import Template
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.TemplateApi(api_client)
    content = None # bytearray | YAML file is required
    description = 'description_example' # str | description is required
    is_public = 'is_public_example' # str | is_public is required
    name = 'name_example' # str | name is required

    try:
        # Create template
        api_response = api_instance.create_template(content, description, is_public, name)
        print("The response of TemplateApi->create_template:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling TemplateApi->create_template: %s\n" % e)

Parameters

Name Type Description Notes
content bytearray YAML file is required
description str description is required
is_public str is_public is required
name str name is required

Return type

Template

Authorization

apiKey

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Template added successfully -
400 Bad Request -
401 Unauthorized -
500 Internal Server Error -

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

delete_template

ResponseModel delete_template(id)

Delete template

Permanently deletes a template. Supply the template ID in the path to delete the specified template.

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.TemplateApi(api_client)
    id = 56 # int | 

    try:
        # Delete template
        api_response = api_instance.delete_template(id)
        print("The response of TemplateApi->delete_template:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling TemplateApi->delete_template: %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 Template deleted 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_template

Template get_template(id)

Retrieve template details

Retrieves the resource configuration details for a specified template.Provide the template ID in the path to retrieve details for the specified template.For additional information on template configuration details,click here.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.template import Template
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.TemplateApi(api_client)
    id = 56 # int | 

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

Parameters

Name Type Description Notes
id int

Return type

Template

Authorization

apiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Template 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]

list_templates

Templates list_templates(visibility=visibility)

List templates

Returns a comprehensive list of templates, providing resource configuration details for each. Optionally, specify the visibility as public or private to retrieve templates with the desired visibility status. To learn more about the templates feature, click here.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.templates import Templates
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.TemplateApi(api_client)
    visibility = 'visibility_example' # str | Specify the `visibility` status as either `public` or `private` to filter and retrieve templates with the desired visibility. (optional)

    try:
        # List templates
        api_response = api_instance.list_templates(visibility=visibility)
        print("The response of TemplateApi->list_templates:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling TemplateApi->list_templates: %s\n" % e)

Parameters

Name Type Description Notes
visibility str Specify the `visibility` status as either `public` or `private` to filter and retrieve templates with the desired visibility. [optional]

Return type

Templates

Authorization

apiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Templates list successfully retrieved. -
400 Bad Request -
401 Unauthorized -
406 Not Acceptable -
500 Internal Server Error -

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

update_template

Template update_template(id, payload)

Update template

Updates the details of a template. Modify the template name, description and/oris_public status to change the public/private visibility of the template.

Example

  • Api Key Authentication (apiKey):
import hyperstack
from hyperstack.models.template import Template
from hyperstack.models.update_template import UpdateTemplate
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.TemplateApi(api_client)
    id = 56 # int | 
    payload = hyperstack.UpdateTemplate() # UpdateTemplate | 

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

Parameters

Name Type Description Notes
id int
payload UpdateTemplate

Return type

Template

Authorization

apiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Template updated 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]