From 55d4ddec4c4a703a73c14571b6084b0b3f051c28 Mon Sep 17 00:00:00 2001 From: Gaurav Goswami Date: Thu, 24 Jun 2021 19:12:22 +0530 Subject: [PATCH] fix(SDK): regeneration after content review --- .../ibm/cloud/scc/findings/v1/Findings.java | 193 +++++++++++------- .../v1/model/ApiListProvidersResponse.java | 6 +- .../cloud/scc/findings/v1/model/ApiNote.java | 18 +- .../findings/v1/model/ApiNoteRelatedUrl.java | 2 +- .../scc/findings/v1/model/ApiOccurrence.java | 6 +- .../scc/findings/v1/model/ApiProvider.java | 6 +- .../findings/v1/model/CreateNoteOptions.java | 20 +- .../v1/model/CreateOccurrenceOptions.java | 52 +++-- .../findings/v1/model/DeleteNoteOptions.java | 4 +- .../v1/model/DeleteOccurrenceOptions.java | 6 +- .../scc/findings/v1/model/GetNoteOptions.java | 4 +- .../v1/model/GetOccurrenceNoteOptions.java | 4 +- .../v1/model/GetOccurrenceOptions.java | 4 +- .../v1/model/ListNoteOccurrencesOptions.java | 4 +- .../findings/v1/model/ListNotesOptions.java | 4 +- .../v1/model/ListOccurrencesOptions.java | 6 +- .../v1/model/ListProvidersOptions.java | 9 +- .../findings/v1/model/PostGraphOptions.java | 2 +- .../findings/v1/model/UpdateNoteOptions.java | 20 +- .../v1/model/UpdateOccurrenceOptions.java | 10 +- .../cloud/scc/findings/v1/package-info.java | 2 +- .../cloud/scc/findings/v1/FindingsTest.java | 94 ++++----- .../v1/model/CreateOccurrenceOptionsTest.java | 4 +- 23 files changed, 250 insertions(+), 230 deletions(-) diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/Findings.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/Findings.java index 4c44a34b..45214b63 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/Findings.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/Findings.java @@ -12,7 +12,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.33.0-caf29bd0-20210603-225214 + * IBM OpenAPI SDK Code Generator Version: 3.34.1-ad041667-20210617-195430 */ package com.ibm.cloud.scc.findings.v1; @@ -51,7 +51,9 @@ import java.util.Map.Entry; /** - * API specification for the Findings service. + * The Findings API is used to find and display occurrences of security issues in your IBM Cloud account by using the + * artifact metadata specification. Findings are summarized in cards in the Security and Compliance Center that allow + * you to see the security status of your account at a glance and start an investigation into any potential issues. * * @version v1 */ @@ -125,9 +127,10 @@ public void setAccountId(final String accountId) { } /** - * query findings. + * Query findings. * - * query findings. + * Query findings by using the GraphQL query language. For more information about using GraphQL, see the [GraphQL + * documentation](https://graphql.org/learn/). * * @param postGraphOptions the {@link PostGraphOptions} containing the options for the call * @return a {@link ServiceCall} with a void result @@ -151,17 +154,73 @@ public ServiceCall postGraph(PostGraphOptions postGraphOptions) { builder.header("Content-Type", postGraphOptions.contentType()); } if (postGraphOptions.transactionId() != null) { - builder.header("Transaction-Id", postGraphOptions.transactionId()); + builder.header("transaction_id", postGraphOptions.transactionId()); } builder.bodyContent(postGraphOptions.contentType(), null, null, postGraphOptions.body()); ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); + return createServiceCall(builder.build(), responseConverter); + } + /** + * List providers. + * + * List all of the providers for a specified account. + * + * @param listProvidersOptions the {@link ListProvidersOptions} containing the options for the call + * @return a {@link ServiceCall} with a result of type {@link ApiListProvidersResponse} + */ + public ServiceCall listProviders(ListProvidersOptions listProvidersOptions) { + if (listProvidersOptions == null) { + listProvidersOptions = new ListProvidersOptions.Builder().build(); + } + Map pathParamsMap = new HashMap(); + pathParamsMap.put("account_id", this.accountId); + RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers", pathParamsMap)); + Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "listProviders"); + for (Entry header : sdkHeaders.entrySet()) { + builder.header(header.getKey(), header.getValue()); + } + builder.header("Accept", "application/json"); + if (listProvidersOptions.transactionId() != null) { + builder.header("transaction_id", listProvidersOptions.transactionId()); + } + if (listProvidersOptions.limit() != null) { + builder.query("limit", String.valueOf(listProvidersOptions.limit())); + } + if (listProvidersOptions.skip() != null) { + builder.query("skip", String.valueOf(listProvidersOptions.skip())); + } + if (listProvidersOptions.startProviderId() != null) { + builder.query("start_provider_id", String.valueOf(listProvidersOptions.startProviderId())); + } + if (listProvidersOptions.endProviderId() != null) { + builder.query("end_provider_id", String.valueOf(listProvidersOptions.endProviderId())); + } + ResponseConverter responseConverter = + ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); return createServiceCall(builder.build(), responseConverter); } /** - * Creates a new `Note`. + * List providers. + * + * List all of the providers for a specified account. + * + * @return a {@link ServiceCall} with a result of type {@link ApiListProvidersResponse} + */ + public ServiceCall listProviders() { + return listProviders(null); + } + + /** + * Create a note. + * + * Register a new finding type with the Security and Compliance Center. + * + * A successful request creates a note with a high-level description of a particular type of finding. To learn more + * about creating notes to register findings, see [Custom + * findings](/docs/security-advisor?topic=security-advisor-setup_custom). * * @param createNoteOptions the {@link CreateNoteOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiNote} @@ -179,7 +238,7 @@ public ServiceCall createNote(CreateNoteOptions createNoteOptions) { } builder.header("Accept", "application/json"); if (createNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", createNoteOptions.transactionId()); + builder.header("transaction_id", createNoteOptions.transactionId()); } final JsonObject contentJson = new JsonObject(); contentJson.addProperty("short_description", createNoteOptions.shortDescription()); @@ -215,7 +274,9 @@ public ServiceCall createNote(CreateNoteOptions createNoteOptions) { } /** - * Lists all `Notes` for a given provider. + * List notes. + * + * List all of the available notes for a specific provider. * * @param listNotesOptions the {@link ListNotesOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiListNotesResponse} @@ -233,7 +294,7 @@ public ServiceCall listNotes(ListNotesOptions listNotesOpt } builder.header("Accept", "application/json"); if (listNotesOptions.transactionId() != null) { - builder.header("Transaction-Id", listNotesOptions.transactionId()); + builder.header("transaction_id", listNotesOptions.transactionId()); } if (listNotesOptions.pageSize() != null) { builder.query("page_size", String.valueOf(listNotesOptions.pageSize())); @@ -247,7 +308,9 @@ public ServiceCall listNotes(ListNotesOptions listNotesOpt } /** - * Returns the requested `Note`. + * Get a note by provider. + * + * Get the details of the note that is associated with a specified note ID and provider ID. * * @param getNoteOptions the {@link GetNoteOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiNote} @@ -266,7 +329,7 @@ public ServiceCall getNote(GetNoteOptions getNoteOptions) { } builder.header("Accept", "application/json"); if (getNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", getNoteOptions.transactionId()); + builder.header("transaction_id", getNoteOptions.transactionId()); } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -274,7 +337,9 @@ public ServiceCall getNote(GetNoteOptions getNoteOptions) { } /** - * Updates an existing `Note`. + * Update a note. + * + * Update a note that already exists in your account. * * @param updateNoteOptions the {@link UpdateNoteOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiNote} @@ -293,7 +358,7 @@ public ServiceCall updateNote(UpdateNoteOptions updateNoteOptions) { } builder.header("Accept", "application/json"); if (updateNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", updateNoteOptions.transactionId()); + builder.header("transaction_id", updateNoteOptions.transactionId()); } final JsonObject contentJson = new JsonObject(); contentJson.addProperty("short_description", updateNoteOptions.shortDescription()); @@ -329,7 +394,9 @@ public ServiceCall updateNote(UpdateNoteOptions updateNoteOptions) { } /** - * Deletes the given `Note` from the system. + * Delete a note. + * + * Delete a note with the ID and provider ID that you specify. * * @param deleteNoteOptions the {@link DeleteNoteOptions} containing the options for the call * @return a {@link ServiceCall} with a void result @@ -348,14 +415,16 @@ public ServiceCall deleteNote(DeleteNoteOptions deleteNoteOptions) { } builder.header("Accept", "application/json"); if (deleteNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", deleteNoteOptions.transactionId()); + builder.header("transaction_id", deleteNoteOptions.transactionId()); } ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } /** - * Gets the `Note` attached to the given `Occurrence`. + * Get a note by occurrence. + * + * Get a note that is associated with the occurrence ID that you specify. * * @param getOccurrenceNoteOptions the {@link GetOccurrenceNoteOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiNote} @@ -374,7 +443,7 @@ public ServiceCall getOccurrenceNote(GetOccurrenceNoteOptions getOccurr } builder.header("Accept", "application/json"); if (getOccurrenceNoteOptions.transactionId() != null) { - builder.header("Transaction-Id", getOccurrenceNoteOptions.transactionId()); + builder.header("transaction_id", getOccurrenceNoteOptions.transactionId()); } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -382,7 +451,12 @@ public ServiceCall getOccurrenceNote(GetOccurrenceNoteOptions getOccurr } /** - * Creates a new `Occurrence`. Use this method to create `Occurrences` for a resource. + * Create an occurrence. + * + * Create an occurrence to denote the existence of a particular type of finding. + * + * An occurrence describes provider-specific details of a note and contains vulnerability details, remediation steps, + * and other general information. * * @param createOccurrenceOptions the {@link CreateOccurrenceOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiOccurrence} @@ -399,12 +473,12 @@ public ServiceCall createOccurrence(CreateOccurrenceOptions creat builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); + if (createOccurrenceOptions.transactionId() != null) { + builder.header("transaction_id", createOccurrenceOptions.transactionId()); + } if (createOccurrenceOptions.replaceIfExists() != null) { builder.header("Replace-If-Exists", createOccurrenceOptions.replaceIfExists()); } - if (createOccurrenceOptions.transactionId() != null) { - builder.header("Transaction-Id", createOccurrenceOptions.transactionId()); - } final JsonObject contentJson = new JsonObject(); contentJson.addProperty("note_name", createOccurrenceOptions.noteName()); contentJson.addProperty("kind", createOccurrenceOptions.kind()); @@ -434,7 +508,9 @@ public ServiceCall createOccurrence(CreateOccurrenceOptions creat } /** - * Lists active `Occurrences` for a given provider matching the filters. + * List occurrences. + * + * List all of the occurrences that are associated with the provider ID that you specify. * * @param listOccurrencesOptions the {@link ListOccurrencesOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiListOccurrencesResponse} @@ -452,7 +528,7 @@ public ServiceCall listOccurrences(ListOccurrencesOp } builder.header("Accept", "application/json"); if (listOccurrencesOptions.transactionId() != null) { - builder.header("Transaction-Id", listOccurrencesOptions.transactionId()); + builder.header("transaction_id", listOccurrencesOptions.transactionId()); } if (listOccurrencesOptions.pageSize() != null) { builder.query("page_size", String.valueOf(listOccurrencesOptions.pageSize())); @@ -466,7 +542,9 @@ public ServiceCall listOccurrences(ListOccurrencesOp } /** - * Lists `Occurrences` referencing the specified `Note`. Use this method to get all occurrences referencing your `Note` across all your customer providers. + * List occurrences by note. + * + * Get a list of occurrences that are associated with a specific note. * * @param listNoteOccurrencesOptions the {@link ListNoteOccurrencesOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiListNoteOccurrencesResponse} @@ -485,7 +563,7 @@ public ServiceCall listNoteOccurrences(ListNoteO } builder.header("Accept", "application/json"); if (listNoteOccurrencesOptions.transactionId() != null) { - builder.header("Transaction-Id", listNoteOccurrencesOptions.transactionId()); + builder.header("transaction_id", listNoteOccurrencesOptions.transactionId()); } if (listNoteOccurrencesOptions.pageSize() != null) { builder.query("page_size", String.valueOf(listNoteOccurrencesOptions.pageSize())); @@ -499,7 +577,9 @@ public ServiceCall listNoteOccurrences(ListNoteO } /** - * Returns the requested `Occurrence`. + * Get a specific occurrence. + * + * Get the details of a specific occurrence by specifying the ID and provider ID. * * @param getOccurrenceOptions the {@link GetOccurrenceOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiListOccurrencesResponse} @@ -518,7 +598,7 @@ public ServiceCall getOccurrence(GetOccurrenceOption } builder.header("Accept", "application/json"); if (getOccurrenceOptions.transactionId() != null) { - builder.header("Transaction-Id", getOccurrenceOptions.transactionId()); + builder.header("transaction_id", getOccurrenceOptions.transactionId()); } ResponseConverter responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); @@ -526,7 +606,9 @@ public ServiceCall getOccurrence(GetOccurrenceOption } /** - * Updates an existing `Occurrence`. + * Update an occurrence. + * + * Update an occurrence that already exists in your account. * * @param updateOccurrenceOptions the {@link UpdateOccurrenceOptions} containing the options for the call * @return a {@link ServiceCall} with a result of type {@link ApiOccurrence} @@ -545,7 +627,7 @@ public ServiceCall updateOccurrence(UpdateOccurrenceOptions updat } builder.header("Accept", "application/json"); if (updateOccurrenceOptions.transactionId() != null) { - builder.header("Transaction-Id", updateOccurrenceOptions.transactionId()); + builder.header("transaction_id", updateOccurrenceOptions.transactionId()); } final JsonObject contentJson = new JsonObject(); contentJson.addProperty("note_name", updateOccurrenceOptions.noteName()); @@ -576,7 +658,9 @@ public ServiceCall updateOccurrence(UpdateOccurrenceOptions updat } /** - * Deletes the given `Occurrence` from the system. + * Delete an occurrence. + * + * Delete an occurrence by specifying the occurrence ID and provider ID. * * @param deleteOccurrenceOptions the {@link DeleteOccurrenceOptions} containing the options for the call * @return a {@link ServiceCall} with a void result @@ -595,57 +679,10 @@ public ServiceCall deleteOccurrence(DeleteOccurrenceOptions deleteOccurren } builder.header("Accept", "application/json"); if (deleteOccurrenceOptions.transactionId() != null) { - builder.header("Transaction-Id", deleteOccurrenceOptions.transactionId()); + builder.header("transaction_id", deleteOccurrenceOptions.transactionId()); } ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); return createServiceCall(builder.build(), responseConverter); } - /** - * Lists all `Providers` for a given account id. - * - * @param listProvidersOptions the {@link ListProvidersOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ApiListProvidersResponse} - */ - public ServiceCall listProviders(ListProvidersOptions listProvidersOptions) { - if (listProvidersOptions == null) { - listProvidersOptions = new ListProvidersOptions.Builder().build(); - } - Map pathParamsMap = new HashMap(); - pathParamsMap.put("account_id", this.accountId); - RequestBuilder builder = RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/{account_id}/providers", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("findings", "v1", "listProviders"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (listProvidersOptions.transactionId() != null) { - builder.header("Transaction-Id", listProvidersOptions.transactionId()); - } - if (listProvidersOptions.limit() != null) { - builder.query("limit", String.valueOf(listProvidersOptions.limit())); - } - if (listProvidersOptions.skip() != null) { - builder.query("skip", String.valueOf(listProvidersOptions.skip())); - } - if (listProvidersOptions.startProviderId() != null) { - builder.query("start_provider_id", String.valueOf(listProvidersOptions.startProviderId())); - } - if (listProvidersOptions.endProviderId() != null) { - builder.query("end_provider_id", String.valueOf(listProvidersOptions.endProviderId())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken() { }.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Lists all `Providers` for a given account id. - * - * @return a {@link ServiceCall} with a result of type {@link ApiListProvidersResponse} - */ - public ServiceCall listProviders() { - return listProviders(null); - } - } diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java index ceea89b0..9d06f845 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiListProvidersResponse.java @@ -18,7 +18,7 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * Response including listed providers. + * A list of providers is returned. */ public class ApiListProvidersResponse extends GenericModel { @@ -42,7 +42,7 @@ public List getProviders() { /** * Gets the limit. * - * The number of elements returned in the current instance. Default is 200. + * The number of elements returned in the current instance. The default is 200. * * @return the limit */ @@ -53,7 +53,7 @@ public Long getLimit() { /** * Gets the skip. * - * The offset is the index of the item from which you want to start returning data from. Default is 0. + * The offset is the index of the item from which you want to start returning data from. The default is 0. * * @return the skip */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java index ff4d814d..ce282f20 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNote.java @@ -20,13 +20,12 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * Provides a detailed description of a `Note`. + * Provides a detailed description of a note. */ public class ApiNote extends GenericModel { /** - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -319,7 +318,7 @@ public Builder newBuilder() { /** * Gets the shortDescription. * - * A one sentence description of this `Note`. + * A one sentence description of your note. * * @return the shortDescription */ @@ -330,7 +329,7 @@ public String shortDescription() { /** * Gets the longDescription. * - * A detailed description of this `Note`. + * A more detailed description of your note. * * @return the longDescription */ @@ -341,8 +340,7 @@ public String longDescription() { /** * Gets the kind. * - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -358,8 +356,6 @@ public String kind() { /** * Gets the relatedUrl. * - * URLs associated with this note. - * * @return the relatedUrl */ public List relatedUrl() { @@ -402,7 +398,7 @@ public Date updateTime() { /** * Gets the id. * - * The id of the note. + * The ID of the note. * * @return the id */ @@ -413,7 +409,7 @@ public String id() { /** * Gets the shared. * - * True if this `Note` can be shared by multiple accounts. + * True if this note can be shared by multiple accounts. * * @return the shared */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java index 6faf4258..3a888794 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiNoteRelatedUrl.java @@ -115,7 +115,7 @@ public String label() { /** * Gets the url. * - * Specific URL to associate with the note. + * The URL that you want to associate with the note. * * @return the url */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java index 77585a07..5573504e 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiOccurrence.java @@ -24,8 +24,7 @@ public class ApiOccurrence extends GenericModel { /** - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -270,8 +269,7 @@ public String noteName() { /** * Gets the kind. * - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java index 29e97262..40f74d79 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ApiProvider.java @@ -15,7 +15,7 @@ import com.ibm.cloud.sdk.core.service.model.GenericModel; /** - * Provides a detailed description of a `Provider`. + * Provides a detailed description of a provider. */ public class ApiProvider extends GenericModel { @@ -25,7 +25,7 @@ public class ApiProvider extends GenericModel { /** * Gets the name. * - * The name of the provider in the form "{account_id}/providers/{provider_id}". + * The name of the provider in the form '{account_id}/providers/{provider_id}'. * * @return the name */ @@ -36,7 +36,7 @@ public String getName() { /** * Gets the id. * - * The id of the provider. + * The ID of the provider. * * @return the id */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java index 7e40f8ec..eeae7724 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateNoteOptions.java @@ -24,8 +24,7 @@ public class CreateNoteOptions extends GenericModel { /** - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -365,7 +364,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * Part of `parent`. This field contains the provider_id for example: providers/{provider_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -376,7 +375,7 @@ public String providerId() { /** * Gets the shortDescription. * - * A one sentence description of this `Note`. + * A one sentence description of your note. * * @return the shortDescription */ @@ -387,7 +386,7 @@ public String shortDescription() { /** * Gets the longDescription. * - * A detailed description of this `Note`. + * A more detailed description of your note. * * @return the longDescription */ @@ -398,8 +397,7 @@ public String longDescription() { /** * Gets the kind. * - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -415,7 +413,7 @@ public String kind() { /** * Gets the id. * - * The id of the note. + * The ID of the note. * * @return the id */ @@ -437,8 +435,6 @@ public Reporter reportedBy() { /** * Gets the relatedUrl. * - * URLs associated with this note. - * * @return the relatedUrl */ public List relatedUrl() { @@ -459,7 +455,7 @@ public Date expirationTime() { /** * Gets the shared. * - * True if this `Note` can be shared by multiple accounts. + * True if this note can be shared by multiple accounts. * * @return the shared */ @@ -514,7 +510,7 @@ public Section section() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java index 56f836e9..d5b6c6b8 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptions.java @@ -22,8 +22,7 @@ public class CreateOccurrenceOptions extends GenericModel { /** - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -53,8 +52,8 @@ public interface Kind { protected Finding finding; protected Kpi kpi; protected Map referenceData; - protected Boolean replaceIfExists; protected String transactionId; + protected Boolean replaceIfExists; /** * Builder. @@ -70,8 +69,8 @@ public static class Builder { private Finding finding; private Kpi kpi; private Map referenceData; - private Boolean replaceIfExists; private String transactionId; + private Boolean replaceIfExists; private Builder(CreateOccurrenceOptions createOccurrenceOptions) { this.providerId = createOccurrenceOptions.providerId; @@ -84,8 +83,8 @@ private Builder(CreateOccurrenceOptions createOccurrenceOptions) { this.finding = createOccurrenceOptions.finding; this.kpi = createOccurrenceOptions.kpi; this.referenceData = createOccurrenceOptions.referenceData; - this.replaceIfExists = createOccurrenceOptions.replaceIfExists; this.transactionId = createOccurrenceOptions.transactionId; + this.replaceIfExists = createOccurrenceOptions.replaceIfExists; } /** @@ -229,24 +228,24 @@ public Builder referenceData(Map referenceData) { } /** - * Set the replaceIfExists. + * Set the transactionId. * - * @param replaceIfExists the replaceIfExists + * @param transactionId the transactionId * @return the CreateOccurrenceOptions builder */ - public Builder replaceIfExists(Boolean replaceIfExists) { - this.replaceIfExists = replaceIfExists; + public Builder transactionId(String transactionId) { + this.transactionId = transactionId; return this; } /** - * Set the transactionId. + * Set the replaceIfExists. * - * @param transactionId the transactionId + * @param replaceIfExists the replaceIfExists * @return the CreateOccurrenceOptions builder */ - public Builder transactionId(String transactionId) { - this.transactionId = transactionId; + public Builder replaceIfExists(Boolean replaceIfExists) { + this.replaceIfExists = replaceIfExists; return this; } @@ -289,8 +288,8 @@ protected CreateOccurrenceOptions(Builder builder) { finding = builder.finding; kpi = builder.kpi; referenceData = builder.referenceData; - replaceIfExists = builder.replaceIfExists; transactionId = builder.transactionId; + replaceIfExists = builder.replaceIfExists; } /** @@ -305,7 +304,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * Part of `parent`. This contains the provider_id for example: providers/{provider_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -328,8 +327,7 @@ public String noteName() { /** * Gets the kind. * - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -419,25 +417,25 @@ public Map referenceData() { } /** - * Gets the replaceIfExists. + * Gets the transactionId. * - * It allows replacing an existing occurrence when set to true. + * The transaction ID for the request in UUID v4 format. * - * @return the replaceIfExists + * @return the transactionId */ - public Boolean replaceIfExists() { - return replaceIfExists; + public String transactionId() { + return transactionId; } /** - * Gets the transactionId. + * Gets the replaceIfExists. * - * The transaction id for the request in uuid v4 format. + * When set to true, an existing occurrence is replaced rather than duplicated. * - * @return the transactionId + * @return the replaceIfExists */ - public String transactionId() { - return transactionId; + public Boolean replaceIfExists() { + return replaceIfExists; } } diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java index a318cb05..93d46f53 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteNoteOptions.java @@ -119,7 +119,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * First part of note `name`: providers/{provider_id}/notes/{note_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -141,7 +141,7 @@ public String noteId() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java index b3851821..4a15c573 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/DeleteOccurrenceOptions.java @@ -119,7 +119,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * First part of occurrence `name`: providers/{provider_id}/notes/{occurrence_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -130,7 +130,7 @@ public String providerId() { /** * Gets the occurrenceId. * - * Second part of occurrence `name`: providers/{provider_id}/notes/{occurrence_id}. + * Second part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. * * @return the occurrenceId */ @@ -141,7 +141,7 @@ public String occurrenceId() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java index 2f70f3f6..e00408a3 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetNoteOptions.java @@ -119,7 +119,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * First part of note `name`: providers/{provider_id}/notes/{note_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -141,7 +141,7 @@ public String noteId() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java index e2138dea..549c87fd 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceNoteOptions.java @@ -119,7 +119,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * First part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -141,7 +141,7 @@ public String occurrenceId() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java index a3d597d3..37c395b2 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/GetOccurrenceOptions.java @@ -119,7 +119,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * First part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -141,7 +141,7 @@ public String occurrenceId() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java index 4789dc1f..e05463ad 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNoteOccurrencesOptions.java @@ -149,7 +149,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * First part of note `name`: providers/{provider_id}/notes/{note_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -171,7 +171,7 @@ public String noteId() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java index f83d7dc6..795125c9 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListNotesOptions.java @@ -130,7 +130,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * Part of `parent`. This field contains the provider_id for example: providers/{provider_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -141,7 +141,7 @@ public String providerId() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java index d28bfc76..1fe4fe7e 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListOccurrencesOptions.java @@ -130,7 +130,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * Part of `parent`. This contains the provider_id for example: providers/{provider_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -141,7 +141,7 @@ public String providerId() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ @@ -152,7 +152,7 @@ public String transactionId() { /** * Gets the pageSize. * - * Number of occurrences to return in the list. + * Number of notes to return in the list. * * @return the pageSize */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java index 8ceef419..5403bde8 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/ListProvidersOptions.java @@ -134,7 +134,7 @@ public Builder newBuilder() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ @@ -145,7 +145,7 @@ public String transactionId() { /** * Gets the limit. * - * Limit the number of the returned documents to the specified number. + * The number of documents that you want to return. * * @return the limit */ @@ -167,7 +167,8 @@ public Long skip() { /** * Gets the startProviderId. * - * The first provider_id to include in the result (sorted in ascending order). Ignored if not provided. + * The first provider ID included in the result, sorted in ascending order. If not provided, this parameter is + * ignored. * * @return the startProviderId */ @@ -178,7 +179,7 @@ public String startProviderId() { /** * Gets the endProviderId. * - * The last provider_id to include in the result (sorted in ascending order). Ignored if not provided. + * The last provider ID included in the result, sorted in ascending order. If not provided, this parameter is ignored. * * @return the endProviderId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java index e9979580..aaf9a9ff 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/PostGraphOptions.java @@ -144,7 +144,7 @@ public String contentType() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java index 26eaac7a..08c40a14 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateNoteOptions.java @@ -24,8 +24,7 @@ public class UpdateNoteOptions extends GenericModel { /** - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -384,7 +383,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * First part of note `name`: providers/{provider_id}/notes/{note_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -406,7 +405,7 @@ public String noteId() { /** * Gets the shortDescription. * - * A one sentence description of this `Note`. + * A one sentence description of your note. * * @return the shortDescription */ @@ -417,7 +416,7 @@ public String shortDescription() { /** * Gets the longDescription. * - * A detailed description of this `Note`. + * A more detailed description of your note. * * @return the longDescription */ @@ -428,8 +427,7 @@ public String longDescription() { /** * Gets the kind. * - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -445,7 +443,7 @@ public String kind() { /** * Gets the id. * - * The id of the note. + * The ID of the note. * * @return the id */ @@ -467,8 +465,6 @@ public Reporter reportedBy() { /** * Gets the relatedUrl. * - * URLs associated with this note. - * * @return the relatedUrl */ public List relatedUrl() { @@ -489,7 +485,7 @@ public Date expirationTime() { /** * Gets the shared. * - * True if this `Note` can be shared by multiple accounts. + * True if this note can be shared by multiple accounts. * * @return the shared */ @@ -544,7 +540,7 @@ public Section section() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java index 6d957751..53c73e3a 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/model/UpdateOccurrenceOptions.java @@ -22,8 +22,7 @@ public class UpdateOccurrenceOptions extends GenericModel { /** - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -309,7 +308,7 @@ public Builder newBuilder() { /** * Gets the providerId. * - * First part of occurrence `name`: providers/{provider_id}/occurrences/{occurrence_id}. + * Part of the parent. This field contains the provider ID. For example: providers/{provider_id}. * * @return the providerId */ @@ -343,8 +342,7 @@ public String noteName() { /** * Gets the kind. * - * This must be 1:1 with members of our oneofs, it can be used for filtering Note and Occurrence on their - * kind. + * The type of note. Use this field to filter notes and occurences by kind. * - FINDING: The note and occurrence represent a finding. * - KPI: The note and occurrence represent a KPI value. * - CARD: The note represents a card showing findings and related metric values. @@ -436,7 +434,7 @@ public Map referenceData() { /** * Gets the transactionId. * - * The transaction id for the request in uuid v4 format. + * The transaction ID for the request in UUID v4 format. * * @return the transactionId */ diff --git a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/package-info.java b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/package-info.java index 26ba8bd1..050fe648 100644 --- a/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/package-info.java +++ b/modules/findings/src/main/java/com/ibm/cloud/scc/findings/v1/package-info.java @@ -11,6 +11,6 @@ * specific language governing permissions and limitations under the License. */ /** - * Findings API v1. + * Security Insights Findings API v1. */ package com.ibm.cloud.scc.findings.v1; diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsTest.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsTest.java index 77cc3332..fc33bb9b 100644 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsTest.java +++ b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/FindingsTest.java @@ -184,6 +184,52 @@ public void testPostGraphNoOptions() throws Throwable { findingsService.postGraph(null).execute(); } + @Test + public void testListProvidersWOptions() throws Throwable { + // Schedule some responses. + String mockResponseBody = "{\"providers\": [{\"name\": \"name\", \"id\": \"id\"}], \"limit\": 5, \"skip\": 4, \"total_count\": 10}"; + String listProvidersPath = "/v1/testString/providers"; + + server.enqueue(new MockResponse() + .setHeader("Content-type", "application/json") + .setResponseCode(200) + .setBody(mockResponseBody)); + + constructClientService(); + + // Construct an instance of the ListProvidersOptions model + ListProvidersOptions listProvidersOptionsModel = new ListProvidersOptions.Builder() + .transactionId("testString") + .limit(Long.valueOf("2")) + .skip(Long.valueOf("26")) + .startProviderId("testString") + .endProviderId("testString") + .build(); + + // Invoke operation with valid options model (positive test) + Response response = findingsService.listProviders(listProvidersOptionsModel).execute(); + assertNotNull(response); + ApiListProvidersResponse responseObj = response.getResult(); + assertNotNull(responseObj); + + // Verify the contents of the request + RecordedRequest request = server.takeRequest(); + assertNotNull(request); + assertEquals(request.getMethod(), "GET"); + + // Check query + Map query = TestUtilities.parseQueryString(request); + assertNotNull(query); + // Get query params + assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("2")); + assertEquals(Long.valueOf(query.get("skip")), Long.valueOf("26")); + assertEquals(query.get("start_provider_id"), "testString"); + assertEquals(query.get("end_provider_id"), "testString"); + // Check request path + String parsedPath = TestUtilities.parseReqPath(request); + assertEquals(parsedPath, listProvidersPath); + } + @Test public void testCreateNoteWOptions() throws Throwable { // Schedule some responses. @@ -734,8 +780,8 @@ public void testCreateOccurrenceWOptions() throws Throwable { .finding(findingModel) .kpi(kpiModel) .referenceData(new java.util.HashMap() { { put("foo", "testString"); } }) - .replaceIfExists(true) .transactionId("testString") + .replaceIfExists(true) .build(); // Invoke operation with valid options model (positive test) @@ -1103,52 +1149,6 @@ public void testDeleteOccurrenceNoOptions() throws Throwable { findingsService.deleteOccurrence(null).execute(); } - @Test - public void testListProvidersWOptions() throws Throwable { - // Schedule some responses. - String mockResponseBody = "{\"providers\": [{\"name\": \"name\", \"id\": \"id\"}], \"limit\": 5, \"skip\": 4, \"total_count\": 10}"; - String listProvidersPath = "/v1/testString/providers"; - - server.enqueue(new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - constructClientService(); - - // Construct an instance of the ListProvidersOptions model - ListProvidersOptions listProvidersOptionsModel = new ListProvidersOptions.Builder() - .transactionId("testString") - .limit(Long.valueOf("2")) - .skip(Long.valueOf("26")) - .startProviderId("testString") - .endProviderId("testString") - .build(); - - // Invoke operation with valid options model (positive test) - Response response = findingsService.listProviders(listProvidersOptionsModel).execute(); - assertNotNull(response); - ApiListProvidersResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - - // Check query - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - // Get query params - assertEquals(Long.valueOf(query.get("limit")), Long.valueOf("2")); - assertEquals(Long.valueOf(query.get("skip")), Long.valueOf("26")); - assertEquals(query.get("start_provider_id"), "testString"); - assertEquals(query.get("end_provider_id"), "testString"); - // Check request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listProvidersPath); - } - /** Initialize the server */ @BeforeMethod public void setUpMockServer() { diff --git a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptionsTest.java b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptionsTest.java index 3a2fb4d3..d88c66f5 100644 --- a/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptionsTest.java +++ b/modules/findings/src/test/java/com/ibm/cloud/scc/findings/v1/model/CreateOccurrenceOptionsTest.java @@ -130,8 +130,8 @@ public void testCreateOccurrenceOptions() throws Throwable { .finding(findingModel) .kpi(kpiModel) .referenceData(new java.util.HashMap() { { put("foo", "testString"); } }) - .replaceIfExists(true) .transactionId("testString") + .replaceIfExists(true) .build(); assertEquals(createOccurrenceOptionsModel.providerId(), "testString"); assertEquals(createOccurrenceOptionsModel.noteName(), "testString"); @@ -143,8 +143,8 @@ public void testCreateOccurrenceOptions() throws Throwable { assertEquals(createOccurrenceOptionsModel.finding(), findingModel); assertEquals(createOccurrenceOptionsModel.kpi(), kpiModel); assertEquals(createOccurrenceOptionsModel.referenceData(), new java.util.HashMap() { { put("foo", "testString"); } }); - assertEquals(createOccurrenceOptionsModel.replaceIfExists(), Boolean.valueOf(true)); assertEquals(createOccurrenceOptionsModel.transactionId(), "testString"); + assertEquals(createOccurrenceOptionsModel.replaceIfExists(), Boolean.valueOf(true)); } @Test(expectedExceptions = IllegalArgumentException.class)