createCloudAccount
CoreStack allows to onboard AWS cloud account using two different authentication protocols - Access Key & Assume Role. Access key being the default and widely used authentication protocol, Assume Role option is more secure as suggested by AWS. This method allows onboarding of Cloud Account using Access Key. Details on the Access Key can be found in the link https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html. Use method 'createCloudAccountAssumeRole' for onboarding cloud account in CoreStack using Assume Role.
/v1/{tenant_id}/cloud_accounts
Usage and SDK Samples
curl -X POST -H "X-Auth-Token: [[apiKey]]" -H "X-Auth-User: [[apiKey]]" "https://localhost/v1/{tenant_id}/cloud_accounts"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CloudAccountsApi;
import java.io.File;
import java.util.*;
public class CloudAccountsApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: auth_token
ApiKeyAuth auth_token = (ApiKeyAuth) defaultClient.getAuthentication("auth_token");
auth_token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//auth_token.setApiKeyPrefix("Token");
// Configure API key authorization: auth_user
ApiKeyAuth auth_user = (ApiKeyAuth) defaultClient.getAuthentication("auth_user");
auth_user.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//auth_user.setApiKeyPrefix("Token");
CloudAccountsApi apiInstance = new CloudAccountsApi();
String tenantId = tenantId_example; // String | Specify the tenant id to create cloud account which is a unique id can be retrieved using the list tenant api.
CloudAccountCreateRequest cloudAccountCreateRequest = ; // CloudAccountCreateRequest |
try {
CloudAccountCreateResponse result = apiInstance.createCloudAccount(tenantId, cloudAccountCreateRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CloudAccountsApi#createCloudAccount");
e.printStackTrace();
}
}
}
import io.swagger.client.api.CloudAccountsApi;
public class CloudAccountsApiExample {
public static void main(String[] args) {
CloudAccountsApi apiInstance = new CloudAccountsApi();
String tenantId = tenantId_example; // String | Specify the tenant id to create cloud account which is a unique id can be retrieved using the list tenant api.
CloudAccountCreateRequest cloudAccountCreateRequest = ; // CloudAccountCreateRequest |
try {
CloudAccountCreateResponse result = apiInstance.createCloudAccount(tenantId, cloudAccountCreateRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CloudAccountsApi#createCloudAccount");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: auth_token)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"X-Auth-Token"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"X-Auth-Token"];
// Configure API key authorization: (authentication scheme: auth_user)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"X-Auth-User"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"X-Auth-User"];
String *tenantId = tenantId_example; // Specify the tenant id to create cloud account which is a unique id can be retrieved using the list tenant api.
CloudAccountCreateRequest *cloudAccountCreateRequest = ; //
CloudAccountsApi *apiInstance = [[CloudAccountsApi alloc] init];
[apiInstance createCloudAccountWith:tenantId
cloudAccountCreateRequest:cloudAccountCreateRequest
completionHandler: ^(CloudAccountCreateResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var CorestackExternalApi = require('corestack_external_api');
var defaultClient = CorestackExternalApi.ApiClient.instance;
// Configure API key authorization: auth_token
var auth_token = defaultClient.authentications['auth_token'];
auth_token.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//auth_token.apiKeyPrefix['X-Auth-Token'] = "Token"
// Configure API key authorization: auth_user
var auth_user = defaultClient.authentications['auth_user'];
auth_user.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//auth_user.apiKeyPrefix['X-Auth-User'] = "Token"
var api = new CorestackExternalApi.CloudAccountsApi()
var tenantId = tenantId_example; // {String} Specify the tenant id to create cloud account which is a unique id can be retrieved using the list tenant api.
var cloudAccountCreateRequest = ; // {CloudAccountCreateRequest}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createCloudAccount(tenantId, cloudAccountCreateRequest, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class createCloudAccountExample
{
public void main()
{
// Configure API key authorization: auth_token
Configuration.Default.ApiKey.Add("X-Auth-Token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("X-Auth-Token", "Bearer");
// Configure API key authorization: auth_user
Configuration.Default.ApiKey.Add("X-Auth-User", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("X-Auth-User", "Bearer");
var apiInstance = new CloudAccountsApi();
var tenantId = tenantId_example; // String | Specify the tenant id to create cloud account which is a unique id can be retrieved using the list tenant api.
var cloudAccountCreateRequest = new CloudAccountCreateRequest(); // CloudAccountCreateRequest |
try
{
CloudAccountCreateResponse result = apiInstance.createCloudAccount(tenantId, cloudAccountCreateRequest);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling CloudAccountsApi.createCloudAccount: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: auth_token
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-Token', 'Bearer');
// Configure API key authorization: auth_user
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Auth-User', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Auth-User', 'Bearer');
$api_instance = new Swagger\Client\Api\CloudAccountsApi();
$tenantId = tenantId_example; // String | Specify the tenant id to create cloud account which is a unique id can be retrieved using the list tenant api.
$cloudAccountCreateRequest = ; // CloudAccountCreateRequest |
try {
$result = $api_instance->createCloudAccount($tenantId, $cloudAccountCreateRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CloudAccountsApi->createCloudAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CloudAccountsApi;
# Configure API key authorization: auth_token
$WWW::SwaggerClient::Configuration::api_key->{'X-Auth-Token'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'X-Auth-Token'} = "Bearer";
# Configure API key authorization: auth_user
$WWW::SwaggerClient::Configuration::api_key->{'X-Auth-User'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'X-Auth-User'} = "Bearer";
my $api_instance = WWW::SwaggerClient::CloudAccountsApi->new();
my $tenantId = tenantId_example; # String | Specify the tenant id to create cloud account which is a unique id can be retrieved using the list tenant api.
my $cloudAccountCreateRequest = WWW::SwaggerClient::Object::CloudAccountCreateRequest->new(); # CloudAccountCreateRequest |
eval {
my $result = $api_instance->createCloudAccount(tenantId => $tenantId, cloudAccountCreateRequest => $cloudAccountCreateRequest);
print Dumper($result);
};
if ($@) {
warn "Exception when calling CloudAccountsApi->createCloudAccount: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: auth_token
swagger_client.configuration.api_key['X-Auth-Token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['X-Auth-Token'] = 'Bearer'
# Configure API key authorization: auth_user
swagger_client.configuration.api_key['X-Auth-User'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['X-Auth-User'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.CloudAccountsApi()
tenantId = tenantId_example # String | Specify the tenant id to create cloud account which is a unique id can be retrieved using the list tenant api.
cloudAccountCreateRequest = # CloudAccountCreateRequest |
try:
api_response = api_instance.create_cloud_account(tenantId, cloudAccountCreateRequest)
pprint(api_response)
except ApiException as e:
print("Exception when calling CloudAccountsApi->createCloudAccount: %s\n" % e)
Parameters
Name | Description |
---|---|
tenant_id* |
String
Specify the tenant id to create cloud account which is a unique id can be retrieved using the list tenant api.
Required
|
Name | Description |
---|---|
cloudAccountCreateRequest * |