Skip to content

Commit

Permalink
feat(Context-Based Restrictions): add service group support to operat…
Browse files Browse the repository at this point in the history
…ions (#211)

Signed-off-by: Dylan <[email protected]>
  • Loading branch information
JonahFarc authored Sep 15, 2023
1 parent f74707d commit 73a19fe
Show file tree
Hide file tree
Showing 83 changed files with 535 additions and 169 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022.
* (C) Copyright IBM Corp. 2023.
*
* 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: 3.57.1-4c556507-20220928-143422
* IBM OpenAPI SDK Code Generator Version: 3.79.0-2eb6af3d-20230905-174838
*/

package com.ibm.cloud.platform_services.context_based_restrictions.v1;
Expand Down Expand Up @@ -61,8 +61,14 @@
*/
public class ContextBasedRestrictions extends BaseService {

/**
* Default service name used when configuring the `ContextBasedRestrictions` client.
*/
public static final String DEFAULT_SERVICE_NAME = "context_based_restrictions";

/**
* Default service endpoint URL.
*/
public static final String DEFAULT_SERVICE_URL = "https://cbr.cloud.ibm.com";

/**
Expand Down Expand Up @@ -613,8 +619,9 @@ public ServiceCall<AccountSettings> getAccountSettings(GetAccountSettingsOptions
* @return a {@link ServiceCall} with a result of type {@link OperationsList}
*/
public ServiceCall<OperationsList> listAvailableServiceOperations(ListAvailableServiceOperationsOptions listAvailableServiceOperationsOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(listAvailableServiceOperationsOptions,
"listAvailableServiceOperationsOptions cannot be null");
if (listAvailableServiceOperationsOptions == null) {
listAvailableServiceOperationsOptions = new ListAvailableServiceOperationsOptions.Builder().build();
}
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/operations"));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("context_based_restrictions", "v1", "listAvailableServiceOperations");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
Expand All @@ -627,10 +634,29 @@ public ServiceCall<OperationsList> listAvailableServiceOperations(ListAvailableS
if (listAvailableServiceOperationsOptions.transactionId() != null) {
builder.header("Transaction-Id", listAvailableServiceOperationsOptions.transactionId());
}
builder.query("service_name", String.valueOf(listAvailableServiceOperationsOptions.serviceName()));
if (listAvailableServiceOperationsOptions.serviceName() != null) {
builder.query("service_name", String.valueOf(listAvailableServiceOperationsOptions.serviceName()));
}
if (listAvailableServiceOperationsOptions.serviceGroupId() != null) {
builder.query("service_group_id", String.valueOf(listAvailableServiceOperationsOptions.serviceGroupId()));
}
if (listAvailableServiceOperationsOptions.resourceType() != null) {
builder.query("resource_type", String.valueOf(listAvailableServiceOperationsOptions.resourceType()));
}
ResponseConverter<OperationsList> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<OperationsList>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* List available service operations.
*
* This operation lists all available service operations.
*
* @return a {@link ServiceCall} with a result of type {@link OperationsList}
*/
public ServiceCall<OperationsList> listAvailableServiceOperations() {
return listAvailableServiceOperations(null);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2022.
* (C) Copyright IBM Corp. 2023.
*
* 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 Down Expand Up @@ -27,8 +27,11 @@ public class APIType extends GenericModel {
@SerializedName("display_name")
protected String displayName;
protected String description;
protected String type;
protected List<Action> actions;

protected APIType() { }

/**
* Gets the apiTypeId.
*
Expand Down Expand Up @@ -62,6 +65,17 @@ public String getDescription() {
return description;
}

/**
* Gets the type.
*
* The type of the API type.
*
* @return the type
*/
public String getType() {
return type;
}

/**
* Gets the actions.
*
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. 2023.
*
* 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 Down Expand Up @@ -42,6 +42,8 @@ public class AccountSettings extends GenericModel {
@SerializedName("last_modified_by_id")
protected String lastModifiedById;

protected AccountSettings() { }

/**
* Gets the id.
*
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. 2023.
*
* 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 @@ -24,6 +24,8 @@ public class Action extends GenericModel {
protected String actionId;
protected String description;

protected Action() { }

/**
* Gets the actionId.
*
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. 2023.
*
* 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 Down Expand Up @@ -57,8 +57,7 @@ public interface Type {
protected String value;
protected ServiceRefValue ref;

protected Address() {
}
protected Address() { }

/**
* Gets the type.
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. 2023.
*
* 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 @@ -13,7 +13,7 @@
package com.ibm.cloud.platform_services.context_based_restrictions.v1.model;

/**
* A single IP address.
* A single IP address. IPv4 and IPv6 are supported.
*/
public class AddressIPAddress extends Address {

Expand All @@ -33,6 +33,11 @@ public static class Builder {
private String type;
private String value;

/**
* Instantiates a new Builder from an existing AddressIPAddress instance.
*
* @param addressIpAddress the instance to initialize the Builder with
*/
public Builder(Address addressIpAddress) {
this.type = addressIpAddress.type;
this.value = addressIpAddress.value;
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. 2023.
*
* 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 @@ -13,7 +13,7 @@
package com.ibm.cloud.platform_services.context_based_restrictions.v1.model;

/**
* An IP address range.
* An IP address range. IPv4 and IPv6 are supported.
*/
public class AddressIPAddressRange extends Address {

Expand All @@ -33,6 +33,11 @@ public static class Builder {
private String type;
private String value;

/**
* Instantiates a new Builder from an existing AddressIPAddressRange instance.
*
* @param addressIpAddressRange the instance to initialize the Builder with
*/
public Builder(Address addressIpAddressRange) {
this.type = addressIpAddressRange.type;
this.value = addressIpAddressRange.value;
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. 2023.
*
* 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 Down Expand Up @@ -33,6 +33,11 @@ public static class Builder {
private String type;
private ServiceRefValue ref;

/**
* Instantiates a new Builder from an existing AddressServiceRef instance.
*
* @param addressServiceRef the instance to initialize the Builder with
*/
public Builder(Address addressServiceRef) {
this.type = addressServiceRef.type;
this.ref = addressServiceRef.ref;
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. 2023.
*
* 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 Down Expand Up @@ -33,6 +33,11 @@ public static class Builder {
private String type;
private String value;

/**
* Instantiates a new Builder from an existing AddressSubnet instance.
*
* @param addressSubnet the instance to initialize the Builder with
*/
public Builder(Address addressSubnet) {
this.type = addressSubnet.type;
this.value = addressSubnet.value;
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. 2023.
*
* 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 Down Expand Up @@ -33,6 +33,11 @@ public static class Builder {
private String type;
private String value;

/**
* Instantiates a new Builder from an existing AddressVPC instance.
*
* @param addressVpc the instance to initialize the Builder with
*/
public Builder(Address addressVpc) {
this.type = addressVpc.type;
this.value = addressVpc.value;
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. 2023.
*
* 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 Down Expand Up @@ -57,6 +57,11 @@ public static class Builder {
private String xCorrelationId;
private String transactionId;

/**
* Instantiates a new Builder from an existing CreateRuleOptions instance.
*
* @param createRuleOptions the instance to initialize the Builder with
*/
private Builder(CreateRuleOptions createRuleOptions) {
this.description = createRuleOptions.description;
this.contexts = createRuleOptions.contexts;
Expand Down Expand Up @@ -187,7 +192,9 @@ public Builder xCorrelationId(String xCorrelationId) {
*
* @param transactionId the transactionId
* @return the CreateRuleOptions builder
* @deprecated this method is deprecated and may be removed in a future release
*/
@Deprecated
public Builder transactionId(String transactionId) {
this.transactionId = transactionId;
return this;
Expand Down Expand Up @@ -294,7 +301,9 @@ public String xCorrelationId() {
* `Transaction-Id` are provided, `X-Correlation-Id` has the precedence over `Transaction-Id`.
*
* @return the transactionId
* @deprecated this method is deprecated and may be removed in a future release
*/
@Deprecated
public String transactionId() {
return transactionId;
}
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. 2023.
*
* 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 Down Expand Up @@ -42,6 +42,11 @@ public static class Builder {
private String xCorrelationId;
private String transactionId;

/**
* Instantiates a new Builder from an existing CreateZoneOptions instance.
*
* @param createZoneOptions the instance to initialize the Builder with
*/
private Builder(CreateZoneOptions createZoneOptions) {
this.name = createZoneOptions.name;
this.accountId = createZoneOptions.accountId;
Expand Down Expand Up @@ -172,7 +177,9 @@ public Builder xCorrelationId(String xCorrelationId) {
*
* @param transactionId the transactionId
* @return the CreateZoneOptions builder
* @deprecated this method is deprecated and may be removed in a future release
*/
@Deprecated
public Builder transactionId(String transactionId) {
this.transactionId = transactionId;
return this;
Expand Down Expand Up @@ -277,7 +284,9 @@ public String xCorrelationId() {
* `Transaction-Id` are provided, `X-Correlation-Id` has the precedence over `Transaction-Id`.
*
* @return the transactionId
* @deprecated this method is deprecated and may be removed in a future release
*/
@Deprecated
public String transactionId() {
return transactionId;
}
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. 2023.
*
* 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 Down Expand Up @@ -31,6 +31,11 @@ public static class Builder {
private String xCorrelationId;
private String transactionId;

/**
* Instantiates a new Builder from an existing DeleteRuleOptions instance.
*
* @param deleteRuleOptions the instance to initialize the Builder with
*/
private Builder(DeleteRuleOptions deleteRuleOptions) {
this.ruleId = deleteRuleOptions.ruleId;
this.xCorrelationId = deleteRuleOptions.xCorrelationId;
Expand Down Expand Up @@ -88,7 +93,9 @@ public Builder xCorrelationId(String xCorrelationId) {
*
* @param transactionId the transactionId
* @return the DeleteRuleOptions builder
* @deprecated this method is deprecated and may be removed in a future release
*/
@Deprecated
public Builder transactionId(String transactionId) {
this.transactionId = transactionId;
return this;
Expand Down Expand Up @@ -146,7 +153,9 @@ public String xCorrelationId() {
* `Transaction-Id` are provided, `X-Correlation-Id` has the precedence over `Transaction-Id`.
*
* @return the transactionId
* @deprecated this method is deprecated and may be removed in a future release
*/
@Deprecated
public String transactionId() {
return transactionId;
}
Expand Down
Loading

0 comments on commit 73a19fe

Please sign in to comment.