Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1697,16 +1697,41 @@ public static void main(String[] args) throws Exception {

// begin-create_account_settings_template

AccountSettingsComponent accountSettings = new AccountSettingsComponent.Builder()
.mfa("LEVEL1")
.systemAccessTokenExpirationInSeconds("3000")
UserMfa userMfaModel = new UserMfa.Builder()
.iamId(iamId)
.mfa("NONE")
.build();

AccountSettingsUserDomainRestriction accountSettingsUserDomainRestrictionModel = new AccountSettingsUserDomainRestriction.Builder()
.realmId("IBMid")
.invitationEmailAllowPatterns(java.util.Arrays.asList("*.*@ibm.com"))
.restrictInvitation(false)
.build();

TemplateAccountSettingsRestrictUserDomains templateAccountSettingsRestrictUserDomainsModel = new TemplateAccountSettingsRestrictUserDomains.Builder()
.accountSufficient(false)
.restrictions(java.util.Arrays.asList(accountSettingsUserDomainRestrictionModel))
.build();

TemplateAccountSettings templateAccountSettingsModel = new TemplateAccountSettings.Builder()
.restrictCreateServiceId("NOT_SET")
.restrictCreatePlatformApikey("NOT_SET")
.mfa("NONE")
.userMfa(java.util.Arrays.asList(userMfaModel))
.sessionExpirationInSeconds("86400")
.sessionInvalidationInSeconds("7200")
.maxSessionsPerIdentity("12")
.systemAccessTokenExpirationInSeconds("3600")
.systemRefreshTokenExpirationInSeconds("259200")
.restrictUserListVisibility("RESTRICTED")
.restrictUserDomains(templateAccountSettingsRestrictUserDomainsModel)
.build();

CreateAccountSettingsTemplateOptions createOptions = new CreateAccountSettingsTemplateOptions.Builder()
.accountId(enterpriseAccountId)
.name(accountSettingsTemplateName)
.description("IAM enterprise account settings template example")
.accountSettings(accountSettings)
.accountSettings(templateAccountSettingsModel)
.build();

Response<AccountSettingsTemplateResponse> createResponse = identityservice.createAccountSettingsTemplate(createOptions).execute();
Expand Down Expand Up @@ -1776,18 +1801,44 @@ public static void main(String[] args) throws Exception {

// begin-update_account_settings_template_version

AccountSettingsComponent accountSettings = new AccountSettingsComponent.Builder()
UserMfa userMfaModel = new UserMfa.Builder()
.iamId(iamId)
.mfa("LEVEL1")
.build();

AccountSettingsUserDomainRestriction accountSettingsUserDomainRestrictionModel = new AccountSettingsUserDomainRestriction.Builder()
.realmId("IBMid")
.invitationEmailAllowPatterns(java.util.Arrays.asList("*.*@company.com"))
.restrictInvitation(false)
.build();

TemplateAccountSettingsRestrictUserDomains templateAccountSettingsRestrictUserDomainsModel = new TemplateAccountSettingsRestrictUserDomains.Builder()
.accountSufficient(false)
.restrictions(java.util.Arrays.asList(accountSettingsUserDomainRestrictionModel))
.build();

TemplateAccountSettings templateAccountSettingsModel = new TemplateAccountSettings.Builder()
.restrictCreateServiceId("NOT_RESTRICTED")
.restrictCreatePlatformApikey("RESTRICTED")
.mfa("LEVEL1")
.systemAccessTokenExpirationInSeconds("3000")
.userMfa(java.util.Arrays.asList(userMfaModel))
.sessionExpirationInSeconds("86400")
.sessionInvalidationInSeconds("7200")
.maxSessionsPerIdentity("10")
.systemAccessTokenExpirationInSeconds("3600")
.systemRefreshTokenExpirationInSeconds("259200")
.restrictUserListVisibility("NOT_RESTRICTED")
.restrictUserDomains(templateAccountSettingsRestrictUserDomainsModel)
.build();

UpdateAccountSettingsTemplateVersionOptions updateOptions = new UpdateAccountSettingsTemplateVersionOptions.Builder()
.accountId(enterpriseAccountId)
.templateId(accountSettingsTemplateId)
.version(Long.toString(accountSettingsTemplateVersion))
.ifMatch(accountSettingsTemplateEtag)
.name(accountSettingsTemplateName)
.description("IAM enterprise account settings template example - updated")
.accountSettings(accountSettings)
.accountSettings(templateAccountSettingsModel)
.build();

Response<AccountSettingsTemplateResponse> updateResponse = identityservice.updateAccountSettingsTemplateVersion(updateOptions).execute();
Expand Down Expand Up @@ -1905,18 +1956,42 @@ public static void main(String[] args) throws Exception {

// begin-create_account_settings_template_version

AccountSettingsComponent accountSettings = new AccountSettingsComponent.Builder()
.mfa("LEVEL1")
.systemAccessTokenExpirationInSeconds("2600")
.restrictCreatePlatformApikey("RESTRICTED")
.restrictCreateServiceId("RESTRICTED")
UserMfa userMfaModel = new UserMfa.Builder()
.iamId(iamId)
.mfa("NONE")
.build();

AccountSettingsUserDomainRestriction accountSettingsUserDomainRestrictionModel = new AccountSettingsUserDomainRestriction.Builder()
.realmId("IBMid")
.invitationEmailAllowPatterns(java.util.Arrays.asList("*.*@ibm.com"))
.restrictInvitation(false)
.build();

TemplateAccountSettingsRestrictUserDomains templateAccountSettingsRestrictUserDomainsModel = new TemplateAccountSettingsRestrictUserDomains.Builder()
.accountSufficient(false)
.restrictions(java.util.Arrays.asList(accountSettingsUserDomainRestrictionModel))
.build();

TemplateAccountSettings templateAccountSettingsModel = new TemplateAccountSettings.Builder()
.restrictCreateServiceId("NOT_SET")
.restrictCreatePlatformApikey("NOT_SET")
.mfa("NONE")
.userMfa(java.util.Arrays.asList(userMfaModel))
.sessionExpirationInSeconds("86400")
.sessionInvalidationInSeconds("7200")
.maxSessionsPerIdentity("12")
.systemAccessTokenExpirationInSeconds("3600")
.systemRefreshTokenExpirationInSeconds("259200")
.restrictUserListVisibility("RESTRICTED")
.restrictUserDomains(templateAccountSettingsRestrictUserDomainsModel)
.build();

CreateAccountSettingsTemplateVersionOptions createOptions = new CreateAccountSettingsTemplateVersionOptions.Builder()
.accountId(enterpriseAccountId)
.templateId(accountSettingsTemplateId)
.name(accountSettingsTemplateName)
.description("IAM enterprise account settings template example - new version")
.accountSettings(accountSettings)
.accountSettings(templateAccountSettingsModel)
.build();

Response<AccountSettingsTemplateResponse> createResponse = identityservice.createAccountSettingsTemplateVersion(createOptions).execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1681,18 +1681,15 @@ public ServiceCall<AccountSettingsResponse> updateAccountSettings(UpdateAccountS
if (updateAccountSettingsOptions.restrictCreatePlatformApikey() != null) {
contentJson.addProperty("restrict_create_platform_apikey", updateAccountSettingsOptions.restrictCreatePlatformApikey());
}
if (updateAccountSettingsOptions.restrictUserListVisibility() != null) {
contentJson.addProperty("restrict_user_list_visibility", updateAccountSettingsOptions.restrictUserListVisibility());
}
if (updateAccountSettingsOptions.restrictUserDomains() != null) {
contentJson.add("restrict_user_domains", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAccountSettingsOptions.restrictUserDomains()));
}
if (updateAccountSettingsOptions.allowedIpAddresses() != null) {
contentJson.addProperty("allowed_ip_addresses", updateAccountSettingsOptions.allowedIpAddresses());
}
if (updateAccountSettingsOptions.mfa() != null) {
contentJson.addProperty("mfa", updateAccountSettingsOptions.mfa());
}
if (updateAccountSettingsOptions.userMfa() != null) {
contentJson.add("user_mfa", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAccountSettingsOptions.userMfa()));
}
if (updateAccountSettingsOptions.sessionExpirationInSeconds() != null) {
contentJson.addProperty("session_expiration_in_seconds", updateAccountSettingsOptions.sessionExpirationInSeconds());
}
Expand All @@ -1708,8 +1705,11 @@ public ServiceCall<AccountSettingsResponse> updateAccountSettings(UpdateAccountS
if (updateAccountSettingsOptions.systemRefreshTokenExpirationInSeconds() != null) {
contentJson.addProperty("system_refresh_token_expiration_in_seconds", updateAccountSettingsOptions.systemRefreshTokenExpirationInSeconds());
}
if (updateAccountSettingsOptions.userMfa() != null) {
contentJson.add("user_mfa", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAccountSettingsOptions.userMfa()));
if (updateAccountSettingsOptions.restrictUserListVisibility() != null) {
contentJson.addProperty("restrict_user_list_visibility", updateAccountSettingsOptions.restrictUserListVisibility());
}
if (updateAccountSettingsOptions.restrictUserDomains() != null) {
contentJson.add("restrict_user_domains", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateAccountSettingsOptions.restrictUserDomains()));
}
builder.bodyJson(contentJson);
ResponseConverter<AccountSettingsResponse> responseConverter =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.ibm.cloud.sdk.core.service.model.GenericModel;

/**
* Response body format for Account Settings REST requests.
* Input body parameters for the Account Settings REST request.
*/
public class AccountSettingsAssignedTemplatesSection extends GenericModel {

Expand Down Expand Up @@ -55,19 +55,6 @@ public interface RestrictCreatePlatformApikey {
String NOT_SET = "NOT_SET";
}

/**
* Defines whether or not user visibility is access controlled. Valid values:
* * RESTRICTED - users can view only specific types of users in the account, such as those the user has invited to
* the account, or descendants of those users based on the classic infrastructure hierarchy
* * NOT_RESTRICTED - any user in the account can view other users from the Users page in IBM Cloud console.
*/
public interface RestrictUserListVisibility {
/** NOT_RESTRICTED. */
String NOT_RESTRICTED = "NOT_RESTRICTED";
/** RESTRICTED. */
String RESTRICTED = "RESTRICTED";
}

/**
* MFA trait definitions as follows:
* * NONE - No MFA trait set
Expand Down Expand Up @@ -95,6 +82,22 @@ public interface Mfa {
String LEVEL3 = "LEVEL3";
}

/**
* Defines whether or not user visibility is access controlled. Valid values:
* * RESTRICTED - users can view only specific types of users in the account, such as those the user has invited to
* the account, or descendants of those users based on the classic infrastructure hierarchy
* * NOT_RESTRICTED - any user in the account can view other users from the Users page in IBM Cloud console
* * NOT_SET - to 'unset' a previous set value.
*/
public interface RestrictUserListVisibility {
/** RESTRICTED. */
String RESTRICTED = "RESTRICTED";
/** NOT_RESTRICTED. */
String NOT_RESTRICTED = "NOT_RESTRICTED";
/** NOT_SET. */
String NOT_SET = "NOT_SET";
}

@SerializedName("template_id")
protected String templateId;
@SerializedName("template_version")
Expand All @@ -105,10 +108,6 @@ public interface Mfa {
protected String restrictCreateServiceId;
@SerializedName("restrict_create_platform_apikey")
protected String restrictCreatePlatformApikey;
@SerializedName("restrict_user_list_visibility")
protected String restrictUserListVisibility;
@SerializedName("restrict_user_domains")
protected List<AccountSettingsUserDomainRestriction> restrictUserDomains;
@SerializedName("allowed_ip_addresses")
protected String allowedIpAddresses;
protected String mfa;
Expand All @@ -122,8 +121,12 @@ public interface Mfa {
protected String systemAccessTokenExpirationInSeconds;
@SerializedName("system_refresh_token_expiration_in_seconds")
protected String systemRefreshTokenExpirationInSeconds;
@SerializedName("restrict_user_list_visibility")
protected String restrictUserListVisibility;
@SerializedName("user_mfa")
protected List<AccountSettingsUserMFAResponse> userMfa;
@SerializedName("restrict_user_domains")
protected AssignedTemplatesAccountSettingsRestrictUserDomains restrictUserDomains;

protected AccountSettingsAssignedTemplatesSection() { }

Expand Down Expand Up @@ -190,32 +193,6 @@ public String getRestrictCreatePlatformApikey() {
return restrictCreatePlatformApikey;
}

/**
* Gets the restrictUserListVisibility.
*
* Defines whether or not user visibility is access controlled. Valid values:
* * RESTRICTED - users can view only specific types of users in the account, such as those the user has invited to
* the account, or descendants of those users based on the classic infrastructure hierarchy
* * NOT_RESTRICTED - any user in the account can view other users from the Users page in IBM Cloud console.
*
* @return the restrictUserListVisibility
*/
public String getRestrictUserListVisibility() {
return restrictUserListVisibility;
}

/**
* Gets the restrictUserDomains.
*
* Defines if account invitations are restricted to specified domains. To remove an entry for a realm_id, perform an
* update (PUT) request with only the realm_id set.
*
* @return the restrictUserDomains
*/
public List<AccountSettingsUserDomainRestriction> getRestrictUserDomains() {
return restrictUserDomains;
}

/**
* Gets the allowedIpAddresses.
*
Expand Down Expand Up @@ -310,6 +287,21 @@ public String getSystemRefreshTokenExpirationInSeconds() {
return systemRefreshTokenExpirationInSeconds;
}

/**
* Gets the restrictUserListVisibility.
*
* Defines whether or not user visibility is access controlled. Valid values:
* * RESTRICTED - users can view only specific types of users in the account, such as those the user has invited to
* the account, or descendants of those users based on the classic infrastructure hierarchy
* * NOT_RESTRICTED - any user in the account can view other users from the Users page in IBM Cloud console
* * NOT_SET - to 'unset' a previous set value.
*
* @return the restrictUserListVisibility
*/
public String getRestrictUserListVisibility() {
return restrictUserListVisibility;
}

/**
* Gets the userMfa.
*
Expand All @@ -320,5 +312,14 @@ public String getSystemRefreshTokenExpirationInSeconds() {
public List<AccountSettingsUserMFAResponse> getUserMfa() {
return userMfa;
}

/**
* Gets the restrictUserDomains.
*
* @return the restrictUserDomains
*/
public AssignedTemplatesAccountSettingsRestrictUserDomains getRestrictUserDomains() {
return restrictUserDomains;
}
}

Loading