From 090493643ae86992c44e31963e1ba774d97b79d4 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:04:56 -0400 Subject: [PATCH] feat: [containeranalysis] add enum for grafeas v1 cvss to support both cvss v2 and v3 (#4163) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add GeneratePackagesSummary method PiperOrigin-RevId: 523410324 Source-Link: https://github.com/googleapis/googleapis/commit/61f94e6f3c2ef7a8de5026dc361239646b13bf51 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8ba38bf51b79f30755e8becdef3e12902c8b3d02 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNvbnRhaW5lcmFuYWx5c2lzLy5Pd2xCb3QueWFtbCIsImgiOiI4YmEzOGJmNTFiNzlmMzA3NTVlOGJlY2RlZjNlMTI5MDJjOGIzZDAyIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add enum for grafeas v1 cvss to support both cvss v2 and v3 PiperOrigin-RevId: 523785347 Source-Link: https://github.com/googleapis/googleapis/commit/4e8d3907aec680562c9243774c67adc6d713fe50 Source-Link: https://github.com/googleapis/googleapis-gen/commit/d1e6d67ece598e97f9398c6cb35ffc61308e6dbc Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWRldnRvb2xzLWNvbnRhaW5lcmFuYWx5c2lzLy5Pd2xCb3QueWFtbCIsImgiOiJkMWU2ZDY3ZWNlNTk4ZTk3ZjkzOThjNmNiMzVmZmM2MTMwOGU2ZGJjIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: Denis DelGrosso <85250797+ddelgrosso1@users.noreply.github.com> --- .../README.md | 1 + .../v1beta1/containeranalysis.proto | 34 + .../protos/grafeas/v1/cvss.proto | 3 + .../protos/protos.d.ts | 334 +++++++- .../protos/protos.js | 766 ++++++++++++++++++ .../protos/protos.json | 49 +- .../samples/README.md | 18 + ....google.devtools.containeranalysis.v1.json | 2 +- ...ysis_v1_beta1.generate_packages_summary.js | 62 ++ ...le.devtools.containeranalysis.v1beta1.json | 42 +- .../container_analysis_v1_beta1_client.ts | 99 +++ ...ainer_analysis_v1_beta1_client_config.json | 4 + .../src/v1beta1/gapic_metadata.json | 10 + ...pic_container_analysis_v1_beta1_v1beta1.ts | 102 +++ .../webpack.config.js | 2 +- 15 files changed, 1521 insertions(+), 7 deletions(-) create mode 100644 packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js diff --git a/packages/google-devtools-containeranalysis/README.md b/packages/google-devtools-containeranalysis/README.md index 151f409b634..11787a12c3a 100644 --- a/packages/google-devtools-containeranalysis/README.md +++ b/packages/google-devtools-containeranalysis/README.md @@ -80,6 +80,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Grafeas.list_occurrences | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devtools-containeranalysis/samples/generated/v1/grafeas.list_occurrences.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-devtools-containeranalysis/samples/generated/v1/grafeas.list_occurrences.js,samples/README.md) | | Grafeas.update_note | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devtools-containeranalysis/samples/generated/v1/grafeas.update_note.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-devtools-containeranalysis/samples/generated/v1/grafeas.update_note.js,samples/README.md) | | Grafeas.update_occurrence | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devtools-containeranalysis/samples/generated/v1/grafeas.update_occurrence.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-devtools-containeranalysis/samples/generated/v1/grafeas.update_occurrence.js,samples/README.md) | +| Container_analysis_v1_beta1.generate_packages_summary | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js,samples/README.md) | | Container_analysis_v1_beta1.get_iam_policy | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.get_iam_policy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.get_iam_policy.js,samples/README.md) | | Container_analysis_v1_beta1.get_scan_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.get_scan_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.get_scan_config.js,samples/README.md) | | Container_analysis_v1_beta1.list_scan_configs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.list_scan_configs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.list_scan_configs.js,samples/README.md) | diff --git a/packages/google-devtools-containeranalysis/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto b/packages/google-devtools-containeranalysis/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto index 4bf83a81249..88f6970128f 100644 --- a/packages/google-devtools-containeranalysis/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto +++ b/packages/google-devtools-containeranalysis/protos/google/devtools/containeranalysis/v1beta1/containeranalysis.proto @@ -106,4 +106,38 @@ service ContainerAnalysisV1Beta1 { }; option (google.api.method_signature) = "resource,permissions"; } + + // Gets a summary of the packages within a given resource. + rpc GeneratePackagesSummary(GeneratePackagesSummaryRequest) + returns (PackagesSummaryResponse) {} +} + +// GeneratePackagesSummaryRequest is the request body for the +// GeneratePackagesSummary API method. It just takes a single name argument, +// referring to the resource. +message GeneratePackagesSummaryRequest { + // Required. The name of the resource to get a packages summary for in the + // form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A summary of the packages found within the given resource. +message PackagesSummaryResponse { + // Per license count + message LicensesSummary { + // The license of the package. Note that the format of this value is not + // guaranteed. It may be nil, an empty string, a boolean value (A | B), a + // differently formed boolean value (A OR B), etc... + string license = 1; + + // The number of fixable vulnerabilities associated with this resource. + int64 count = 2; + } + + // The unique URL of the image or the container for which this summary + // applies. + string resource_url = 1; + + // A listing by license name of each of the licenses and their counts. + repeated LicensesSummary licenses_summary = 2; } diff --git a/packages/google-devtools-containeranalysis/protos/grafeas/v1/cvss.proto b/packages/google-devtools-containeranalysis/protos/grafeas/v1/cvss.proto index 181ec052fe4..a9d018eee6d 100644 --- a/packages/google-devtools-containeranalysis/protos/grafeas/v1/cvss.proto +++ b/packages/google-devtools-containeranalysis/protos/grafeas/v1/cvss.proto @@ -122,6 +122,7 @@ message CVSS { ATTACK_COMPLEXITY_UNSPECIFIED = 0; ATTACK_COMPLEXITY_LOW = 1; ATTACK_COMPLEXITY_HIGH = 2; + ATTACK_COMPLEXITY_MEDIUM = 3; } enum Authentication { @@ -155,6 +156,8 @@ message CVSS { IMPACT_HIGH = 1; IMPACT_LOW = 2; IMPACT_NONE = 3; + IMPACT_PARTIAL = 4; + IMPACT_COMPLETE = 5; } } diff --git a/packages/google-devtools-containeranalysis/protos/protos.d.ts b/packages/google-devtools-containeranalysis/protos/protos.d.ts index 201d6b21d38..089946eb1b4 100644 --- a/packages/google-devtools-containeranalysis/protos/protos.d.ts +++ b/packages/google-devtools-containeranalysis/protos/protos.d.ts @@ -6066,7 +6066,8 @@ export namespace grafeas { enum AttackComplexity { ATTACK_COMPLEXITY_UNSPECIFIED = 0, ATTACK_COMPLEXITY_LOW = 1, - ATTACK_COMPLEXITY_HIGH = 2 + ATTACK_COMPLEXITY_HIGH = 2, + ATTACK_COMPLEXITY_MEDIUM = 3 } /** Authentication enum. */ @@ -6104,7 +6105,9 @@ export namespace grafeas { IMPACT_UNSPECIFIED = 0, IMPACT_HIGH = 1, IMPACT_LOW = 2, - IMPACT_NONE = 3 + IMPACT_NONE = 3, + IMPACT_PARTIAL = 4, + IMPACT_COMPLETE = 5 } } @@ -22549,6 +22552,20 @@ export namespace google { * @returns Promise */ public testIamPermissions(request: google.iam.v1.ITestIamPermissionsRequest): Promise; + + /** + * Calls GeneratePackagesSummary. + * @param request GeneratePackagesSummaryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and PackagesSummaryResponse + */ + public generatePackagesSummary(request: google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, callback: google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GeneratePackagesSummaryCallback): void; + + /** + * Calls GeneratePackagesSummary. + * @param request GeneratePackagesSummaryRequest message or plain object + * @returns Promise + */ + public generatePackagesSummary(request: google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest): Promise; } namespace ContainerAnalysisV1Beta1 { @@ -22573,6 +22590,319 @@ export namespace google { * @param [response] TestIamPermissionsResponse */ type TestIamPermissionsCallback = (error: (Error|null), response?: google.iam.v1.TestIamPermissionsResponse) => void; + + /** + * Callback as used by {@link google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1|generatePackagesSummary}. + * @param error Error, if any + * @param [response] PackagesSummaryResponse + */ + type GeneratePackagesSummaryCallback = (error: (Error|null), response?: google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse) => void; + } + + /** Properties of a GeneratePackagesSummaryRequest. */ + interface IGeneratePackagesSummaryRequest { + + /** GeneratePackagesSummaryRequest name */ + name?: (string|null); + } + + /** Represents a GeneratePackagesSummaryRequest. */ + class GeneratePackagesSummaryRequest implements IGeneratePackagesSummaryRequest { + + /** + * Constructs a new GeneratePackagesSummaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest); + + /** GeneratePackagesSummaryRequest name. */ + public name: string; + + /** + * Creates a new GeneratePackagesSummaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GeneratePackagesSummaryRequest instance + */ + public static create(properties?: google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest): google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest; + + /** + * Encodes the specified GeneratePackagesSummaryRequest message. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest.verify|verify} messages. + * @param message GeneratePackagesSummaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeneratePackagesSummaryRequest message, length delimited. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest.verify|verify} messages. + * @param message GeneratePackagesSummaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeneratePackagesSummaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeneratePackagesSummaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest; + + /** + * Decodes a GeneratePackagesSummaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeneratePackagesSummaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest; + + /** + * Verifies a GeneratePackagesSummaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeneratePackagesSummaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeneratePackagesSummaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest; + + /** + * Creates a plain object from a GeneratePackagesSummaryRequest message. Also converts values to other types if specified. + * @param message GeneratePackagesSummaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeneratePackagesSummaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeneratePackagesSummaryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PackagesSummaryResponse. */ + interface IPackagesSummaryResponse { + + /** PackagesSummaryResponse resourceUrl */ + resourceUrl?: (string|null); + + /** PackagesSummaryResponse licensesSummary */ + licensesSummary?: (google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary[]|null); + } + + /** Represents a PackagesSummaryResponse. */ + class PackagesSummaryResponse implements IPackagesSummaryResponse { + + /** + * Constructs a new PackagesSummaryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse); + + /** PackagesSummaryResponse resourceUrl. */ + public resourceUrl: string; + + /** PackagesSummaryResponse licensesSummary. */ + public licensesSummary: google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary[]; + + /** + * Creates a new PackagesSummaryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PackagesSummaryResponse instance + */ + public static create(properties?: google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse): google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse; + + /** + * Encodes the specified PackagesSummaryResponse message. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.verify|verify} messages. + * @param message PackagesSummaryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PackagesSummaryResponse message, length delimited. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.verify|verify} messages. + * @param message PackagesSummaryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PackagesSummaryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PackagesSummaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse; + + /** + * Decodes a PackagesSummaryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PackagesSummaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse; + + /** + * Verifies a PackagesSummaryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PackagesSummaryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PackagesSummaryResponse + */ + public static fromObject(object: { [k: string]: any }): google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse; + + /** + * Creates a plain object from a PackagesSummaryResponse message. Also converts values to other types if specified. + * @param message PackagesSummaryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PackagesSummaryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PackagesSummaryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PackagesSummaryResponse { + + /** Properties of a LicensesSummary. */ + interface ILicensesSummary { + + /** LicensesSummary license */ + license?: (string|null); + + /** LicensesSummary count */ + count?: (number|Long|string|null); + } + + /** Represents a LicensesSummary. */ + class LicensesSummary implements ILicensesSummary { + + /** + * Constructs a new LicensesSummary. + * @param [properties] Properties to set + */ + constructor(properties?: google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary); + + /** LicensesSummary license. */ + public license: string; + + /** LicensesSummary count. */ + public count: (number|Long|string); + + /** + * Creates a new LicensesSummary instance using the specified properties. + * @param [properties] Properties to set + * @returns LicensesSummary instance + */ + public static create(properties?: google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary): google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary; + + /** + * Encodes the specified LicensesSummary message. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary.verify|verify} messages. + * @param message LicensesSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LicensesSummary message, length delimited. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary.verify|verify} messages. + * @param message LicensesSummary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LicensesSummary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LicensesSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary; + + /** + * Decodes a LicensesSummary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LicensesSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary; + + /** + * Verifies a LicensesSummary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LicensesSummary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LicensesSummary + */ + public static fromObject(object: { [k: string]: any }): google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary; + + /** + * Creates a plain object from a LicensesSummary message. Also converts values to other types if specified. + * @param message LicensesSummary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LicensesSummary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LicensesSummary + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } } } diff --git a/packages/google-devtools-containeranalysis/protos/protos.js b/packages/google-devtools-containeranalysis/protos/protos.js index c5faf92298a..f3feaddf2b6 100644 --- a/packages/google-devtools-containeranalysis/protos/protos.js +++ b/packages/google-devtools-containeranalysis/protos/protos.js @@ -15269,6 +15269,7 @@ case 0: case 1: case 2: + case 3: break; } if (message.authentication != null && message.hasOwnProperty("authentication")) @@ -15317,6 +15318,8 @@ case 1: case 2: case 3: + case 4: + case 5: break; } if (message.integrityImpact != null && message.hasOwnProperty("integrityImpact")) @@ -15327,6 +15330,8 @@ case 1: case 2: case 3: + case 4: + case 5: break; } if (message.availabilityImpact != null && message.hasOwnProperty("availabilityImpact")) @@ -15337,6 +15342,8 @@ case 1: case 2: case 3: + case 4: + case 5: break; } return null; @@ -15407,6 +15414,10 @@ case 2: message.attackComplexity = 2; break; + case "ATTACK_COMPLEXITY_MEDIUM": + case 3: + message.attackComplexity = 3; + break; } switch (object.authentication) { default: @@ -15519,6 +15530,14 @@ case 3: message.confidentialityImpact = 3; break; + case "IMPACT_PARTIAL": + case 4: + message.confidentialityImpact = 4; + break; + case "IMPACT_COMPLETE": + case 5: + message.confidentialityImpact = 5; + break; } switch (object.integrityImpact) { default: @@ -15543,6 +15562,14 @@ case 3: message.integrityImpact = 3; break; + case "IMPACT_PARTIAL": + case 4: + message.integrityImpact = 4; + break; + case "IMPACT_COMPLETE": + case 5: + message.integrityImpact = 5; + break; } switch (object.availabilityImpact) { default: @@ -15567,6 +15594,14 @@ case 3: message.availabilityImpact = 3; break; + case "IMPACT_PARTIAL": + case 4: + message.availabilityImpact = 4; + break; + case "IMPACT_COMPLETE": + case 5: + message.availabilityImpact = 5; + break; } return message; }; @@ -15678,12 +15713,14 @@ * @property {number} ATTACK_COMPLEXITY_UNSPECIFIED=0 ATTACK_COMPLEXITY_UNSPECIFIED value * @property {number} ATTACK_COMPLEXITY_LOW=1 ATTACK_COMPLEXITY_LOW value * @property {number} ATTACK_COMPLEXITY_HIGH=2 ATTACK_COMPLEXITY_HIGH value + * @property {number} ATTACK_COMPLEXITY_MEDIUM=3 ATTACK_COMPLEXITY_MEDIUM value */ CVSS.AttackComplexity = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "ATTACK_COMPLEXITY_UNSPECIFIED"] = 0; values[valuesById[1] = "ATTACK_COMPLEXITY_LOW"] = 1; values[valuesById[2] = "ATTACK_COMPLEXITY_HIGH"] = 2; + values[valuesById[3] = "ATTACK_COMPLEXITY_MEDIUM"] = 3; return values; })(); @@ -15763,6 +15800,8 @@ * @property {number} IMPACT_HIGH=1 IMPACT_HIGH value * @property {number} IMPACT_LOW=2 IMPACT_LOW value * @property {number} IMPACT_NONE=3 IMPACT_NONE value + * @property {number} IMPACT_PARTIAL=4 IMPACT_PARTIAL value + * @property {number} IMPACT_COMPLETE=5 IMPACT_COMPLETE value */ CVSS.Impact = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -15770,6 +15809,8 @@ values[valuesById[1] = "IMPACT_HIGH"] = 1; values[valuesById[2] = "IMPACT_LOW"] = 2; values[valuesById[3] = "IMPACT_NONE"] = 3; + values[valuesById[4] = "IMPACT_PARTIAL"] = 4; + values[valuesById[5] = "IMPACT_COMPLETE"] = 5; return values; })(); @@ -57995,9 +58036,734 @@ * @variation 2 */ + /** + * Callback as used by {@link google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1|generatePackagesSummary}. + * @memberof google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1 + * @typedef GeneratePackagesSummaryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse} [response] PackagesSummaryResponse + */ + + /** + * Calls GeneratePackagesSummary. + * @function generatePackagesSummary + * @memberof google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1 + * @instance + * @param {google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest} request GeneratePackagesSummaryRequest message or plain object + * @param {google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GeneratePackagesSummaryCallback} callback Node-style callback called with the error, if any, and PackagesSummaryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ContainerAnalysisV1Beta1.prototype.generatePackagesSummary = function generatePackagesSummary(request, callback) { + return this.rpcCall(generatePackagesSummary, $root.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest, $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse, request, callback); + }, "name", { value: "GeneratePackagesSummary" }); + + /** + * Calls GeneratePackagesSummary. + * @function generatePackagesSummary + * @memberof google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1 + * @instance + * @param {google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest} request GeneratePackagesSummaryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + return ContainerAnalysisV1Beta1; })(); + v1beta1.GeneratePackagesSummaryRequest = (function() { + + /** + * Properties of a GeneratePackagesSummaryRequest. + * @memberof google.devtools.containeranalysis.v1beta1 + * @interface IGeneratePackagesSummaryRequest + * @property {string|null} [name] GeneratePackagesSummaryRequest name + */ + + /** + * Constructs a new GeneratePackagesSummaryRequest. + * @memberof google.devtools.containeranalysis.v1beta1 + * @classdesc Represents a GeneratePackagesSummaryRequest. + * @implements IGeneratePackagesSummaryRequest + * @constructor + * @param {google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest=} [properties] Properties to set + */ + function GeneratePackagesSummaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratePackagesSummaryRequest name. + * @member {string} name + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @instance + */ + GeneratePackagesSummaryRequest.prototype.name = ""; + + /** + * Creates a new GeneratePackagesSummaryRequest instance using the specified properties. + * @function create + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @static + * @param {google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest=} [properties] Properties to set + * @returns {google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest} GeneratePackagesSummaryRequest instance + */ + GeneratePackagesSummaryRequest.create = function create(properties) { + return new GeneratePackagesSummaryRequest(properties); + }; + + /** + * Encodes the specified GeneratePackagesSummaryRequest message. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest.verify|verify} messages. + * @function encode + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @static + * @param {google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest} message GeneratePackagesSummaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratePackagesSummaryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GeneratePackagesSummaryRequest message, length delimited. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @static + * @param {google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest} message GeneratePackagesSummaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratePackagesSummaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeneratePackagesSummaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest} GeneratePackagesSummaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratePackagesSummaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratePackagesSummaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest} GeneratePackagesSummaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratePackagesSummaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratePackagesSummaryRequest message. + * @function verify + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratePackagesSummaryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GeneratePackagesSummaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest} GeneratePackagesSummaryRequest + */ + GeneratePackagesSummaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest) + return object; + var message = new $root.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GeneratePackagesSummaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @static + * @param {google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest} message GeneratePackagesSummaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratePackagesSummaryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GeneratePackagesSummaryRequest to JSON. + * @function toJSON + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @instance + * @returns {Object.} JSON object + */ + GeneratePackagesSummaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GeneratePackagesSummaryRequest + * @function getTypeUrl + * @memberof google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeneratePackagesSummaryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest"; + }; + + return GeneratePackagesSummaryRequest; + })(); + + v1beta1.PackagesSummaryResponse = (function() { + + /** + * Properties of a PackagesSummaryResponse. + * @memberof google.devtools.containeranalysis.v1beta1 + * @interface IPackagesSummaryResponse + * @property {string|null} [resourceUrl] PackagesSummaryResponse resourceUrl + * @property {Array.|null} [licensesSummary] PackagesSummaryResponse licensesSummary + */ + + /** + * Constructs a new PackagesSummaryResponse. + * @memberof google.devtools.containeranalysis.v1beta1 + * @classdesc Represents a PackagesSummaryResponse. + * @implements IPackagesSummaryResponse + * @constructor + * @param {google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse=} [properties] Properties to set + */ + function PackagesSummaryResponse(properties) { + this.licensesSummary = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PackagesSummaryResponse resourceUrl. + * @member {string} resourceUrl + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @instance + */ + PackagesSummaryResponse.prototype.resourceUrl = ""; + + /** + * PackagesSummaryResponse licensesSummary. + * @member {Array.} licensesSummary + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @instance + */ + PackagesSummaryResponse.prototype.licensesSummary = $util.emptyArray; + + /** + * Creates a new PackagesSummaryResponse instance using the specified properties. + * @function create + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @static + * @param {google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse=} [properties] Properties to set + * @returns {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse} PackagesSummaryResponse instance + */ + PackagesSummaryResponse.create = function create(properties) { + return new PackagesSummaryResponse(properties); + }; + + /** + * Encodes the specified PackagesSummaryResponse message. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.verify|verify} messages. + * @function encode + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @static + * @param {google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse} message PackagesSummaryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PackagesSummaryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resourceUrl != null && Object.hasOwnProperty.call(message, "resourceUrl")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resourceUrl); + if (message.licensesSummary != null && message.licensesSummary.length) + for (var i = 0; i < message.licensesSummary.length; ++i) + $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary.encode(message.licensesSummary[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PackagesSummaryResponse message, length delimited. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @static + * @param {google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse} message PackagesSummaryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PackagesSummaryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PackagesSummaryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse} PackagesSummaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PackagesSummaryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.resourceUrl = reader.string(); + break; + } + case 2: { + if (!(message.licensesSummary && message.licensesSummary.length)) + message.licensesSummary = []; + message.licensesSummary.push($root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PackagesSummaryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse} PackagesSummaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PackagesSummaryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PackagesSummaryResponse message. + * @function verify + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PackagesSummaryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resourceUrl != null && message.hasOwnProperty("resourceUrl")) + if (!$util.isString(message.resourceUrl)) + return "resourceUrl: string expected"; + if (message.licensesSummary != null && message.hasOwnProperty("licensesSummary")) { + if (!Array.isArray(message.licensesSummary)) + return "licensesSummary: array expected"; + for (var i = 0; i < message.licensesSummary.length; ++i) { + var error = $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary.verify(message.licensesSummary[i]); + if (error) + return "licensesSummary." + error; + } + } + return null; + }; + + /** + * Creates a PackagesSummaryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse} PackagesSummaryResponse + */ + PackagesSummaryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse) + return object; + var message = new $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse(); + if (object.resourceUrl != null) + message.resourceUrl = String(object.resourceUrl); + if (object.licensesSummary) { + if (!Array.isArray(object.licensesSummary)) + throw TypeError(".google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.licensesSummary: array expected"); + message.licensesSummary = []; + for (var i = 0; i < object.licensesSummary.length; ++i) { + if (typeof object.licensesSummary[i] !== "object") + throw TypeError(".google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.licensesSummary: object expected"); + message.licensesSummary[i] = $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary.fromObject(object.licensesSummary[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PackagesSummaryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @static + * @param {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse} message PackagesSummaryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PackagesSummaryResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.licensesSummary = []; + if (options.defaults) + object.resourceUrl = ""; + if (message.resourceUrl != null && message.hasOwnProperty("resourceUrl")) + object.resourceUrl = message.resourceUrl; + if (message.licensesSummary && message.licensesSummary.length) { + object.licensesSummary = []; + for (var j = 0; j < message.licensesSummary.length; ++j) + object.licensesSummary[j] = $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary.toObject(message.licensesSummary[j], options); + } + return object; + }; + + /** + * Converts this PackagesSummaryResponse to JSON. + * @function toJSON + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @instance + * @returns {Object.} JSON object + */ + PackagesSummaryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PackagesSummaryResponse + * @function getTypeUrl + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PackagesSummaryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse"; + }; + + PackagesSummaryResponse.LicensesSummary = (function() { + + /** + * Properties of a LicensesSummary. + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @interface ILicensesSummary + * @property {string|null} [license] LicensesSummary license + * @property {number|Long|null} [count] LicensesSummary count + */ + + /** + * Constructs a new LicensesSummary. + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse + * @classdesc Represents a LicensesSummary. + * @implements ILicensesSummary + * @constructor + * @param {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary=} [properties] Properties to set + */ + function LicensesSummary(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LicensesSummary license. + * @member {string} license + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @instance + */ + LicensesSummary.prototype.license = ""; + + /** + * LicensesSummary count. + * @member {number|Long} count + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @instance + */ + LicensesSummary.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new LicensesSummary instance using the specified properties. + * @function create + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @static + * @param {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary=} [properties] Properties to set + * @returns {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary} LicensesSummary instance + */ + LicensesSummary.create = function create(properties) { + return new LicensesSummary(properties); + }; + + /** + * Encodes the specified LicensesSummary message. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary.verify|verify} messages. + * @function encode + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @static + * @param {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary} message LicensesSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LicensesSummary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.license != null && Object.hasOwnProperty.call(message, "license")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.license); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.count); + return writer; + }; + + /** + * Encodes the specified LicensesSummary message, length delimited. Does not implicitly {@link google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @static + * @param {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.ILicensesSummary} message LicensesSummary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LicensesSummary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LicensesSummary message from the specified reader or buffer. + * @function decode + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary} LicensesSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LicensesSummary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.license = reader.string(); + break; + } + case 2: { + message.count = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LicensesSummary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary} LicensesSummary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LicensesSummary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LicensesSummary message. + * @function verify + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LicensesSummary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.license != null && message.hasOwnProperty("license")) + if (!$util.isString(message.license)) + return "license: string expected"; + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + return null; + }; + + /** + * Creates a LicensesSummary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @static + * @param {Object.} object Plain object + * @returns {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary} LicensesSummary + */ + LicensesSummary.fromObject = function fromObject(object) { + if (object instanceof $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary) + return object; + var message = new $root.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary(); + if (object.license != null) + message.license = String(object.license); + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a LicensesSummary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @static + * @param {google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary} message LicensesSummary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LicensesSummary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.license = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + } + if (message.license != null && message.hasOwnProperty("license")) + object.license = message.license; + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + return object; + }; + + /** + * Converts this LicensesSummary to JSON. + * @function toJSON + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @instance + * @returns {Object.} JSON object + */ + LicensesSummary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LicensesSummary + * @function getTypeUrl + * @memberof google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LicensesSummary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse.LicensesSummary"; + }; + + return LicensesSummary; + })(); + + return PackagesSummaryResponse; + })(); + return v1beta1; })(); diff --git a/packages/google-devtools-containeranalysis/protos/protos.json b/packages/google-devtools-containeranalysis/protos/protos.json index c759a4e8469..daa5cf4aa59 100644 --- a/packages/google-devtools-containeranalysis/protos/protos.json +++ b/packages/google-devtools-containeranalysis/protos/protos.json @@ -1136,7 +1136,8 @@ "values": { "ATTACK_COMPLEXITY_UNSPECIFIED": 0, "ATTACK_COMPLEXITY_LOW": 1, - "ATTACK_COMPLEXITY_HIGH": 2 + "ATTACK_COMPLEXITY_HIGH": 2, + "ATTACK_COMPLEXITY_MEDIUM": 3 } }, "Authentication": { @@ -1174,7 +1175,9 @@ "IMPACT_UNSPECIFIED": 0, "IMPACT_HIGH": 1, "IMPACT_LOW": 2, - "IMPACT_NONE": 3 + "IMPACT_NONE": 3, + "IMPACT_PARTIAL": 4, + "IMPACT_COMPLETE": 5 } } } @@ -5140,6 +5143,48 @@ "(google.api.method_signature)": "resource,permissions" } ] + }, + "GeneratePackagesSummary": { + "requestType": "GeneratePackagesSummaryRequest", + "responseType": "PackagesSummaryResponse" + } + } + }, + "GeneratePackagesSummaryRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "PackagesSummaryResponse": { + "fields": { + "resourceUrl": { + "type": "string", + "id": 1 + }, + "licensesSummary": { + "rule": "repeated", + "type": "LicensesSummary", + "id": 2 + } + }, + "nested": { + "LicensesSummary": { + "fields": { + "license": { + "type": "string", + "id": 1 + }, + "count": { + "type": "int64", + "id": 2 + } + } } } } diff --git a/packages/google-devtools-containeranalysis/samples/README.md b/packages/google-devtools-containeranalysis/samples/README.md index 62653873e74..ab42522b1a9 100644 --- a/packages/google-devtools-containeranalysis/samples/README.md +++ b/packages/google-devtools-containeranalysis/samples/README.md @@ -30,6 +30,7 @@ * [Grafeas.list_occurrences](#grafeas.list_occurrences) * [Grafeas.update_note](#grafeas.update_note) * [Grafeas.update_occurrence](#grafeas.update_occurrence) + * [Container_analysis_v1_beta1.generate_packages_summary](#container_analysis_v1_beta1.generate_packages_summary) * [Container_analysis_v1_beta1.get_iam_policy](#container_analysis_v1_beta1.get_iam_policy) * [Container_analysis_v1_beta1.get_scan_config](#container_analysis_v1_beta1.get_scan_config) * [Container_analysis_v1_beta1.list_scan_configs](#container_analysis_v1_beta1.list_scan_configs) @@ -375,6 +376,23 @@ __Usage:__ +### Container_analysis_v1_beta1.generate_packages_summary + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js,samples/README.md) + +__Usage:__ + + +`node packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js` + + +----- + + + + ### Container_analysis_v1_beta1.get_iam_policy View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.get_iam_policy.js). diff --git a/packages/google-devtools-containeranalysis/samples/generated/v1/snippet_metadata.google.devtools.containeranalysis.v1.json b/packages/google-devtools-containeranalysis/samples/generated/v1/snippet_metadata.google.devtools.containeranalysis.v1.json index 1d6b8d43d75..4860f011594 100644 --- a/packages/google-devtools-containeranalysis/samples/generated/v1/snippet_metadata.google.devtools.containeranalysis.v1.json +++ b/packages/google-devtools-containeranalysis/samples/generated/v1/snippet_metadata.google.devtools.containeranalysis.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-containeranalysis", - "version": "4.6.0", + "version": "4.6.1", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js b/packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js new file mode 100644 index 00000000000..33b45f71689 --- /dev/null +++ b/packages/google-devtools-containeranalysis/samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// 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 +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the resource to get a packages summary for in the + * form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`. + */ + // const name = 'abc123' + + // Imports the Containeranalysis library + const {ContainerAnalysisV1Beta1Client} = require('@google-cloud/containeranalysis').v1beta1; + + // Instantiates a client + const containeranalysisClient = new ContainerAnalysisV1Beta1Client(); + + async function callGeneratePackagesSummary() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await containeranalysisClient.generatePackagesSummary(request); + console.log(response); + } + + callGeneratePackagesSummary(); + // [END containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-devtools-containeranalysis/samples/generated/v1beta1/snippet_metadata.google.devtools.containeranalysis.v1beta1.json b/packages/google-devtools-containeranalysis/samples/generated/v1beta1/snippet_metadata.google.devtools.containeranalysis.v1beta1.json index 481e978308f..abcb1b73c79 100644 --- a/packages/google-devtools-containeranalysis/samples/generated/v1beta1/snippet_metadata.google.devtools.containeranalysis.v1beta1.json +++ b/packages/google-devtools-containeranalysis/samples/generated/v1beta1/snippet_metadata.google.devtools.containeranalysis.v1beta1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-containeranalysis", - "version": "4.6.0", + "version": "4.6.1", "language": "TYPESCRIPT", "apis": [ { @@ -147,6 +147,46 @@ } } }, + { + "regionTag": "containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async", + "title": "containeranalysis generatePackagesSummary Sample", + "origin": "API_DEFINITION", + "description": " Gets a summary of the packages within a given resource.", + "canonical": true, + "file": "container_analysis_v1_beta1.generate_packages_summary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GeneratePackagesSummary", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GeneratePackagesSummary", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse", + "client": { + "shortName": "ContainerAnalysisV1Beta1Client", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1Client" + }, + "method": { + "shortName": "GeneratePackagesSummary", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1.GeneratePackagesSummary", + "service": { + "shortName": "ContainerAnalysisV1Beta1", + "fullName": "google.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1" + } + } + } + }, { "regionTag": "containeranalysis_v1beta1_generated_GrafeasV1Beta1_GetOccurrence_async", "title": "containeranalysis getOccurrence Sample", diff --git a/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client.ts b/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client.ts index f382e196c70..4e5050800ec 100644 --- a/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client.ts +++ b/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client.ts @@ -238,6 +238,7 @@ export class ContainerAnalysisV1Beta1Client { 'setIamPolicy', 'getIamPolicy', 'testIamPermissions', + 'generatePackagesSummary', ]; for (const methodName of containerAnalysisV1Beta1StubMethods) { const callPromise = this.containerAnalysisV1Beta1Stub.then( @@ -612,6 +613,104 @@ export class ContainerAnalysisV1Beta1Client { this.initialize(); return this.innerApiCalls.testIamPermissions(request, options, callback); } + /** + * Gets a summary of the packages within a given resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the resource to get a packages summary for in the + * form of `projects/[PROJECT_ID]/resources/[RESOURCE_URL]`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse | PackagesSummaryResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1beta1/container_analysis_v1_beta1.generate_packages_summary.js + * region_tag:containeranalysis_v1beta1_generated_ContainerAnalysisV1Beta1_GeneratePackagesSummary_async + */ + generatePackagesSummary( + request?: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + ( + | protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest + | undefined + ), + {} | undefined + ] + >; + generatePackagesSummary( + request: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, + options: CallOptions, + callback: Callback< + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + | protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generatePackagesSummary( + request: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, + callback: Callback< + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + | protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + generatePackagesSummary( + request?: protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + | protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + | protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse, + ( + | protos.google.devtools.containeranalysis.v1beta1.IGeneratePackagesSummaryRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.generatePackagesSummary( + request, + options, + callback + ); + } /** * Terminate the gRPC channel and close the client. diff --git a/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client_config.json b/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client_config.json index c55b5a6a33f..cda6d95cb3a 100644 --- a/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client_config.json +++ b/packages/google-devtools-containeranalysis/src/v1beta1/container_analysis_v1_beta1_client_config.json @@ -31,6 +31,10 @@ "TestIamPermissions": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" + }, + "GeneratePackagesSummary": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" } } } diff --git a/packages/google-devtools-containeranalysis/src/v1beta1/gapic_metadata.json b/packages/google-devtools-containeranalysis/src/v1beta1/gapic_metadata.json index 14b0ff2d3b4..7d486f3ad4d 100644 --- a/packages/google-devtools-containeranalysis/src/v1beta1/gapic_metadata.json +++ b/packages/google-devtools-containeranalysis/src/v1beta1/gapic_metadata.json @@ -24,6 +24,11 @@ "methods": [ "testIamPermissions" ] + }, + "GeneratePackagesSummary": { + "methods": [ + "generatePackagesSummary" + ] } } }, @@ -44,6 +49,11 @@ "methods": [ "testIamPermissions" ] + }, + "GeneratePackagesSummary": { + "methods": [ + "generatePackagesSummary" + ] } } } diff --git a/packages/google-devtools-containeranalysis/test/gapic_container_analysis_v1_beta1_v1beta1.ts b/packages/google-devtools-containeranalysis/test/gapic_container_analysis_v1_beta1_v1beta1.ts index 5c70103ccd1..30b70882642 100644 --- a/packages/google-devtools-containeranalysis/test/gapic_container_analysis_v1_beta1_v1beta1.ts +++ b/packages/google-devtools-containeranalysis/test/gapic_container_analysis_v1_beta1_v1beta1.ts @@ -613,4 +613,106 @@ describe('v1beta1.ContainerAnalysisV1Beta1Client', () => { await assert.rejects(client.testIamPermissions(request), expectedError); }); }); + + describe('generatePackagesSummary', () => { + it('invokes generatePackagesSummary without error', async () => { + const client = + new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse() + ); + client.innerApiCalls.generatePackagesSummary = + stubSimpleCall(expectedResponse); + const [response] = await client.generatePackagesSummary(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes generatePackagesSummary without error using callback', async () => { + const client = + new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.PackagesSummaryResponse() + ); + client.innerApiCalls.generatePackagesSummary = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generatePackagesSummary( + request, + ( + err?: Error | null, + result?: protos.google.devtools.containeranalysis.v1beta1.IPackagesSummaryResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes generatePackagesSummary with error', async () => { + const client = + new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.generatePackagesSummary = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.generatePackagesSummary(request), + expectedError + ); + }); + + it('invokes generatePackagesSummary with closed client', async () => { + const client = + new containeranalysisv1beta1Module.v1beta1.ContainerAnalysisV1Beta1Client( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.devtools.containeranalysis.v1beta1.GeneratePackagesSummaryRequest() + ); + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.generatePackagesSummary(request), + expectedError + ); + }); + }); }); diff --git a/packages/google-devtools-containeranalysis/webpack.config.js b/packages/google-devtools-containeranalysis/webpack.config.js index 1259341ea35..2fde85ada17 100644 --- a/packages/google-devtools-containeranalysis/webpack.config.js +++ b/packages/google-devtools-containeranalysis/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.