Skip to content

Commit 864543c

Browse files
(feat Account Management) add v4 api
Signed-off-by: David <David.Lim0305@ibm.com>
1 parent 27c88c2 commit 864543c

17 files changed

Lines changed: 1066 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The IBM Cloud Platform Services Java SDK allows developers to programmatically i
4646

4747
Service Name | Artifact Coordinates
4848
--- | ---
49+
[Account Management](https://test.cloud.ibm.com/apidocs/account-management) | com.ibm.cloud:account-management:0.73.2
4950
[Case Management](https://cloud.ibm.com/apidocs/case-management?code=java) | com.ibm.cloud:case-management:0.73.2
5051
[Catalog Management](https://cloud.ibm.com/apidocs/resource-catalog/private-catalog?code=java) | com.ibm.cloud:catalog-management:0.73.2
5152
[Context Based Restrictions](https://cloud.ibm.com/apidocs/context-based-restrictions?code=java) | com.ibm.cloud:context-based-restrictions:0.73.2

modules/account-management/pom.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<!-- >>> Replace this with the parent pom's artifactId -->
7+
<artifactId>platform-services</artifactId>
8+
<groupId>com.ibm.cloud</groupId>
9+
<version>99-SNAPSHOT</version>
10+
<relativePath>../..</relativePath>
11+
</parent>
12+
13+
<!-- >>> Replace this with the service module's artifactId (e.g. "example-service") -->
14+
<artifactId>account-management</artifactId>
15+
16+
<!-- >>> Replace this with a text description of this module (e.g. "Example Service") -->
17+
<name>IBM Cloud Account Management API</name>
18+
<packaging>jar</packaging>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>com.ibm.cloud</groupId>
23+
<artifactId>sdk-core</artifactId>
24+
</dependency>
25+
<dependency>
26+
<!-- >>> Replace this with the "common" module's artifactId (e.g. my-services-common) -->
27+
<artifactId>platform-services-common</artifactId>
28+
<groupId>com.ibm.cloud</groupId>
29+
</dependency>
30+
<dependency>
31+
<!-- >>> Replace this with the "common" module's artifactId (e.g. my-services-common) -->
32+
<artifactId>platform-services-common</artifactId>
33+
<groupId>${project.groupId}</groupId>
34+
<type>test-jar</type>
35+
<classifier>tests</classifier>
36+
<scope>test</scope>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.testng</groupId>
40+
<artifactId>testng</artifactId>
41+
<scope>test</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>com.squareup.okhttp3</groupId>
45+
<artifactId>mockwebserver</artifactId>
46+
<scope>test</scope>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.slf4j</groupId>
50+
<artifactId>slf4j-jdk14</artifactId>
51+
<scope>test</scope>
52+
</dependency>
53+
</dependencies>
54+
</project>
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2026.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
/*
15+
* IBM OpenAPI SDK Code Generator Version: 3.111.0-1bfb72c2-20260206-185521
16+
*/
17+
18+
package com.ibm.cloud.platform_services.account_management.v4;
19+
20+
import com.ibm.cloud.platform_services.account_management.v4.model.AccountResponse;
21+
import com.ibm.cloud.platform_services.account_management.v4.model.GetAccountOptions;
22+
import com.ibm.cloud.platform_services.common.SdkCommon;
23+
import com.ibm.cloud.sdk.core.http.RequestBuilder;
24+
import com.ibm.cloud.sdk.core.http.ResponseConverter;
25+
import com.ibm.cloud.sdk.core.http.ServiceCall;
26+
import com.ibm.cloud.sdk.core.security.Authenticator;
27+
import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory;
28+
import com.ibm.cloud.sdk.core.service.BaseService;
29+
import com.ibm.cloud.sdk.core.util.ResponseConverterUtils;
30+
import java.util.HashMap;
31+
import java.util.Map;
32+
import java.util.Map.Entry;
33+
34+
/**
35+
* The Account Management API allows for the management of Account.
36+
*
37+
* API Version: 4.0.0
38+
*/
39+
public class AccountManagement extends BaseService {
40+
41+
/**
42+
* Default service name used when configuring the `AccountManagement` client.
43+
*/
44+
public static final String DEFAULT_SERVICE_NAME = "account_management";
45+
46+
/**
47+
* Default service endpoint URL.
48+
*/
49+
public static final String DEFAULT_SERVICE_URL = "https://accounts.test.cloud.ibm.com";
50+
51+
/**
52+
* Class method which constructs an instance of the `AccountManagement` client.
53+
* The default service name is used to configure the client instance.
54+
*
55+
* @return an instance of the `AccountManagement` client using external configuration
56+
*/
57+
public static AccountManagement newInstance() {
58+
return newInstance(DEFAULT_SERVICE_NAME);
59+
}
60+
61+
/**
62+
* Class method which constructs an instance of the `AccountManagement` client.
63+
* The specified service name is used to configure the client instance.
64+
*
65+
* @param serviceName the service name to be used when configuring the client instance
66+
* @return an instance of the `AccountManagement` client using external configuration
67+
*/
68+
public static AccountManagement newInstance(String serviceName) {
69+
Authenticator authenticator = ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName);
70+
AccountManagement service = new AccountManagement(serviceName, authenticator);
71+
service.configureService(serviceName);
72+
return service;
73+
}
74+
75+
/**
76+
* Constructs an instance of the `AccountManagement` client.
77+
* The specified service name and authenticator are used to configure the client instance.
78+
*
79+
* @param serviceName the service name to be used when configuring the client instance
80+
* @param authenticator the {@link Authenticator} instance to be configured for this client
81+
*/
82+
public AccountManagement(String serviceName, Authenticator authenticator) {
83+
super(serviceName, authenticator);
84+
setServiceUrl(DEFAULT_SERVICE_URL);
85+
}
86+
87+
/**
88+
* Get Account by Account ID.
89+
*
90+
* Returns the details of an account.
91+
*
92+
* @param getAccountOptions the {@link GetAccountOptions} containing the options for the call
93+
* @return a {@link ServiceCall} with a result of type {@link AccountResponse}
94+
*/
95+
public ServiceCall<AccountResponse> getAccount(GetAccountOptions getAccountOptions) {
96+
com.ibm.cloud.sdk.core.util.Validator.notNull(getAccountOptions,
97+
"getAccountOptions cannot be null");
98+
Map<String, String> pathParamsMap = new HashMap<String, String>();
99+
pathParamsMap.put("account_id", getAccountOptions.accountId());
100+
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v4/accounts/{account_id}", pathParamsMap));
101+
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("account_management", "v4", "getAccount");
102+
for (Entry<String, String> header : sdkHeaders.entrySet()) {
103+
builder.header(header.getKey(), header.getValue());
104+
}
105+
builder.header("Accept", "application/json");
106+
ResponseConverter<AccountResponse> responseConverter =
107+
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<AccountResponse>() { }.getType());
108+
return createServiceCall(builder.build(), responseConverter);
109+
}
110+
111+
}
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2026.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.cloud.platform_services.account_management.v4.model;
15+
16+
import com.google.gson.annotations.SerializedName;
17+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
18+
19+
/**
20+
* AccountResponse.
21+
*/
22+
public class AccountResponse extends GenericModel {
23+
24+
protected String name;
25+
protected String id;
26+
protected String owner;
27+
@SerializedName("owner_userid")
28+
protected String ownerUserid;
29+
@SerializedName("owner_iamid")
30+
protected String ownerIamid;
31+
protected String type;
32+
protected String status;
33+
@SerializedName("linked_softlayer_account")
34+
protected String linkedSoftlayerAccount;
35+
@SerializedName("team_directory_enabled")
36+
protected Boolean teamDirectoryEnabled;
37+
protected AccountResponseTraits traits;
38+
39+
protected AccountResponse() { }
40+
41+
/**
42+
* Gets the name.
43+
*
44+
* @return the name
45+
*/
46+
public String getName() {
47+
return name;
48+
}
49+
50+
/**
51+
* Gets the id.
52+
*
53+
* @return the id
54+
*/
55+
public String getId() {
56+
return id;
57+
}
58+
59+
/**
60+
* Gets the owner.
61+
*
62+
* @return the owner
63+
*/
64+
public String getOwner() {
65+
return owner;
66+
}
67+
68+
/**
69+
* Gets the ownerUserid.
70+
*
71+
* @return the ownerUserid
72+
*/
73+
public String getOwnerUserid() {
74+
return ownerUserid;
75+
}
76+
77+
/**
78+
* Gets the ownerIamid.
79+
*
80+
* @return the ownerIamid
81+
*/
82+
public String getOwnerIamid() {
83+
return ownerIamid;
84+
}
85+
86+
/**
87+
* Gets the type.
88+
*
89+
* @return the type
90+
*/
91+
public String getType() {
92+
return type;
93+
}
94+
95+
/**
96+
* Gets the status.
97+
*
98+
* @return the status
99+
*/
100+
public String getStatus() {
101+
return status;
102+
}
103+
104+
/**
105+
* Gets the linkedSoftlayerAccount.
106+
*
107+
* @return the linkedSoftlayerAccount
108+
*/
109+
public String getLinkedSoftlayerAccount() {
110+
return linkedSoftlayerAccount;
111+
}
112+
113+
/**
114+
* Gets the teamDirectoryEnabled.
115+
*
116+
* @return the teamDirectoryEnabled
117+
*/
118+
public Boolean isTeamDirectoryEnabled() {
119+
return teamDirectoryEnabled;
120+
}
121+
122+
/**
123+
* Gets the traits.
124+
*
125+
* @return the traits
126+
*/
127+
public AccountResponseTraits getTraits() {
128+
return traits;
129+
}
130+
}
131+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2026.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.cloud.platform_services.account_management.v4.model;
15+
16+
import com.google.gson.annotations.SerializedName;
17+
import com.ibm.cloud.sdk.core.service.model.GenericModel;
18+
19+
/**
20+
* AccountResponseTraits.
21+
*/
22+
public class AccountResponseTraits extends GenericModel {
23+
24+
@SerializedName("eu_supported")
25+
protected Boolean euSupported;
26+
protected Boolean poc;
27+
protected Boolean hippa;
28+
29+
protected AccountResponseTraits() { }
30+
31+
/**
32+
* Gets the euSupported.
33+
*
34+
* @return the euSupported
35+
*/
36+
public Boolean isEuSupported() {
37+
return euSupported;
38+
}
39+
40+
/**
41+
* Gets the poc.
42+
*
43+
* @return the poc
44+
*/
45+
public Boolean isPoc() {
46+
return poc;
47+
}
48+
49+
/**
50+
* Gets the hippa.
51+
*
52+
* @return the hippa
53+
*/
54+
public Boolean isHippa() {
55+
return hippa;
56+
}
57+
}
58+

0 commit comments

Comments
 (0)