Introduction
IBM Cloud Shell is a cloud-based shell workspace that you can access through your browser. Cloud Shell is preconfigured with the full IBM Cloud CLI, plug-ins, and tools that you can use to manage apps, resources, and infrastructure. For more information, see Getting started with IBM Cloud Shell.
As an account owner or Cloud Shell administrator, the account settings REST API helps control whether users in an account can access Cloud Shell, and you can configure the location availability for an account. Only account owners, users assigned the Administrator role for the Cloud Shell account management service, or users assigned the Administrator role on all account management services can change the Cloud Shell settings. For more information, see the IAM roles and actions for the IBM Cloud Shell account management service.
By default, Cloud Shell is enabled for an account. As an account owner or user with the correct access, you can enable or disable Cloud Shell for users in the account. When the Cloud Shell availability setting is enabled, Cloud Shell is available to all users in the account. If the setting is disabled, no users in the account can access Cloud Shell.
By default, all locations for the account are enabled, and the nearest available location is selected. Users are routed to the nearest available location, such as Dallas (us-south), Frankfurt (eu-de), or Tokyo (jp-tok). As an account owner or user with the correct access, you can configure whether Cloud Shell is enabled only in specific locations for the account.
Account owners or users with Cloud Shell administrator access can enable or disable Cloud Shell features for an account. By default, all features for the account are enabled. The feature settings apply only to the enabled Cloud Shell locations.
Installing the Node SDK
npm install @ibm-cloud/platform-services
View on GitHub
Installing the Java SDK
Maven
<dependency>
<groupId>com.ibm.cloud</groupId>
<artifactId>ibm-cloud-shell</artifactId>
<version>{version}</version>
</dependency>
Gradle
compile 'com.ibm.cloud:ibm-cloud-shell:{version}'
Replace {version}
in these examples with the release version.
View on GitHub
Installing the Python SDK
pip install --upgrade "ibm-platform-services"
View on GitHub
Installing the Go SDK
Go modules (recommended): Add the following import in your code, and then run go build
or go mod tidy
import (
"github.com/IBM/platform-services-go-sdk/ibmcloudshellv1"
)
Go get
go get -u github.com/IBM/platform-services-go-sdk/ibmcloudshellv1
View on GitHub
Endpoint URLs
The Cloud Shell API uses the following global endpoint URL for all regions. When you call the API, add the path for each method to form the complete API endpoint for your requests.
https://api.shell.cloud.ibm.com
Example API request
curl --request GET 'https://api.shell.cloud.ibm.com/api/v1/user/accounts/12345678-abcd-1a2b-a1b2-1234567890ab/settings' --header 'Authorization: Bearer <IAM token>' --header 'Content-Type: application/json' --header 'Accept: application/json'
Replace
Authentication
Authorization to the Cloud Shell account settings REST API is enforced by using an IAM access token. The token is used to determine the roles that the identity has access to when using Cloud Shell services. For information about how to obtain an IAM token for an authenticated user or service ID, see the IAM Identity Service API documentation.
Adequate access is required to use the API. Each method lists the IAM action that you need to be assigned access to. For more information, see the IAM roles and actions for the IBM Cloud Shell account management service.
Obtaining an IAM token for an authenticated user or service ID is described in the IAM Identity Services API documentation.
To use the API, add a valid IAM token to the HTTP Authorization request header, for example, -H 'Authorization: Bearer <TOKEN>'
.
When you use the SDK, configure an IAM authenticator with the IAM API key. The authenticator automatically obtains the IAM access token for the API key and includes it with each request. You can construct an authenticator in either of two ways:
- Programmatically by constructing an IAM authenticator instance and supplying your IAM API key
- By defining the API key in external configuration properties and then using the SDK authenticator factory to construct an IAM authenticator that uses the configured IAM API key
In this example of using external configuration properties, an IAM authenticator instance is created with the configured API key, and then the service client is constructed with this authenticator instance and the configured service URL.
For more information, see the Authentication section of the IBM Cloud SDK Common documentation.
To call each method, you'll need to be assigned a role that includes the required IAM actions. Each method lists the associated action. For more information about IAM actions and how they map to roles, see Assigning access to account management services.
To retrieve your access token:
curl -X POST "https://iam.cloud.ibm.com/identity/token" --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --data-urlencode 'grant_type=urn:ibm:params:oauth:grant-type:apikey' --data-urlencode 'apikey=<API_KEY>'
Replace <API_KEY>
with your IAM API key.
Setting client options through external configuration
Example environment variables, where <SERVICE_URL>
is the endpoint URL and <API_KEY>
is your IAM API key
export IBM_CLOUD_SHELL_URL=<SERVICE_URL>
export IBM_CLOUD_SHELL_AUTH_TYPE=iam
export IBM_CLOUD_SHELL_APIKEY=<API_KEY>
Example of constructing the service client
import (
"github.com/IBM/platform-services-go-sdk/ibmcloudshellv1"
)
...
serviceClientOptions := &ibmcloudshellv1.IBMCloudShellV1Options{}
ibmCloudShellService, err := ibmcloudshellv1.NewIBMCloudShellV1UsingExternalConfig(serviceClientOptions)
Setting client options through external configuration
Example environment variables, where <SERVICE_URL>
is the endpoint URL and <API_KEY>
is your IAM API key
export IBM_CLOUD_SHELL_URL=<SERVICE_URL>
export IBM_CLOUD_SHELL_AUTH_TYPE=iam
export IBM_CLOUD_SHELL_APIKEY=<API_KEY>
Example of constructing the service client
import com.ibm.cloud.platform_services.ibm_cloud_shell.v1.IbmCloudShell;
...
IbmCloudShell ibmCloudShellService = IbmCloudShell.newInstance();
Setting client options through external configuration
Example environment variables, where <SERVICE_URL>
is the endpoint URL and <API_KEY>
is your IAM API key
export IBM_CLOUD_SHELL_URL=<SERVICE_URL>
export IBM_CLOUD_SHELL_AUTH_TYPE=iam
export IBM_CLOUD_SHELL_APIKEY=<API_KEY>
Example of constructing the service client
const IbmCloudShellV1 = require('@ibm-cloud/platform-services/ibm-cloud-shell/v1');
...
const ibmCloudShellService = IbmCloudShellV1.newInstance({});
Setting client options through external configuration
Example environment variables, where <SERVICE_URL>
is the endpoint URL and <API_KEY>
is your IAM API key
export IBM_CLOUD_SHELL_URL=<SERVICE_URL>
export IBM_CLOUD_SHELL_AUTH_TYPE=iam
export IBM_CLOUD_SHELL_APIKEY=<API_KEY>
Example of constructing the service client
from ibm_platform_services import IbmCloudShellV1
...
ibm_cloud_shell_service = IbmCloudShellV1.new_instance()
Auditing
You can monitor API activity within your account by using the IBM Cloud Activity Tracker service. Whenever an API method is called, an event is generated that you can then track and audit from within Activity Tracker. The specific event type is listed for each individual method.
For more information about how to track Cloud Shell activity, see Auditing events for Cloud Shell.
Error handling
This API uses standard HTTP response codes to indicate whether a method completed successfully. A 200
response indicates success. A 400
type response indicates a failure, and a 500
type response indicates an internal system error.
HTTP Error Code | Description | Recovery |
---|---|---|
200 |
Success | The request was successful. |
400 |
Bad Request | The input parameters in the request body are either incomplete or in the wrong format. Be sure to include all required parameters in your request. |
401 |
Unauthorized | You are not authorized to make this request. Log in to IBM Cloud and try again. If this error persists, contact the account owner to check your permissions. |
403 |
Forbidden | The supplied authentication is not authorized. |
404 |
Not Found | The requested resource could not be found. |
500 |
Internal Server Error | IBM Cloud Shell is currently unavailable. Your request could not be processed. Wait a few minutes and try again. |
Methods
Get account settings
Retrieve account settings for the given account ID. Call this method to get details about a particular account setting, whether Cloud Shell is enabled, the list of enabled regions and the list of enabled features. Users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
Retrieve account settings for the given account ID. Call this method to get details about a particular account setting, whether Cloud Shell is enabled, the list of enabled regions and the list of enabled features. Users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
Retrieve account settings for the given account ID. Call this method to get details about a particular account setting, whether Cloud Shell is enabled, the list of enabled regions and the list of enabled features. Users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
Retrieve account settings for the given account ID. Call this method to get details about a particular account setting, whether Cloud Shell is enabled, the list of enabled regions and the list of enabled features. Users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
Retrieve account settings for the given account ID. Call this method to get details about a particular account setting, whether Cloud Shell is enabled, the list of enabled regions and the list of enabled features. Users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
GET /api/v1/user/accounts/{account_id}/settings
(ibmCloudShell *IBMCloudShellV1) GetAccountSettings(getAccountSettingsOptions *GetAccountSettingsOptions) (result *AccountSettings, response *core.DetailedResponse, err error)
(ibmCloudShell *IBMCloudShellV1) GetAccountSettingsWithContext(ctx context.Context, getAccountSettingsOptions *GetAccountSettingsOptions) (result *AccountSettings, response *core.DetailedResponse, err error)
ServiceCall<AccountSettings> getAccountSettings(GetAccountSettingsOptions getAccountSettingsOptions)
get_account_settings(self,
account_id: str,
**kwargs
) -> DetailedResponse
getAccountSettings(params)
Request
Instantiate the GetAccountSettingsOptions
struct and set the fields to provide parameter values for the GetAccountSettings
method.
Use the GetAccountSettingsOptions.Builder
to create a GetAccountSettingsOptions
object that contains the parameter values for the getAccountSettings
method.
Path Parameters
The account ID in which the account settings belong to.
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
WithContext method only
A context.Context instance that you can use to specify a timeout for the operation or to cancel an in-flight request.
The GetAccountSettings options.
The account ID in which the account settings belong to.
The getAccountSettings options.
The account ID in which the account settings belong to.
parameters
The account ID in which the account settings belong to.
parameters
The account ID in which the account settings belong to.
const params = { accountId: accountId, }; ibmCloudShellService.getAccountSettings(params) .then(res => { console.log(JSON.stringify(res.result, null, 2)); }) .catch(err => { console.warn(err) });
getAccountSettingsOptions := &ibmcloudshellv1.GetAccountSettingsOptions{ AccountID: &accountID, } accountSettings, response, err := ibmCloudShellService.GetAccountSettings(getAccountSettingsOptions) if err != nil { panic(err) } b, _ := json.MarshalIndent(accountSettings, "", " ") fmt.Println(string(b))
GetAccountSettingsOptions getAccountSettingsOptions = new GetAccountSettingsOptions.Builder() .accountId(ACCOUNT_ID) .build(); Response<AccountSettings> response = ibmCloudShellService.getAccountSettings(getAccountSettingsOptions).execute(); AccountSettings accountSettings = response.getResult(); System.out.println(accountSettings);
account_settings = ibm_cloud_shell_service.get_account_settings( account_id=account_id ).get_result() print(json.dumps(account_settings, indent=2))
curl --request GET 'https://api.shell.cloud.ibm.com/api/v1/user/accounts/12345678-abcd-1a2b-a1b2-1234567890ab/settings' --header 'Authorization: Bearer <IAM token>' --header 'Content-Type: application/json' --header 'Accept: application/json'
Response
Definition of Cloud Shell account settings
Unique id of the settings object
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
Unique revision number for the settings object
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
The id of the account the settings belong to
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
Creation timestamp in Unix epoch time
IAM ID of creator
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account
List of Cloud Shell features
Possible values: 0 ≤ number of items ≤ 2
List of Cloud Shell region settings
Possible values: 0 ≤ number of items ≤ 3
Type of api response object
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-z_]*$
Timestamp of last update in Unix epoch time
IAM ID of last updater
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
Definition of Cloud Shell account settings.
Unique id of the settings object.
Unique revision number for the settings object.
The id of the account the settings belong to.
Creation timestamp in Unix epoch time.
IAM ID of creator.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- Features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- Regions
State of the region.
Name of the region.
Type of api response object.
Timestamp of last update in Unix epoch time.
IAM ID of last updater.
Definition of Cloud Shell account settings.
Unique id of the settings object.
Unique revision number for the settings object.
The id of the account the settings belong to.
Creation timestamp in Unix epoch time.
IAM ID of creator.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- regions
State of the region.
Name of the region.
Type of api response object.
Timestamp of last update in Unix epoch time.
IAM ID of last updater.
Definition of Cloud Shell account settings.
Unique id of the settings object.
Unique revision number for the settings object.
The id of the account the settings belong to.
Creation timestamp in Unix epoch time.
IAM ID of creator.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- regions
State of the region.
Name of the region.
Type of api response object.
Timestamp of last update in Unix epoch time.
IAM ID of last updater.
Definition of Cloud Shell account settings.
Unique id of the settings object.
Unique revision number for the settings object.
The id of the account the settings belong to.
Creation timestamp in Unix epoch time.
IAM ID of creator.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- regions
State of the region.
Name of the region.
Type of api response object.
Timestamp of last update in Unix epoch time.
IAM ID of last updater.
Status Code
Get account setting
{ "_id": "ac-12345678-abcd-1a2b-a1b2-1234567890ab", "_rev": "130-1bc9ec83d7b9b049890c6d4b74dddb2a", "type": "account_settings", "created_at": 1600079615, "created_by": "IBMid-1000000000", "updated_at": 1624359948, "updated_by": "IBMid-1000000000", "account_id": "12345678-abcd-1a2b-a1b2-1234567890ab", "enabled": true, "regions": [ { "enabled": true, "key": "eu-de" }, { "enabled": true, "key": "jp-tok" }, { "enabled": true, "key": "us-south" } ], "default_enable_new_regions": true, "features": [ { "enabled": true, "key": "server.file_manager" }, { "enabled": true, "key": "server.web_preview" } ], "default_enable_new_features": true }
{ "_id": "ac-12345678-abcd-1a2b-a1b2-1234567890ab", "_rev": "130-1bc9ec83d7b9b049890c6d4b74dddb2a", "type": "account_settings", "created_at": 1600079615, "created_by": "IBMid-1000000000", "updated_at": 1624359948, "updated_by": "IBMid-1000000000", "account_id": "12345678-abcd-1a2b-a1b2-1234567890ab", "enabled": true, "regions": [ { "enabled": true, "key": "eu-de" }, { "enabled": true, "key": "jp-tok" }, { "enabled": true, "key": "us-south" } ], "default_enable_new_regions": true, "features": [ { "enabled": true, "key": "server.file_manager" }, { "enabled": true, "key": "server.web_preview" } ], "default_enable_new_features": true }
Update account settings
Update account settings for the given account ID. Call this method to update account settings configuration, you can enable or disable Cloud Shell, enable or disable available regions and enable and disable features. To update account settings, users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
Update account settings for the given account ID. Call this method to update account settings configuration, you can enable or disable Cloud Shell, enable or disable available regions and enable and disable features. To update account settings, users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
Update account settings for the given account ID. Call this method to update account settings configuration, you can enable or disable Cloud Shell, enable or disable available regions and enable and disable features. To update account settings, users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
Update account settings for the given account ID. Call this method to update account settings configuration, you can enable or disable Cloud Shell, enable or disable available regions and enable and disable features. To update account settings, users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
Update account settings for the given account ID. Call this method to update account settings configuration, you can enable or disable Cloud Shell, enable or disable available regions and enable and disable features. To update account settings, users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service.
POST /api/v1/user/accounts/{account_id}/settings
(ibmCloudShell *IBMCloudShellV1) UpdateAccountSettings(updateAccountSettingsOptions *UpdateAccountSettingsOptions) (result *AccountSettings, response *core.DetailedResponse, err error)
(ibmCloudShell *IBMCloudShellV1) UpdateAccountSettingsWithContext(ctx context.Context, updateAccountSettingsOptions *UpdateAccountSettingsOptions) (result *AccountSettings, response *core.DetailedResponse, err error)
ServiceCall<AccountSettings> updateAccountSettings(UpdateAccountSettingsOptions updateAccountSettingsOptions)
update_account_settings(self,
account_id: str,
*,
rev: str = None,
default_enable_new_features: bool = None,
default_enable_new_regions: bool = None,
enabled: bool = None,
features: List['Feature'] = None,
regions: List['RegionSetting'] = None,
**kwargs
) -> DetailedResponse
updateAccountSettings(params)
Request
Instantiate the UpdateAccountSettingsOptions
struct and set the fields to provide parameter values for the UpdateAccountSettings
method.
Use the UpdateAccountSettingsOptions.Builder
to create a UpdateAccountSettingsOptions
object that contains the parameter values for the updateAccountSettings
method.
Path Parameters
The account ID in which the account settings belong to.
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
Account settings object in JSON
Unique revision number for the settings object
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account
List of Cloud Shell features
Possible values: 0 ≤ number of items ≤ 2
List of Cloud Shell region settings
Possible values: 0 ≤ number of items ≤ 3
WithContext method only
A context.Context instance that you can use to specify a timeout for the operation or to cancel an in-flight request.
The UpdateAccountSettings options.
The account ID in which the account settings belong to.
Unique revision number for the settings object.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- Features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- Regions
State of the region.
Name of the region.
The updateAccountSettings options.
The account ID in which the account settings belong to.
Unique revision number for the settings object.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- regions
State of the region.
Name of the region.
parameters
The account ID in which the account settings belong to.
Unique revision number for the settings object.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- regions
State of the region.
Name of the region.
parameters
The account ID in which the account settings belong to.
Unique revision number for the settings object.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- regions
State of the region.
Name of the region.
const featureModel = [ { enabled: true, key: 'server.file_manager', }, { enabled: true, key: 'server.web_preview', }, ]; const regionSettingModel = [ { enabled: true, key: 'eu-de', }, { enabled: true, key: 'jp-tok', }, { enabled: true, key: 'us-south', }, ]; const params = { accountId: accountId, rev: '130-1bc9ec83d7b9b049890c6d4b74dddb2a', defaultEnableNewFeatures: true, defaultEnableNewRegions: true, enabled: true, features: featureModel, regions: regionSettingModel, }; ibmCloudShellService.updateAccountSettings(params) .then(res => { console.log(JSON.stringify(res.result, null, 2)); }) .catch(err => { console.warn(err) });
featureModel := []ibmcloudshellv1.Feature{ { Enabled: core.BoolPtr(true), Key: core.StringPtr("server.file_manager"), }, { Enabled: core.BoolPtr(true), Key: core.StringPtr("server.web_preview"), }, } regionSettingModel := []ibmcloudshellv1.RegionSetting{ { Enabled: core.BoolPtr(true), Key: core.StringPtr("eu-de"), }, { Enabled: core.BoolPtr(true), Key: core.StringPtr("jp-tok"), }, { Enabled: core.BoolPtr(true), Key: core.StringPtr("us-south"), }, } updateAccountSettingsOptions := &ibmcloudshellv1.UpdateAccountSettingsOptions{ AccountID: &accountID, Rev: core.StringPtr("130-1bc9ec83d7b9b049890c6d4b74dddb2a"), DefaultEnableNewFeatures: core.BoolPtr(false), DefaultEnableNewRegions: core.BoolPtr(true), Enabled: core.BoolPtr(true), Features: featureModel, Regions: regionSettingModel, } accountSettings, response, err := ibmCloudShellService.UpdateAccountSettings(updateAccountSettingsOptions) if err != nil { panic(err) } b, _ := json.MarshalIndent(accountSettings, "", " ") fmt.Println(string(b))
Feature fileManagerFeatureModel = new Feature.Builder() .enabled(true) .key("server.file_manager") .build(); Feature webPreviewFeatureModel = new Feature.Builder() .enabled(true) .key("server.web_preview") .build(); RegionSetting euRegionSettingModel = new RegionSetting.Builder() .enabled(true) .key("eu-de") .build(); RegionSetting jpRegionSettingModel = new RegionSetting.Builder() .enabled(true) .key("jp-tok") .build(); RegionSetting usRegionSettingModel = new RegionSetting.Builder() .enabled(true) .key("us-south") .build(); UpdateAccountSettingsOptions updateAccountSettingsOptions = new UpdateAccountSettingsOptions.Builder() .accountId(ACCOUNT_ID) .rev("130-1bc9ec83d7b9b049890c6d4b74dddb2a") .defaultEnableNewFeatures(true) .defaultEnableNewRegions(true) .enabled(true) .features(new java.util.ArrayList<Feature>(java.util.Arrays.asList(fileManagerFeatureModel, webPreviewFeatureModel))) .regions(new java.util.ArrayList<RegionSetting>(java.util.Arrays.asList(euRegionSettingModel, jpRegionSettingModel, usRegionSettingModel))) .build(); Response<AccountSettings> response = ibmCloudShellService.updateAccountSettings(updateAccountSettingsOptions).execute(); AccountSettings accountSettings = response.getResult(); System.out.println(accountSettings);
feature_model = [{ 'enabled': True, 'key': 'server.file_manager', }, { 'enabled': True, 'key': 'server.web_preview', }] region_setting_model = [{ 'enabled': True, 'key': 'eu-de', }, { 'enabled': True, 'key': 'jp-tok', }, { 'enabled': True, 'key': 'us-south', }] account_settings = ibm_cloud_shell_service.update_account_settings( account_id=account_id, rev='130-1bc9ec83d7b9b049890c6d4b74dddb2a', default_enable_new_features=False, default_enable_new_regions=True, enabled=True, features=feature_model, regions=region_setting_model ).get_result() print(json.dumps(account_settings, indent=2))
curl --location --request POST 'https://api.shell.cloud.ibm.com/api/v1/user/accounts/12345678-abcd-1a2b-a1b2-1234567890ab/settings' --header 'Authorization: Bearer <IAM token>' --header 'Content-Type: application/json' --header 'Accept: application/json' --data-raw '{ "_id": "ac-12345678-abcd-1a2b-a1b2-1234567890ab", "_rev": "130-1bc9ec83d7b9b049890c6d4b74dddb2a", "type": "account_settings", "created_at": 1600079615, "created_by": "IBMid-1000000000", "updated_at": 1624359948, "updated_by": "IBMid-1000000000", "account_id": "12345678-abcd-1a2b-a1b2-1234567890ab", "enabled": true, "regions": [ { "enabled": true, "key": "eu-de" }, { "enabled": true, "key": "jp-tok" }, { "enabled": true, "key": "us-south" } ], "default_enable_new_regions": true, "features": [ { "enabled": true, "key": "server.file_manager" }, { "enabled": true, "key": "server.web_preview" } ], "default_enable_new_features": true }'
Response
Definition of Cloud Shell account settings
Unique id of the settings object
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
Unique revision number for the settings object
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
The id of the account the settings belong to
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
Creation timestamp in Unix epoch time
IAM ID of creator
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account
List of Cloud Shell features
Possible values: 0 ≤ number of items ≤ 2
List of Cloud Shell region settings
Possible values: 0 ≤ number of items ≤ 3
Type of api response object
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-z_]*$
Timestamp of last update in Unix epoch time
IAM ID of last updater
Possible values: 1 ≤ length ≤ 100, Value must match regular expression
^[a-zA-Z0-9-]*$
Definition of Cloud Shell account settings.
Unique id of the settings object.
Unique revision number for the settings object.
The id of the account the settings belong to.
Creation timestamp in Unix epoch time.
IAM ID of creator.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- Features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- Regions
State of the region.
Name of the region.
Type of api response object.
Timestamp of last update in Unix epoch time.
IAM ID of last updater.
Definition of Cloud Shell account settings.
Unique id of the settings object.
Unique revision number for the settings object.
The id of the account the settings belong to.
Creation timestamp in Unix epoch time.
IAM ID of creator.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- regions
State of the region.
Name of the region.
Type of api response object.
Timestamp of last update in Unix epoch time.
IAM ID of last updater.
Definition of Cloud Shell account settings.
Unique id of the settings object.
Unique revision number for the settings object.
The id of the account the settings belong to.
Creation timestamp in Unix epoch time.
IAM ID of creator.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- regions
State of the region.
Name of the region.
Type of api response object.
Timestamp of last update in Unix epoch time.
IAM ID of last updater.
Definition of Cloud Shell account settings.
Unique id of the settings object.
Unique revision number for the settings object.
The id of the account the settings belong to.
Creation timestamp in Unix epoch time.
IAM ID of creator.
You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations.
Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location.
When enabled, Cloud Shell is available to all users in the account.
List of Cloud Shell features.
- features
State of the feature.
Name of the feature.
List of Cloud Shell region settings.
- regions
State of the region.
Name of the region.
Type of api response object.
Timestamp of last update in Unix epoch time.
IAM ID of last updater.
Status Code
Details of updated account settings
{ "_id": "ac-12345678-abcd-1a2b-a1b2-1234567890ab", "_rev": "130-1bc9ec83d7b9b049890c6d4b74dddb2a", "type": "account_settings", "created_at": 1600079615, "created_by": "IBMid-1000000000", "updated_at": 1624359948, "updated_by": "IBMid-1000000000", "account_id": "12345678-abcd-1a2b-a1b2-1234567890ab", "enabled": true, "regions": [ { "enabled": true, "key": "eu-de" }, { "enabled": true, "key": "jp-tok" }, { "enabled": true, "key": "us-south" } ], "default_enable_new_regions": true, "features": [ { "enabled": true, "key": "server.file_manager" }, { "enabled": true, "key": "server.web_preview" } ], "default_enable_new_features": true }
{ "_id": "ac-12345678-abcd-1a2b-a1b2-1234567890ab", "_rev": "130-1bc9ec83d7b9b049890c6d4b74dddb2a", "type": "account_settings", "created_at": 1600079615, "created_by": "IBMid-1000000000", "updated_at": 1624359948, "updated_by": "IBMid-1000000000", "account_id": "12345678-abcd-1a2b-a1b2-1234567890ab", "enabled": true, "regions": [ { "enabled": true, "key": "eu-de" }, { "enabled": true, "key": "jp-tok" }, { "enabled": true, "key": "us-south" } ], "default_enable_new_regions": true, "features": [ { "enabled": true, "key": "server.file_manager" }, { "enabled": true, "key": "server.web_preview" } ], "default_enable_new_features": true }