Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@

package com.ibm.cloud.platform_services.global_catalog.v1;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ibm.cloud.platform_services.global_catalog.v1.model.Artifacts;
import com.ibm.cloud.platform_services.global_catalog.v1.model.AuditSearchResult;
import com.ibm.cloud.platform_services.global_catalog.v1.model.CatalogEntry;
Expand Down Expand Up @@ -41,17 +52,6 @@
import com.ibm.cloud.sdk.core.http.Response;
import com.ibm.cloud.sdk.core.service.exception.ServiceResponseException;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//
// This file provides an example of how to use the Global Catalog service.
//
Expand Down Expand Up @@ -80,6 +80,7 @@ public static void main(String[] args) throws Exception {
GlobalCatalog service = GlobalCatalog.newInstance();

String catalogEntryId = "";
CatalogEntry fetchedObject = null;

try {
System.out.println("createCatalogEntry() result:");
Expand Down Expand Up @@ -153,6 +154,7 @@ public static void main(String[] args) throws Exception {

Response<CatalogEntry> response = service.getCatalogEntry(getCatalogEntryOptions).execute();
CatalogEntry catalogEntry = response.getResult();
fetchedObject = catalogEntry;

System.out.println(catalogEntry);

Expand Down Expand Up @@ -208,6 +210,7 @@ public static void main(String[] args) throws Exception {
.provider(providerModel)
.active(true)
.metadata(metadataModel)
.url(fetchedObject.getUrl())
.build();

Response<CatalogEntry> response = service.updateCatalogEntry(updateCatalogEntryOptions).execute();
Expand Down Expand Up @@ -324,6 +327,7 @@ public static void main(String[] args) throws Exception {
System.out.println("updateVisibility returned the following error: " + e.getMessage());
}


try {
Comment thread
padamstx marked this conversation as resolved.
System.out.println("getPricing() result:");

Expand All @@ -344,6 +348,7 @@ public static void main(String[] args) throws Exception {
e.getMessage(), e.getDebuggingInfo()), e);
}


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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2025.
*
* 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-4c92c221-20210211-060810
* IBM OpenAPI SDK Code Generator Version: 3.102.0-615ec964-20250307-203034
*/

package com.ibm.cloud.platform_services.global_catalog.v1;
Expand All @@ -30,11 +30,13 @@
import com.ibm.cloud.platform_services.global_catalog.v1.model.GetAuditLogsOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.GetCatalogEntryOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.GetChildObjectsOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.GetPricingDeploymentsOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.GetPricingOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.GetVisibilityOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.ListArtifactsOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.ListCatalogEntriesOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.PricingGet;
import com.ibm.cloud.platform_services.global_catalog.v1.model.PricingSearchResult;
import com.ibm.cloud.platform_services.global_catalog.v1.model.RestoreCatalogEntryOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.UpdateCatalogEntryOptions;
import com.ibm.cloud.platform_services.global_catalog.v1.model.UpdateVisibilityOptions;
Expand All @@ -60,12 +62,18 @@
* regions, and more. For more information, see the [catalog
* documentation](https://cloud.ibm.com/docs/overview/catalog.html#global-catalog-overview).
*
* @version v1
* API Version: 1.0.3
*/
public class GlobalCatalog extends BaseService {

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

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

/**
Expand Down Expand Up @@ -208,6 +216,9 @@ public ServiceCall<CatalogEntry> createCatalogEntry(CreateCatalogEntryOptions cr
if (createCatalogEntryOptions.active() != null) {
contentJson.addProperty("active", createCatalogEntryOptions.active());
}
if (createCatalogEntryOptions.url() != null) {
contentJson.addProperty("url", createCatalogEntryOptions.url());
}
if (createCatalogEntryOptions.metadata() != null) {
contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createCatalogEntryOptions.metadata()));
}
Expand Down Expand Up @@ -301,6 +312,9 @@ public ServiceCall<CatalogEntry> updateCatalogEntry(UpdateCatalogEntryOptions up
if (updateCatalogEntryOptions.active() != null) {
contentJson.addProperty("active", updateCatalogEntryOptions.active());
}
if (updateCatalogEntryOptions.url() != null) {
contentJson.addProperty("url", updateCatalogEntryOptions.url());
}
if (updateCatalogEntryOptions.metadata() != null) {
contentJson.add("metadata", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(updateCatalogEntryOptions.metadata()));
}
Expand Down Expand Up @@ -507,11 +521,43 @@ public ServiceCall<PricingGet> getPricing(GetPricingOptions getPricingOptions) {
if (getPricingOptions.account() != null) {
builder.query("account", String.valueOf(getPricingOptions.account()));
}
if (getPricingOptions.deploymentRegion() != null) {
builder.query("deployment_region", String.valueOf(getPricingOptions.deploymentRegion()));
}
ResponseConverter<PricingGet> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<PricingGet>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* Get the pricing deployments for a plan.
*
* This endpoint returns the deployment pricing for a plan. For a plan it returns a pricing for each visible child
* deployment object. Static pricing is defined in the catalog. Dynamic pricing is stored in IBM Cloud Pricing
* Catalog. This can be used by an unauthenticated user for publicly available services.
*
* @param getPricingDeploymentsOptions the {@link GetPricingDeploymentsOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link PricingSearchResult}
*/
public ServiceCall<PricingSearchResult> getPricingDeployments(GetPricingDeploymentsOptions getPricingDeploymentsOptions) {
com.ibm.cloud.sdk.core.util.Validator.notNull(getPricingDeploymentsOptions,
"getPricingDeploymentsOptions cannot be null");
Map<String, String> pathParamsMap = new HashMap<String, String>();
pathParamsMap.put("id", getPricingDeploymentsOptions.id());
RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/{id}/pricing/deployment", pathParamsMap));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("global_catalog", "v1", "getPricingDeployments");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (getPricingDeploymentsOptions.account() != null) {
builder.query("account", String.valueOf(getPricingDeploymentsOptions.account()));
}
ResponseConverter<PricingSearchResult> responseConverter =
ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<PricingSearchResult>() { }.getType());
return createServiceCall(builder.build(), responseConverter);
}

/**
* Get the audit logs for an object.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2025.
*
* 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.global_catalog.v1.model;

import com.google.gson.annotations.SerializedName;
Expand All @@ -31,6 +32,11 @@ public static class Builder {
private String type;
private String planId;

/**
* Instantiates a new Builder from an existing AliasMetaData instance.
*
* @param aliasMetaData the instance to initialize the Builder with
*/
private Builder(AliasMetaData aliasMetaData) {
this.type = aliasMetaData.type;
this.planId = aliasMetaData.planId;
Expand Down Expand Up @@ -74,6 +80,8 @@ public Builder planId(String planId) {
}
}

protected AliasMetaData() { }

protected AliasMetaData(Builder builder) {
type = builder.type;
planId = builder.planId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2025.
*
* 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.global_catalog.v1.model;

import java.util.ArrayList;
Expand All @@ -34,6 +35,11 @@ public static class Builder {
private String currency;
private List<Price> prices;

/**
* Instantiates a new Builder from an existing Amount instance.
*
* @param amount the instance to initialize the Builder with
*/
private Builder(Amount amount) {
this.country = amount.country;
this.currency = amount.currency;
Expand All @@ -56,9 +62,9 @@ public Amount build() {
}

/**
* Adds an prices to prices.
* Adds a new element to prices.
*
* @param prices the new prices
* @param prices the new element to be added
* @return the Amount builder
*/
public Builder addPrices(Price prices) {
Expand Down Expand Up @@ -106,6 +112,8 @@ public Builder prices(List<Price> prices) {
}
}

protected Amount() { }

protected Amount(Builder builder) {
country = builder.country;
currency = builder.currency;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2025.
*
* 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.global_catalog.v1.model;

import java.util.Date;
Expand All @@ -27,6 +28,8 @@ public class Artifact extends GenericModel {
protected String etag;
protected Long size;

protected Artifact() { }

/**
* Gets the name.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2025.
*
* 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.global_catalog.v1.model;

import java.util.List;
Expand All @@ -24,6 +25,8 @@ public class Artifacts extends GenericModel {
protected Long count;
protected List<Artifact> resources;

protected Artifacts() { }

/**
* Gets the count.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2025.
*
* 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.global_catalog.v1.model;

import java.util.List;
Expand All @@ -33,6 +34,8 @@ public class AuditSearchResult extends GenericModel {
protected String next;
protected List<Message> resources;

protected AuditSearchResult() { }

/**
* Gets the offset.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2021.
* (C) Copyright IBM Corp. 2025.
*
* 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.global_catalog.v1.model;

import com.ibm.cloud.sdk.core.service.model.GenericModel;
Expand All @@ -29,6 +30,11 @@ public static class Builder {
private String name;
private String guid;

/**
* Instantiates a new Builder from an existing Broker instance.
*
* @param broker the instance to initialize the Builder with
*/
private Builder(Broker broker) {
this.name = broker.name;
this.guid = broker.guid;
Expand Down Expand Up @@ -72,6 +78,8 @@ public Builder guid(String guid) {
}
}

protected Broker() { }

protected Broker(Builder builder) {
name = builder.name;
guid = builder.guid;
Expand Down
Loading