Skip to content

Commit

Permalink
feat(Context-Based Restrictions): add Service Ref Target (#234)
Browse files Browse the repository at this point in the history
Signed-off-by: Dylan <Dylan.Yu@ibm.com>
  • Loading branch information
JonahFarc authored Mar 8, 2024
1 parent c38a4db commit 54d906b
Show file tree
Hide file tree
Showing 86 changed files with 528 additions and 109 deletions.
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 @@ -12,7 +12,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 3.81.0-c73a091c-20231026-215706
* IBM OpenAPI SDK Code Generator Version: 3.86.0-bc6f14b3-20240221-193958
*/

package com.ibm.cloud.platform_services.context_based_restrictions.v1;
Expand All @@ -26,6 +26,7 @@
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.DeleteZoneOptions;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.GetAccountSettingsOptions;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.GetRuleOptions;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.GetServicerefTargetOptions;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.GetZoneOptions;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.ListAvailableServiceOperationsOptions;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.ListAvailableServicerefTargetsOptions;
Expand All @@ -36,6 +37,7 @@
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.ReplaceZoneOptions;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.Rule;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.RuleList;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.ServiceRefTarget;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.ServiceRefTargetList;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.Zone;
import com.ibm.cloud.platform_services.context_based_restrictions.v1.model.ZoneList;
Expand Down Expand Up @@ -353,6 +355,36 @@ public ServiceCall<ServiceRefTargetList> listAvailableServicerefTargets() {
return listAvailableServicerefTargets(null);
}

/**
* Get service reference target for a specified service name.
*
* This operation gets the service reference target for a specified service name.
*
* @param getServicerefTargetOptions the {@link GetServicerefTargetOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link ServiceRefTarget}
*/
public ServiceCall<ServiceRefTarget> getServicerefTarget(GetServicerefTargetOptions getServicerefTargetOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getServicerefTargetOptions,
"getServicerefTargetOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("service_name", getServicerefTargetOptions.serviceName());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/zones/serviceref_targets/{service_name}", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("context_based_restrictions", "v1", "getServicerefTarget");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getServicerefTargetOptions.xCorrelationId() != null) {
builder.header("X-Correlation-Id", getServicerefTargetOptions.xCorrelationId());
}
if (getServicerefTargetOptions.transactionId() != null) {
builder.header("Transaction-Id", getServicerefTargetOptions.transactionId());
}
ResponseConverter<ServiceRefTarget> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<ServiceRefTarget>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* Create a rule.
*
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 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 Down Expand Up @@ -28,10 +28,14 @@ public class AccountSettings extends GenericModel {
protected Long ruleCountLimit;
@SerializedName("zone_count_limit")
protected Long zoneCountLimit;
@SerializedName("tags_rule_count_limit")
protected Long tagsRuleCountLimit;
@SerializedName("current_rule_count")
protected Long currentRuleCount;
@SerializedName("current_zone_count")
protected Long currentZoneCount;
@SerializedName("current_tags_rule_count")
protected Long currentTagsRuleCount;
protected String href;
@SerializedName("created_at")
protected Date createdAt;
Expand Down Expand Up @@ -88,6 +92,17 @@ public Long getZoneCountLimit() {
return zoneCountLimit;
}

/**
* Gets the tagsRuleCountLimit.
*
* the max number of rules with tags allowed for the account.
*
* @return the tagsRuleCountLimit
*/
public Long getTagsRuleCountLimit() {
return tagsRuleCountLimit;
}

/**
* Gets the currentRuleCount.
*
Expand All @@ -110,6 +125,17 @@ public Long getCurrentZoneCount() {
return currentZoneCount;
}

/**
* Gets the currentTagsRuleCount.
*
* the current number of rules with tags used by the account.
*
* @return the currentTagsRuleCount
*/
public Long getCurrentTagsRuleCount() {
return currentTagsRuleCount;
}

/**
* Gets the href.
*
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 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 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 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 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 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 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 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 Down Expand Up @@ -88,9 +88,9 @@ public CreateRuleOptions build() {
}

/**
* Adds an contexts to contexts.
* Adds a new element to contexts.
*
* @param contexts the new contexts
* @param contexts the new element to be added
* @return the CreateRuleOptions builder
*/
public Builder addContexts(RuleContext contexts) {
Expand All @@ -104,9 +104,9 @@ public Builder addContexts(RuleContext contexts) {
}

/**
* Adds an resources to resources.
* Adds a new element to resources.
*
* @param resources the new resources
* @param resources the new element to be added
* @return the CreateRuleOptions builder
*/
public Builder addResources(Resource resources) {
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 Down Expand Up @@ -73,9 +73,9 @@ public CreateZoneOptions build() {
}

/**
* Adds an addresses to addresses.
* Adds a new element to addresses.
*
* @param addresses the new addresses
* @param addresses the new element to be added
* @return the CreateZoneOptions builder
*/
public Builder addAddresses(Address addresses) {
Expand All @@ -89,9 +89,9 @@ public Builder addAddresses(Address addresses) {
}

/**
* Adds an excluded to excluded.
* Adds a new element to excluded.
*
* @param excluded the new excluded
* @param excluded the new element to be added
* @return the CreateZoneOptions builder
*/
public Builder addExcluded(Address excluded) {
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 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 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 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 Down
Loading

0 comments on commit 54d906b

Please sign in to comment.