/1.0.0/entities/{objectId}/accessControls
35.0
createEntityAccessControlGrant
Usage and SDK Samples
curl -X POST -H "Authorization: [[apiKey]]" "https://localhost/cloudapi/1.0.0/entities/{objectId}/accessControls"
import javax.ws.rs.WebApplicationException;
import com.vmware.vcloud.api.rest.client.VcdClient;
import com.vmware.vcloud.api.rest.client.VcdClientImpl;
import com.vmware.vcloud.api.rest.client.OpenApiClient;
import com.vmware.vcloud.api.rest.client.CxfClientSecurityContext;
import com.vmware.vcloud.rest.openapi.model.*;
import com.vmware.vcloud.rest.openapi.api.AccessControlsApi;
import java.io.File;
import java.util.*;
public class AccessControlsApiExample {
public static void main(String[] args) {
final VcdClient vcdClient = new VcdClientImpl("https://localhost/cloudapi/cloudapi", "35.0", CxfClientSecurityContext.getDefaultCxfClientSecurityContext());
vcdClient.setCredentials(new VcdBasicLoginCredentials(<username>, <orgname>, <password>));
final OpenApiClient openApiClient = vcdClient.getOpenApiClient();
final AccessControlsApi api = openApiClient.createProxy(AccessControlsApi.class);
/*
* AccessControlGrant |
*
*/
AccessControlGrant accessControlGrant = new AccessControlGrant();
// Set properties
try {
AccessControlGrant result = api.createEntityAccessControlGrant(objectId, accessControlGrant);
System.out.println(result);
// Print response details:
System.out.println("Response code: " + openApiClient.getLastStatus(api));
System.out.println("Rest Links: " + openApiClient.getLastLinks(api));
} catch (WebApplicationException e) {
System.err.println("Exception when calling AccessControlsApi#createEntityAccessControlGrant");
System.err.println("Error message: " + e.getMessage());
System.err.println("Vcd error code:" + api.getLastVcdError(api).getMinorErrorCode());
System.err.println();
e.printStackTrace();
}
}
}
import com.vmware.vcloud.rest.openapi.api.AccessControlsApi;
public class AccessControlsApiExample {
public static void main(String[] args) {
AccessControlsApi apiInstance = new AccessControlsApi();
String objectId = objectId_example; // String |
AccessControlGrant accessControlGrant = ; // AccessControlGrant |
try {
AccessControlGrant result = apiInstance.createEntityAccessControlGrant(objectId, accessControlGrant);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AccessControlsApi#createEntityAccessControlGrant");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: ApiKeyAuth)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"Authorization"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"Authorization"];
String *objectId = objectId_example; //
AccessControlGrant *accessControlGrant = ; //
AccessControlsApi *apiInstance = [[AccessControlsApi alloc] init];
// Creates an access-control grant
[apiInstance createEntityAccessControlGrantWith:objectId
accessControlGrant:accessControlGrant
completionHandler: ^(AccessControlGrant output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var VMwareCloudDirectorOpenApi = require('v_mware_cloud_director_open_api');
var defaultClient = VMwareCloudDirectorOpenApi.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
var ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix['Authorization'] = "Token"
var api = new VMwareCloudDirectorOpenApi.AccessControlsApi()
var objectId = objectId_example; // {String}
var accessControlGrant = ; // {AccessControlGrant}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createEntityAccessControlGrant(objectId, accessControlGrant, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class createEntityAccessControlGrantExample
{
public void main()
{
// Configure API key authorization: ApiKeyAuth
Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");
var apiInstance = new AccessControlsApi();
var objectId = objectId_example; // String |
var accessControlGrant = new AccessControlGrant(); // AccessControlGrant |
try
{
// Creates an access-control grant
AccessControlGrant result = apiInstance.createEntityAccessControlGrant(objectId, accessControlGrant);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AccessControlsApi.createEntityAccessControlGrant: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');
$api_instance = new Swagger\Client\Api\AccessControlsApi();
$objectId = objectId_example; // String |
$accessControlGrant = ; // AccessControlGrant |
try {
$result = $api_instance->createEntityAccessControlGrant($objectId, $accessControlGrant);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AccessControlsApi->createEntityAccessControlGrant: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::AccessControlsApi;
# Configure API key authorization: ApiKeyAuth
$WWW::SwaggerClient::Configuration::api_key->{'Authorization'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::SwaggerClient::Configuration::api_key_prefix->{'Authorization'} = "Bearer";
my $api_instance = WWW::SwaggerClient::AccessControlsApi->new();
my $objectId = objectId_example; # String |
my $accessControlGrant = WWW::SwaggerClient::Object::AccessControlGrant->new(); # AccessControlGrant |
eval {
my $result = $api_instance->createEntityAccessControlGrant(objectId => $objectId, accessControlGrant => $accessControlGrant);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AccessControlsApi->createEntityAccessControlGrant: $@\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: ApiKeyAuth
swagger_client.configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.AccessControlsApi()
objectId = objectId_example # String |
accessControlGrant = # AccessControlGrant |
try:
# Creates an access-control grant
api_response = api_instance.create_entity_access_control_grant(objectId, accessControlGrant)
pprint(api_response)
except ApiException as e:
print("Exception when calling AccessControlsApi->createEntityAccessControlGrant: %s\n" % e)
Parameters
Name | Description |
---|---|
objectId* |
String
Required
|
Name | Description |
---|---|
accessControlGrant * |