Skip to content

Commit

Permalink
feat(Resource Controller): Added onetime_credentials property in Reso…
Browse files Browse the repository at this point in the history
…urceInstance and ResourceKey schemas

Signed-off-by: arshabbir <arshabbir@ibm.com>
  • Loading branch information
arshabbir committed Jul 3, 2024
1 parent b1d71b2 commit 1b6991a
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022.
* (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 @@ -12,7 +12,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-f381b8c9-20221101-115055
* IBM OpenAPI SDK Code Generator Version: 3.91.0-d9755c53-20240605-153412
*/

package com.ibm.cloud.platform_services.resource_controller.v2;
Expand Down Expand Up @@ -1018,6 +1018,9 @@ public ServiceCall<ReclamationsList> listReclamations(ListReclamationsOptions li
if (listReclamationsOptions.resourceInstanceId() != null) {
builder.query("resource_instance_id", String.valueOf(listReclamationsOptions.resourceInstanceId()));
}
if (listReclamationsOptions.resourceGroupId() != null) {
builder.query("resource_group_id", String.valueOf(listReclamationsOptions.resourceGroupId()));
}
ResponseConverter<ReclamationsList> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<ReclamationsList>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022.
* (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.resource_controller.v2.model;

import java.util.ArrayList;
Expand Down Expand Up @@ -92,9 +93,9 @@ public CreateResourceInstanceOptions build() {
}

/**
* Adds an tags to tags.
* Adds a new element to tags.
*
* @param tags the new tags
* @param tags the new element to be added
* @return the CreateResourceInstanceOptions builder
*/
public Builder addTags(String tags) {
Expand Down Expand Up @@ -299,7 +300,9 @@ public Boolean allowCleanup() {
/**
* Gets the parameters.
*
* Configuration options represented as key-value pairs that are passed through to the target resource brokers.
* Configuration options represented as key-value pairs that are passed through to the target resource brokers. Set
* the `onetime_credentials` property to specify whether newly created resource key credentials can be retrieved by
* using get resource key or get a list of all of the resource keys requests.
*
* @return the parameters
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022.
* (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.resource_controller.v2.model;

import com.ibm.cloud.sdk.core.service.model.GenericModel;
Expand All @@ -21,13 +22,15 @@ public class ListReclamationsOptions extends GenericModel {

protected String accountId;
protected String resourceInstanceId;
protected String resourceGroupId;

/**
* Builder.
*/
public static class Builder {
private String accountId;
private String resourceInstanceId;
private String resourceGroupId;

/**
* Instantiates a new Builder from an existing ListReclamationsOptions instance.
Expand All @@ -37,6 +40,7 @@ public static class Builder {
private Builder(ListReclamationsOptions listReclamationsOptions) {
this.accountId = listReclamationsOptions.accountId;
this.resourceInstanceId = listReclamationsOptions.resourceInstanceId;
this.resourceGroupId = listReclamationsOptions.resourceGroupId;
}

/**
Expand Down Expand Up @@ -75,13 +79,25 @@ public Builder resourceInstanceId(String resourceInstanceId) {
this.resourceInstanceId = resourceInstanceId;
return this;
}

/**
* Set the resourceGroupId.
*
* @param resourceGroupId the resourceGroupId
* @return the ListReclamationsOptions builder
*/
public Builder resourceGroupId(String resourceGroupId) {
this.resourceGroupId = resourceGroupId;
return this;
}
}

protected ListReclamationsOptions() { }

protected ListReclamationsOptions(Builder builder) {
accountId = builder.accountId;
resourceInstanceId = builder.resourceInstanceId;
resourceGroupId = builder.resourceGroupId;
}

/**
Expand Down Expand Up @@ -114,5 +130,16 @@ public String accountId() {
public String resourceInstanceId() {
return resourceInstanceId;
}

/**
* Gets the resourceGroupId.
*
* The ID of the resource group.
*
* @return the resourceGroupId
*/
public String resourceGroupId() {
return resourceGroupId;
}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022.
* (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.resource_controller.v2.model;

import java.util.Date;
Expand Down Expand Up @@ -84,6 +85,8 @@ public interface State {
protected String resourceGroupCrn;
@SerializedName("target_crn")
protected String targetCrn;
@SerializedName("onetime_credentials")
protected Boolean onetimeCredentials;
protected Map<String, Object> parameters;
@SerializedName("allow_cleanup")
protected Boolean allowCleanup;
Expand Down Expand Up @@ -346,6 +349,18 @@ public String getTargetCrn() {
return targetCrn;
}

/**
* Gets the onetimeCredentials.
*
* Whether newly created resource key credentials can be retrieved by using get resource key or get a list of all of
* the resource keys requests.
*
* @return the onetimeCredentials
*/
public Boolean isOnetimeCredentials() {
return onetimeCredentials;
}

/**
* Gets the parameters.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022.
* (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.resource_controller.v2.model;

import java.util.Date;
Expand Down Expand Up @@ -48,6 +49,8 @@ public class ResourceKey extends GenericModel {
protected String resourceGroupId;
@SerializedName("resource_id")
protected String resourceId;
@SerializedName("onetime_credentials")
protected Boolean onetimeCredentials;
protected Credentials credentials;
@SerializedName("iam_compatible")
protected Boolean iamCompatible;
Expand Down Expand Up @@ -236,6 +239,18 @@ public String getResourceId() {
return resourceId;
}

/**
* Gets the onetimeCredentials.
*
* Whether newly created resource key credentials can be retrieved by using get resource key or get a list of all of
* the resource keys requests.
*
* @return the onetimeCredentials
*/
public Boolean isOnetimeCredentials() {
return onetimeCredentials;
}

/**
* Gets the credentials.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022.
* (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.resource_controller.v2.model;

import java.util.Map;
Expand Down Expand Up @@ -177,7 +178,9 @@ public String name() {
/**
* Gets the parameters.
*
* The new configuration options for the instance.
* The new configuration options for the instance. Set the `onetime_credentials` property to specify whether newly
* created resource key credentials can be retrieved by using get resource key or get a list of all of the resource
* keys requests.
*
* @return the parameters
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ public void test01GetResourceInstance() {

ResourceInstance result = response.getResult();
assertNotNull(result);
assertNotNull(result.isOnetimeCredentials());
assertEquals(result.getId(), testInstanceCrn);
assertEquals(result.getGuid(), testInstanceGuid);
assertEquals(result.getCrn(), testInstanceCrn);
Expand Down Expand Up @@ -915,6 +916,7 @@ public void test19GetResourceKey() {

ResourceKey result = response.getResult();
assertNotNull(result);
assertNotNull(result.isOnetimeCredentials());
assertEquals(result.getId(), testInstanceKeyCrn);
assertEquals(result.getGuid(), testInstanceKeyGuid);
assertEquals(result.getCrn(), testInstanceKeyCrn);
Expand Down
Loading

0 comments on commit 1b6991a

Please sign in to comment.