Skip to content

Latest commit

 

History

History
273 lines (179 loc) · 7.77 KB

File metadata and controls

273 lines (179 loc) · 7.77 KB

HyperstackApi.TemplateApi

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

Method HTTP request Description
createTemplate POST /core/marketplace/templates Create template
deleteTemplate DELETE /core/marketplace/templates/{id} Delete template
getTemplate GET /core/marketplace/templates/{id} Retrieve template details
listTemplates GET /core/marketplace/templates List templates
updateTemplate PUT /core/marketplace/templates/{id} Update template

createTemplate

Template createTemplate(content, description, isPublic, name)

Create template

Creates a resource template for deployment.

Example

import HyperstackApi from '@nexgencloud/hyperstack-sdk-javascript';
let defaultClient = HyperstackApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

let apiInstance = new HyperstackApi.TemplateApi();
let content = "/path/to/file"; // File | YAML file is required
let description = "description_example"; // String | description is required
let isPublic = "isPublic_example"; // String | is_public is required
let name = "name_example"; // String | name is required
apiInstance.createTemplate(content, description, isPublic, name).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
content File YAML file is required
description String description is required
isPublic String is_public is required
name String name is required

Return type

Template

Authorization

apiKey

HTTP request headers

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

deleteTemplate

ResponseModel deleteTemplate(id)

Delete template

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

Example

import HyperstackApi from '@nexgencloud/hyperstack-sdk-javascript';
let defaultClient = HyperstackApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

let apiInstance = new HyperstackApi.TemplateApi();
let id = 56; // Number | 
apiInstance.deleteTemplate(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number

Return type

ResponseModel

Authorization

apiKey

HTTP request headers

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

getTemplate

Template getTemplate(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

import HyperstackApi from '@nexgencloud/hyperstack-sdk-javascript';
let defaultClient = HyperstackApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

let apiInstance = new HyperstackApi.TemplateApi();
let id = 56; // Number | 
apiInstance.getTemplate(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number

Return type

Template

Authorization

apiKey

HTTP request headers

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

listTemplates

Templates listTemplates(opts)

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

import HyperstackApi from '@nexgencloud/hyperstack-sdk-javascript';
let defaultClient = HyperstackApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

let apiInstance = new HyperstackApi.TemplateApi();
let opts = {
  'visibility': "visibility_example" // String | Specify the `visibility` status as either `public` or `private` to filter and retrieve templates with the desired visibility.
};
apiInstance.listTemplates(opts).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
visibility String 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

updateTemplate

Template updateTemplate(id, payload)

Update template

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

Example

import HyperstackApi from '@nexgencloud/hyperstack-sdk-javascript';
let defaultClient = HyperstackApi.ApiClient.instance;
// Configure API key authorization: apiKey
let apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix = 'Token';

let apiInstance = new HyperstackApi.TemplateApi();
let id = 56; // Number | 
let payload = new HyperstackApi.UpdateTemplate(); // UpdateTemplate | 
apiInstance.updateTemplate(id, payload).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number
payload UpdateTemplate

Return type

Template

Authorization

apiKey

HTTP request headers

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