Skip to content

Commit

Permalink
feat(IAM Identity): adding effective account settings (#253)
Browse files Browse the repository at this point in the history
Signed-off-by: poorani <[email protected]>
  • Loading branch information
pooraniss-ibm authored Aug 12, 2024
1 parent 9cec00b commit 082b983
Show file tree
Hide file tree
Showing 273 changed files with 3,036 additions and 239 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,28 @@ public static void main(String[] args) throws Exception {
e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e);
}

try {
System.out.println("getEffectiveAccountSettings() result:");

// begin-getEffectiveAccountSettings

GetEffectiveAccountSettingsOptions getEffectiveAccountSettingsOptions = new GetEffectiveAccountSettingsOptions.Builder()
.accountId(accountId)
.build();

Response<EffectiveAccountSettingsResponse> response = service.getEffectiveAccountSettings(getEffectiveAccountSettingsOptions).execute();
EffectiveAccountSettingsResponse effectiveAccountSettingsResponse = response.getResult();


System.out.println(effectiveAccountSettingsResponse);

// end-getEffectiveAccountSettings

} catch (ServiceResponseException e) {
logger.error(String.format("Service returned status code %s: %s\nError details: %s",
e.getStatusCode(), e.getMessage(), e.getDebuggingInfo()), e);
}

try {
System.out.println("createReport() result:");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 3.86.2-8b8592a4-20240313-204553
* IBM OpenAPI SDK Code Generator Version: 3.93.0-c40121e6-20240729-182103
*/

package com.ibm.cloud.platform_services.iam_identity.v1;
Expand Down Expand Up @@ -52,6 +52,7 @@
import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteServiceIdOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.DeleteTrustedProfileAssignmentOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.DisableApiKeyOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.EffectiveAccountSettingsResponse;
import com.ibm.cloud.platform_services.iam_identity.v1.model.EnableApiKeyOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.ExceptionResponse;
import com.ibm.cloud.platform_services.iam_identity.v1.model.GetAccountSettingsAssignmentOptions;
Expand All @@ -60,6 +61,7 @@
import com.ibm.cloud.platform_services.iam_identity.v1.model.GetApiKeyOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.GetApiKeysDetailsOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.GetClaimRuleOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.GetEffectiveAccountSettingsOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.GetLatestAccountSettingsTemplateVersionOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.GetLatestProfileTemplateVersionOptions;
import com.ibm.cloud.platform_services.iam_identity.v1.model.GetLinkOptions;
Expand Down Expand Up @@ -2071,6 +2073,36 @@ public ServiceCall<Report> getReport(GetReportOptions getReportOptions) {
return createServiceCall(builder.build(), responseConverter);
}

/**
* Get effective account settings configuration.
*
* Returns effective account settings for given account ID.
*
* @param getEffectiveAccountSettingsOptions the {@link GetEffectiveAccountSettingsOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link EffectiveAccountSettingsResponse}
*/
public ServiceCall<EffectiveAccountSettingsResponse> getEffectiveAccountSettings(GetEffectiveAccountSettingsOptions getEffectiveAccountSettingsOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getEffectiveAccountSettingsOptions,
"getEffectiveAccountSettingsOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("account_id", getEffectiveAccountSettingsOptions.accountId());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/accounts/{account_id}/effective_settings/identity", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("iam_identity", "v1", "getEffectiveAccountSettings");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getEffectiveAccountSettingsOptions.includeHistory() != null) {
builder.query("include_history", String.valueOf(getEffectiveAccountSettingsOptions.includeHistory()));
}
if (getEffectiveAccountSettingsOptions.resolveUserMfa() != null) {
builder.query("resolve_user_mfa", String.valueOf(getEffectiveAccountSettingsOptions.resolveUserMfa()));
}
ResponseConverter<EffectiveAccountSettingsResponse> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<EffectiveAccountSettingsResponse>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* List assignments.
*
Expand Down Expand Up @@ -2328,6 +2360,9 @@ public ServiceCall<TrustedProfileTemplateResponse> createProfileTemplate(CreateP
if (createProfileTemplateOptions.policyTemplateReferences() != null) {
contentJson.add("policy_template_references", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateOptions.policyTemplateReferences()));
}
if (createProfileTemplateOptions.actionControls() != null) {
contentJson.add("action_controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateOptions.actionControls()));
}
builder.bodyJson(contentJson);
ResponseConverter<TrustedProfileTemplateResponse> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<TrustedProfileTemplateResponse>() { }.getType());
Expand Down Expand Up @@ -2469,6 +2504,9 @@ public ServiceCall<TrustedProfileTemplateResponse> createProfileTemplateVersion(
if (createProfileTemplateVersionOptions.policyTemplateReferences() != null) {
contentJson.add("policy_template_references", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateVersionOptions.policyTemplateReferences()));
}
if (createProfileTemplateVersionOptions.actionControls() != null) {
contentJson.add("action_controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createProfileTemplateVersionOptions.actionControls()));
}
builder.bodyJson(contentJson);
ResponseConverter<TrustedProfileTemplateResponse> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<TrustedProfileTemplateResponse>() { }.getType());
Expand Down Expand Up @@ -2540,6 +2578,9 @@ public ServiceCall<TrustedProfileTemplateResponse> updateProfileTemplateVersion(
if (updateProfileTemplateVersionOptions.policyTemplateReferences() != null) {
contentJson.add("policy_template_references", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProfileTemplateVersionOptions.policyTemplateReferences()));
}
if (updateProfileTemplateVersionOptions.actionControls() != null) {
contentJson.add("action_controls", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateProfileTemplateVersionOptions.actionControls()));
}
builder.bodyJson(contentJson);
ResponseConverter<TrustedProfileTemplateResponse> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<TrustedProfileTemplateResponse>() { }.getType());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2023.
* (C) Copyright IBM Corp. 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
Expand All @@ -10,6 +10,7 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.cloud.platform_services.iam_identity.v1.model;

import com.google.gson.annotations.SerializedName;
Expand Down
Loading

0 comments on commit 082b983

Please sign in to comment.